Replies: 1 comment
-
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What you're trying to do: investigate and/or clarify Ava's semantics as well as test Ava out to see if I like it and want to use it
What happened: see issue title
What you expected to happen: the timeout to interrupt test execution
package.json
Sample code (ran with
npm run test -- --timeout=1m
)Remove all occurrences of
async
andawait
above and you get the same exact behavior. This example either hangs indefinitely (if it's possible to disable the global timer) or causes the the global timer to timeout which:^^^ this here brings me to something else I noticed (it implies that tests are not in fact concurrently executed). Ava is documented as running individual tests "concurrently" when this is in fact not the case (correct me if I'm mistaken). IIRC, the only way to achieve concurrency in javascript (within a single process at least) is via workers/web workers (aka threads), and from what I could tell after glancing over Ava's code and documentation (as well as from running the example above), individual tests are not run in separate workers (only separate test files are). How is concurrency between individual tests themselves achieved without the use of multiple workers/threads? Promise execution does not happen concurrently because javascript is single-threaded. I just don't think it's correct to say that the individual tests are executed "concurrently" because concurrency is defined as two things happening simultaneously (Promises in js are executed in a serial sequence, and that sequence is probably even well-defined - I don't know, I haven't looked at the ECMA spec lately. Promises do not execute during or alongside sync functions either - it's all the same single thread and promises are deferred until the javascript call-stack is empty).
I apologize for nitpicking here I'm just confused. Either I'm wrong, or the docs are inaccurate and misleading.
Edit: Take that 2nd part with a grain of salt. I wrote that while somehow forgetting that 99% of the time Promises are used as an interface to some external/lower-level external resource, and within that context I can see where the concurrency and out-of-order execution come into play when it comes to Promises. I am still wondering if this is the intended behavior for
t.timeout()
though because I also found this in the v4.0.0 release notes:Thanks
Beta Was this translation helpful? Give feedback.
All reactions