Skip to content

Commit c5994de

Browse files
captbaritonethymikee
authored andcommitted
Run with Jest Circus when passing the JEST_CIRCUS env variable as 1 (#6285)
1 parent 0d5fcdc commit c5994de

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

integration-tests/__tests__/each.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ const runJest = require('../runJest');
1414
const {extractSummary} = require('../Utils');
1515
const dir = path.resolve(__dirname, '../each');
1616
const SkipOnWindows = require('../../scripts/SkipOnWindows');
17+
const SkipOnJestCircus = require('../../scripts/SkipOnJestCircus');
1718

1819
SkipOnWindows.suite();
20+
SkipOnJestCircus.suite();
1921

2022
test('works with passing tests', () => {
2123
const result = runJest(dir, ['success.test.js']);

packages/jest-runner/src/run_test.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,12 @@ async function runTestInternal(
6868

6969
/* $FlowFixMe */
7070
const TestEnvironment = (require(testEnvironment): EnvironmentClass);
71-
/* $FlowFixMe */
72-
const testFramework = (require(config.testRunner): TestFramework);
71+
const testFramework = ((process.env.JEST_CIRCUS === '1'
72+
? /* $FlowFixMe */
73+
require('jest-circus/build/legacy_code_todo_rewrite/jest_adapter.js') // eslint-disable-line import/no-extraneous-dependencies
74+
.default
75+
: /* $FlowFixMe */
76+
require(config.testRunner)): TestFramework);
7377
/* $FlowFixMe */
7478
const Runtime = (require(config.moduleLoader || 'jest-runtime'): Class<
7579
RuntimeClass,

scripts/SkipOnJestCircus.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/**
2+
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @flow
8+
*/
9+
10+
/* eslint-disable jest/no-focused-tests */
11+
12+
const SkipOnJestCircus = {
13+
suite() {
14+
if (process.env.JEST_CIRCUS === '1') {
15+
fit('does not work on jest-circus', () => {
16+
console.warn('[SKIP] Does not work on jest-circus');
17+
});
18+
}
19+
},
20+
21+
test() {
22+
if (process.env.JEST_CIRCUS === '1') {
23+
console.warn('[SKIP] Does not work on jest-circus');
24+
return true;
25+
}
26+
return false;
27+
},
28+
};
29+
30+
module.exports = SkipOnJestCircus;

0 commit comments

Comments
 (0)