Failed to import Quick/Nimble in test target with cocoapods

304 views Asked by At

Problem: Suddenly my test target from the project created with Xcode 10 started failing with message "import Quick could not find module".

Additional details: If I would not build the main target, the test target would fail at 'FirebaseCore/FirebaseCore.h' file not found. Also I can see that building only the test target [making a project clean before] does not trigger building of any dependencies be it from the main target or test target dependencies.

Podfile looks like this:

ENV['COCOAPODS_DISABLE_STATS'] = "true"
platform :ios, '10.0'

use_frameworks!

target 'MyProject' do
  pod 'Firebase/Core'
  pod 'Crashlytics'
  pod 'Alamofire'
  pod 'KeychainSwift'

  target 'MyProjectTests' do 
    inherit! :search_paths

    pod 'Quick'
    pod 'Nimble'
  end

  target 'MyProjectUITests' do
    inherit! :complete   
  end
end

post_install do |installer_representation|
    installer_representation.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
          if config.name == 'Debug'
            config.build_settings['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = 'YES'
          end
            config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
        end
    end
end

How can I fix this and make sure building of the test targets triggers building of all the dependencies be it from main target or its own dependencies?

1

There are 1 answers

0
Fawkes On

Solution:

Make sure "YourTestSchema" -> edit schema -> build -> find implicit dependencies is ticked on

Additional details: Due to Quick having a cycle dependency according to Xcode 10 new building system, I turned this setting of and never though of it again until my CI failed. Make sure you're not doing the same mistake.