Coder Social home page Coder Social logo

Comments (1)

younata avatar younata commented on June 2, 2024

Yeah. This is unsurprising, but still disappointing. It's also a bug with Quick, not Nimble - you'd get similar behavior if you tried the following code:

class AsyncConfiguration: QuickConfiguration {
    override class func configuration(_ configuration: QCKConfiguration) {
        configuration.beforeEach {
            let start = Date()
            RunLoop.main.run(until: Date(timeIntervalSinceNow: 2))
            expect(date.timeIntervalSince(start)).to(beCloseTo(2, within: 0.01)) // this assertion will fail when run with an async spec.
        }
    }
}

AsyncExample will run the stuff in your QuickConfiguration, as a matter of fact. This is desired because using any kind of waiting behavior in that kind of global configuration is an edge case (QuickConfiguration is meant more for doing stuff like configuring your test suite, not waiting for stuff to be available).

This is an issue when you try to run the sync versions of waitUntil, toEventually, etc. because those use APIs which no-op when run in an async context.

Possibly we might be able to get around this by detecting these cases and run them on the main actor using MainActor.run, similar to what we do for the suite hooks (i.e. the beforeSuite and afterSuite things) (see https://github.com/Quick/Quick/blob/main/Sources/Quick/Examples/AsyncExample.swift#L38-L40).

from nimble.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.