Skip to content

Commit

Permalink
Run with Jest Circus when passing the JEST_CIRCUS env variable as 1 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
captbaritone authored and thymikee committed May 26, 2018
1 parent 0d5fcdc commit c5994de
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
2 changes: 2 additions & 0 deletions integration-tests/__tests__/each.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ const runJest = require('../runJest');
const {extractSummary} = require('../Utils');
const dir = path.resolve(__dirname, '../each');
const SkipOnWindows = require('../../scripts/SkipOnWindows');
const SkipOnJestCircus = require('../../scripts/SkipOnJestCircus');

SkipOnWindows.suite();
SkipOnJestCircus.suite();

test('works with passing tests', () => {
const result = runJest(dir, ['success.test.js']);
Expand Down
8 changes: 6 additions & 2 deletions packages/jest-runner/src/run_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,12 @@ async function runTestInternal(

/* $FlowFixMe */
const TestEnvironment = (require(testEnvironment): EnvironmentClass);
/* $FlowFixMe */
const testFramework = (require(config.testRunner): TestFramework);
const testFramework = ((process.env.JEST_CIRCUS === '1'
? /* $FlowFixMe */
require('jest-circus/build/legacy_code_todo_rewrite/jest_adapter.js') // eslint-disable-line import/no-extraneous-dependencies
.default
: /* $FlowFixMe */
require(config.testRunner)): TestFramework);
/* $FlowFixMe */
const Runtime = (require(config.moduleLoader || 'jest-runtime'): Class<
RuntimeClass,
Expand Down
30 changes: 30 additions & 0 deletions scripts/SkipOnJestCircus.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

/* eslint-disable jest/no-focused-tests */

const SkipOnJestCircus = {
suite() {
if (process.env.JEST_CIRCUS === '1') {
fit('does not work on jest-circus', () => {
console.warn('[SKIP] Does not work on jest-circus');
});
}
},

test() {
if (process.env.JEST_CIRCUS === '1') {
console.warn('[SKIP] Does not work on jest-circus');
return true;
}
return false;
},
};

module.exports = SkipOnJestCircus;

0 comments on commit c5994de

Please sign in to comment.