Skip to content

Commit

Permalink
Fix tests using partial GlobalConfigs
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonchinn178 committed Sep 22, 2023
1 parent 1911750 commit 5fd3eda
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ exports[`Watch mode flows Pressing "P" enters pattern mode 9`] = `
Object {
"onlyChanged": false,
"passWithNoTests": true,
"rootDir": "",
"testPathPatterns": Array [
"p.*3",
],
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-core/src/__tests__/runJest.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ describe('runJest', () => {
changedFilesPromise: Promise.resolve({repos: {git: {size: 0}}}),
contexts: [],
globalConfig: {
rootDir: '',
testPathPatterns: [],
testSequencer: require.resolve('@jest/test-sequencer'),
watch: true,
},
Expand Down
6 changes: 5 additions & 1 deletion packages/jest-core/src/__tests__/watch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ describe('Watch mode flows', () => {
testRegex: [],
};
pipe = {write: jest.fn()};
globalConfig = {watch: true};
globalConfig = {
rootDir: '',
testPathPatterns: [],
watch: true,
};
hasteMapInstances = [{on: () => {}}];
contexts = [{config}];
stdin = new MockStdin();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ const watch = require('../watch').default;

const nextTick = () => new Promise(res => process.nextTick(res));

const globalConfig = {watch: true};
const globalConfig = {
rootDir: '',
testPathPatterns: [],
watch: true,
};

afterEach(runJestMock.mockReset);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ jest.doMock(
const watch = require('../watch').default;

const globalConfig = {
rootDir: '',
testPathPatterns: [],
watch: true,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const now = Date.now;
const write = process.stderr.write;
const globalConfig = {
rootDir: 'root',
testPathPatterns: [],
watch: false,
};

Expand Down

0 comments on commit 5fd3eda

Please sign in to comment.