any showcase for node:test `concurrency` options?
Details
as https://nodejs.org/dist/latest-v18.x/docs/api/test.html#testname-options-fn docs says, subtests could run concurrency.
when try as:
test('multi level test', { concurrency: 2 }, async (t) => { await t.test('subtest 1', async () => { console.log('1'); await setTimeout(2000); console.log('11'); }); await t.test('subtest 2', async () => { console.log('2'); await setTimeout(1000); console.log('22'); }); });
itdon't work, since each subtests is awaited.
but if write test like below:
test('multi level test', { concurrency: 2 }, async (t) => { t.test('subtest 1', async () => { console.log('1'); await setTimeout(2000); console.log('11'); }); t.test('subtest 2', async () => { console.log('2'); await setTimeout(1000); console.log('22'); }); });
got error:
not ok 1 - subtest 1
---
duration_ms: 0.001728458
failureType: 'cancelledByParent'
error: "'test did not finish before its parent and was cancelled'"
code: ERR_TEST_FAILURE
...Node.js version
18.0.0
Example code
No response
Operating system
macOS
Scope
test
Module and version
Not applicable.