Search code examples
objective-cunit-testingcocoapodspodspec

How can I make Cocoapods.org discover that my pod has Tests?


I've got a pod on Cocoapods with tests, but cocoapods.org is saying the pod has no tests. How can I do it? What I'm doing wrong?

https://cocoapods.org/pods/SearchEmojiOnString https://github.com/GabrielMassana/SearchEmojiOnString-iOS


Solution

  • The code isn't too complex: https://github.com/CocoaPods/cocoadocs.org/blob/master/classes/testing_idealist.rb

    Roughly:

    • Get all projects in the root dir
    • Get all test targets in those projects
    • Loop through all associated files, looking for common test patterns
    • look for common expectations via regexes e.g.

      regexes = [/XCTAssert|XCTFail/, # XCTest /expect\(/, # Expecta, Nimble /should\]|shouldNot\]/, # Kiwi /assertThat/, # OCHamcrest / should .*;| should_not |expect\(/, # Cedar /FBSnapshotVerify/ # FBSnapshotTestCase ]

    • Count all of those matches, and put that number into the DB as total_test_expectations.

    Judging on my comments inline, we've had problems before with Unicode in the Xcode project. Perhaps that's your problem, would appreciate a PR if you can figure it out.