Skip to content
/ jest Public
forked from jestjs/jest

Commit

Permalink
fix almost all tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed May 28, 2021
1 parent f9e8e2a commit 99c1122
Show file tree
Hide file tree
Showing 4 changed files with 280 additions and 161 deletions.
2 changes: 1 addition & 1 deletion e2e/__tests__/__snapshots__/showConfig.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ exports[`--showConfig outputs config info and exits 1`] = `
"roots": [
"<<REPLACED_ROOT_DIR>>"
],
"runner": "jest-runner",
"runner": "<<REPLACED_JEST_PACKAGES_DIR>>/jest-runner/build/index.js",
"setupFiles": [],
"setupFilesAfterEnv": [],
"skipFilter": false,
Expand Down
28 changes: 16 additions & 12 deletions packages/jest-core/src/__tests__/TestScheduler.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,20 @@ const mockSerialRunner = {
isSerial: true,
runTests: jest.fn(),
};
jest.mock('jest-runner-serial', () => jest.fn(() => mockSerialRunner), {
virtual: true,
});
jest.mock(
`${__dirname}/jest-runner-serial`,
() => jest.fn(() => mockSerialRunner),
{virtual: true},
);

const mockParallelRunner = {
runTests: jest.fn(),
};
jest.mock('jest-runner-parallel', () => jest.fn(() => mockParallelRunner), {
virtual: true,
});
jest.mock(
`${__dirname}/jest-runner-parallel`,
() => jest.fn(() => mockParallelRunner),
{virtual: true},
);

const spyShouldRunInBand = jest.spyOn(testSchedulerHelper, 'shouldRunInBand');

Expand Down Expand Up @@ -89,7 +93,7 @@ test('schedule tests run in parallel per default', async () => {
context: {
config: makeProjectConfig({
moduleFileExtensions: ['.js'],
runner: 'jest-runner-parallel',
runner: `${__dirname}/jest-runner-parallel`,
transform: [],
}),
hasteFS: {
Expand All @@ -112,7 +116,7 @@ test('schedule tests run in serial if the runner flags them', async () => {
context: {
config: makeProjectConfig({
moduleFileExtensions: ['.js'],
runner: 'jest-runner-serial',
runner: `${__dirname}/jest-runner-serial`,
transform: [],
}),
hasteFS: {
Expand All @@ -136,7 +140,7 @@ test('should bail after `n` failures', async () => {
config: makeProjectConfig({
moduleFileExtensions: ['.js'],
rootDir: './',
runner: 'jest-runner-serial',
runner: `${__dirname}/jest-runner-serial`,
transform: [],
}),
hasteFS: {
Expand Down Expand Up @@ -168,7 +172,7 @@ test('should not bail if less than `n` failures', async () => {
config: makeProjectConfig({
moduleFileExtensions: ['.js'],
rootDir: './',
runner: 'jest-runner-serial',
runner: `${__dirname}/jest-runner-serial`,
transform: [],
}),
hasteFS: {
Expand Down Expand Up @@ -199,7 +203,7 @@ test('should set runInBand to run in serial', async () => {
context: {
config: makeProjectConfig({
moduleFileExtensions: ['.js'],
runner: 'jest-runner-parallel',
runner: `${__dirname}/jest-runner-parallel`,
transform: [],
}),
hasteFS: {
Expand All @@ -225,7 +229,7 @@ test('should set runInBand to not run in serial', async () => {
context: {
config: makeProjectConfig({
moduleFileExtensions: ['.js'],
runner: 'jest-runner-parallel',
runner: `${__dirname}/jest-runner-parallel`,
transform: [],
}),
hasteFS: {
Expand Down
Loading

0 comments on commit 99c1122

Please sign in to comment.