Test cases where a Foo
object that has a bar
method which tracks its calls.
Within the beforeEach
hook, a Foo
object is constructed and its bar
method is called with the argument foo
, where foo
is equal to the same Foo
object.
Running tests in parallel causes the test.context.bar.prototype
to not be strictly equal to foo.bar.mock.calls[0].arguments[0].foo.bar.prototype
.
- There is no difference between the three cases they're just here to demonstrate running test cases in parallel
- No issue occurs when running tests in serial mode or when there is only one case.
- The last test case will always succeed.
Tested on versions:
6.2.0
Inside the following env:
- Linux
- Node v23.1.0
- npm v10.9.0
src/call-from-within-case.ava.test.js
: KOsrc/call-from-within-hook.ava.test.js
: KOsrc/no-hook.ava.test.js
: OKsrc/serial.ava.test.js
: OKsrc/call-from-within-hook.node.test.js
: OK
It is expected that all tests pass.
Using ava test runner:
npm test
Using node test runner:
npm run test:node
npm test -- debug src/call-from-within-hook.ava.test.js
Devtools:
curl 127.0.0.1:9229/json -s | jq .[].devtoolsFrontendUrl -r
- Open the URL inside chrome.
CLI:
node inspect 127.0.0.1:9229