Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error "any AssertionHandler' has no member 'assertionFailure" when running example test #1076

Open
1 task done
molenick opened this issue Aug 10, 2023 · 7 comments
Open
1 task done

Comments

@molenick
Copy link

molenick commented Aug 10, 2023

  • I have read CONTRIBUTING and have done my best to follow them.

What did you do?

  1. Added quick and nimble to my pods file:
  target 'MyTests' do
    inherit! :complete
    pod 'Quick'
    pod 'Nimble'
  end

Is use_frameworks! required?

  1. pod install

  2. Add my test:

import Nimble
import Quick

class SomeSpec: QuickSpec {
  override func spec() {
    describe("Quick nimble config test") {
      it("has everything you need to get started") {
        expect(true).to(equal(true))
      }
    }
  }
}

What did you expect to happen?

The test to build and run.

What actually happened instead?

I got an error:

.../Pods/Nimble/Sources/Nimble/Adapters/AssertionRecorder.swift:81:26 Value of type 'any AssertionHandler' has no member 'assertionFailure'

Environment

List the software versions you're using:

  • Quick: 5.0.1
  • Nimble: 10.0.0
  • Xcode Version: 14.3.1)
  • Swift Version: 5.8.1)

Please also mention which package manager you used and its version. Delete the
other package managers in this list:

  • Cocoapods: 1.12.1
@molenick
Copy link
Author

If it's useful, I get the same error with just this minimal spec:

import Nimble
import Quick

class MobileTests: QuickSpec {}

@molenick
Copy link
Author

molenick commented Aug 10, 2023

I think I figured it out - I wasn't importing XCTest so Nimble's default assertion handler was missing, thus the error.

After adding the import and doing the following:

  • close xcode
  • delete DerivedData
  • pod deintegrate
  • pod install

I got the test to build and run. :)

@molenick
Copy link
Author

Scratch that, it works on the first run but subsequent runs re-surface the same issue.

@molenick molenick reopened this Aug 10, 2023
@younata
Copy link
Member

younata commented Aug 12, 2023

Weird. I'm unable to reproduce the issue.

Attached is a zip file of the sample project I'm working with. Incredibly minimal, based off what you provided. Are you doing anything odd with Nimble (like a custom assertion recorder/handler, maybe?) that could help me reproduce?

CocoapodsTestApp.zip

@younata
Copy link
Member

younata commented Aug 12, 2023

Also, I do have to point out that Nimble 10 is more than a year old at this point. I understand the reluctance to upgrade Quick (though, Quick 7 fixes the issues with Quick 6). Nimble 12.2.0 is the current version, so maybe updating might help?

@molenick
Copy link
Author

Thanks for taking a look! I ended up getting this working with SPM and Quick 7/Nimble 12. I'm going to try and circle back and try again with CocoaPods and more recent versions and report back.

The versions in my original issue were what I ended up with just adding version-less pods to my podfile. I'll try again with the most recent and see if that was enough to get things going.

@molenick
Copy link
Author

Took a look again and got the same results for Quick 7 and Nimble 12 using Cocoapads. This is for a React Native project, my hunch is that there's some friction around the way RN includes pods in targets since @younata's sample app demonstrates there's no issue in quick/nimble itself.

The weird thing for me, which is probably a hint, is that the tests build and run successfully on the first run but fail on every subsequent build. 🤷‍♀️

I think the solution for me is to just include Quick/Nimble in my project using SPM since it's working and doesn't make things too terribly complicated from a dependency management perspective.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants