Argument 'done' is missing inside test.concurrent
See original GitHub issueDo you want to request a feature or report a bug?
Feature
What is the expected behavior?
I’d like to be able to use done
inside async concurrent tests. Here’s my use case:
import { execFile } from 'child-process-promise';
const pathToMyAwesomeCli = '...';
const projectDirs = ['...', '...'];
describe('my-awesome-cli', () => {
projectDirs.forEach((projectDir) => {
test(`correctly works for case project \`${projectName}\``, async (done) => {
try {
await execFile(pathToMyAwesomeCli, [], { cwd: projectDir });
done();
} catch ({ code }) {
done.fail(`non-zero exit code ${code}`);
}
})
})
})
The above simplified example works great, but unfortunately the tests execute one after another. When I replace test
with test.concurrent
to have multiple execFile
working in parallel, the done
argument is no longer available. This means that I cannot use done()
or done.fail()
inside a concurrent test. It’d be great if test.concurrent
and done
could work together.
Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
jest v22.1.4, node v9.4.0, yarn 1.3.2
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Globals - Jest
concurrent is considered experimental - see here for details on missing features and other issues. Use test.concurrent if you want the test to ......
Read more >Testing multiple missing arguments - Stack Overflow
I think there are a couple of quirks. You're calling missing from within another function, it may mix up names and character values...
Read more >How to Test Asynchronous Code with Jest | Pluralsight
In this guide, we will explore the different ways Jest give us to test ... Since the test function defines the done parameter,...
Read more >Testing Python in Visual Studio Code
Unit tests are concerned only with the unit's interface—its arguments and return values—not with its implementation (which is why no code is shown...
Read more >Test splitting and parallelism - CircleCI
circleci/config.yml file. The parallelism key specifies how many independent executors are set up to run the job. To run a job's steps in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You can do
.length
on the function btw to count number of arguments. You don’t needtoString
. That’s how jest itself detects if adone
callback should be injected or notWonderful! PRs and issues are most welcome 🙂
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.