-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Closed
Labels
Description
🐛 Bug Report
JEST_WORKER_ID starts from 0 instead of 1 specified here:
Note: Each worker has a unique id (index that starts with 1) which is available on process.env.JEST_WORKER_ID
https://github.com/facebook/jest/blob/master/packages/jest-worker/README.md
To Reproduce
Its on a private repo. I have tried reproducing it on a public repo but I couldn't get it to work.
I have two .spec.ts files with the same content:
import knex from "knex";
import { createTestConnection } from "../test-utils/createTestConnection";
import { clearDatabase } from "../test-utils/clearDatabase";
var testConnection: knex;
beforeAll(async (done) => {
console.log(process.env.JEST_WORKER_ID);
const connection = await createTestConnection(process.env.JEST_WORKER_ID);
testConnection = connection;
done();
});
afterEach(async (done) => {
await clearDatabase(testConnection);
done();
});
afterAll((done) => {
testConnection.destroy(() => {
done();
});
});
test("quick maffs", async done => {
expect(1 + 1).toEqual(2);
done();
});
0 and 1 is printed.
Expected behavior
1 and 2 to be printed.