-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test.concurrent() issue? #49
Comments
I never tested it with concurrency, so I may assume there is some race condition there. The workaround depends on the reason you need a concurrency, you can do it from outside rather with using jest. Would you like to provide a reproduction of the problem ? Either adding a test here , or creating a project that reproduces it ? If I will have a bit of time I can take a look if it's solvable. |
I can't seem to really reproduce it in my own personal project. However, it happens with some internal tests that I probably could not share the code here but the structure is something like this. The actual project is written with TypeScript. The actual tests between expecting The snapshot files are created correctly, but it would jump around from file to file with incorrect snapshot name (describe + it/test name + hint). The faulty behavior is the same is if you're running tests concurrently with describe("test", () => {
it.concurrent("test 1", async () => {
// sending http requests and getting the result
expect(2).toMatchSpecificSnapshot("./snapshots/one.snp", "test1");
});
it.concurrent("test 2", async () => {
// sending http requests and getting the result
expect({ foo: 2, bar: 3 }).toMatchSpecificSnapshot(
"./snapshots/two.snp",
{ foo: expect.any(Number) },
"test2"
);
});
it.concurrent("test 3", async () => {
// sending http requests and getting the result
expect({ baz: 3 }).toMatchSpecificSnapshot(
"./snapshots/three.snp",
{ baz: expect.any(Number) },
"test3"
);
});
}); |
In one test file, I have a few
describe()
and a fewtest.concurrent()
under each describe. In eachtest.concurrent()
, I have it save to different snapshot files.For example, for 10 total test, there will be 10 snapshot files.
However, I see that the snapshots are being saved to incorrect files with also incorrect names despite passing in the hint as well (they get mixed up with the test names).
Are there any workarounds to this issue?
The text was updated successfully, but these errors were encountered: