Quick / Nimble

A Matcher Framework for Swift and Objective-C
https://quick.github.io/Nimble/documentation/nimble/
Apache License 2.0
4.8k stars 601 forks source link

Spurious failure: Nested async expectations are not allowed to avoid creating flaky tests #1026

Closed xinsight closed 1 week ago

xinsight commented 1 year ago

What did you do?

I ran a test that has passed many times in the past, but is now failing.

class ExportDataActionSpec: QuickSpec {
    override func spec() {
        describe("ExportDataAction") {
            it("should do something") {
                let viewController = UIViewControllerMock()
                let session = MockNetworkSession.session
                let action = ExportDataAction(viewController: viewController, session: session)
                action.execute()
                expect(viewController.viewControllerFromPresentCall).toEventually(beAKindOf(UIActivityViewController.self), timeout: .seconds(3))
            }
        }
    }
}

What did you expect to happen?

I expect the test to pass.

The test always passes locally, but only seems to fail when running in CI. (github action)

What actually happened instead?

The test failed with:

Nested async expectations are not allowed to avoid creating flaky tests.

I don't understand this message as there are no nested async expectations. What am I missing?

Environment

List the software versions you're using:

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

aaasifrz9 commented 1 week ago

I am also facing the above issue as Nested async expectations are not allowed to avoid creating flaky tests.. And app is crashing also after updating the ViewInspector version from 0.9.10 to 0.10.0. All the test cases were passing with version 0.9.10. Could you please help how to fix this issue?

Environment List the software versions using:

Quick: 5.0.1 Nimble: 10.0.0 View Inspector: 0.10.0 Xcode Version: 16.0

younata commented 1 week ago

Quick 5 and Nimble 10 are a few years out of date right now, and I no longer support them.

As of this comment, Quick is on v7.6.2 now, and Nimble is on v13.6.0.

If you tried upgrading to Quick 6, but were turned off by the atrocious migration process, know that Quick 5 -> 7 has a much simpler migration process (it's near the bottom of the highlights for the Quick 7.0.0 release notes).

Closing this issue because it might be fixed in the newer versions of Nimble.