Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Run with Jest Circus when passing the JEST_CIRCUS env variable as 1 #6285

Merged
merged 4 commits into from
May 26, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
6 changes: 5 additions & 1 deletion packages/jest-runner/src/run_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ async function runTestInternal(
/* $FlowFixMe */
const TestEnvironment = (require(testEnvironment): EnvironmentClass);
/* $FlowFixMe */
const testFramework = (require(config.testRunner): TestFramework);
const testFramework = ((process.env.JEST_CIRCUS === '1'
? // eslint-disable-next-line import/no-extraneous-dependencies
require('jest-circus/build/legacy_code_todo_rewrite/jest_adapter.js')
.default
: 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 SkipOnWindows = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 = SkipOnWindows;