From 266e7dcab41152f136c38e5e27ad84ff484321da Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Sun, 27 May 2018 17:11:52 +0100 Subject: [PATCH] Make the jest-circus export compatible with regular runners (#6312) --- packages/jest-circus/runner.js | 13 +++++++++++++ .../src/legacy_code_todo_rewrite/jest_adapter.js | 2 +- packages/jest-runner/src/run_test.js | 4 +--- 3 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 packages/jest-circus/runner.js diff --git a/packages/jest-circus/runner.js b/packages/jest-circus/runner.js new file mode 100644 index 000000000000..214956a9f42a --- /dev/null +++ b/packages/jest-circus/runner.js @@ -0,0 +1,13 @@ +/** + * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @flow + */ + +// Allow people to use `jest-circus/runner` as a runner. +const runner = require('./build/legacy_code_todo_rewrite/jest_adapter'); +module.exports = runner; diff --git a/packages/jest-circus/src/legacy_code_todo_rewrite/jest_adapter.js b/packages/jest-circus/src/legacy_code_todo_rewrite/jest_adapter.js index 16648baa0907..039a3f6f23eb 100644 --- a/packages/jest-circus/src/legacy_code_todo_rewrite/jest_adapter.js +++ b/packages/jest-circus/src/legacy_code_todo_rewrite/jest_adapter.js @@ -108,4 +108,4 @@ const _addSnapshotData = (results: TestResult, snapshotState) => { return results; }; -export default jestAdapter; +module.exports = jestAdapter; diff --git a/packages/jest-runner/src/run_test.js b/packages/jest-runner/src/run_test.js index e190f2e9e437..aa3fa87838d0 100644 --- a/packages/jest-runner/src/run_test.js +++ b/packages/jest-runner/src/run_test.js @@ -69,9 +69,7 @@ async function runTestInternal( /* $FlowFixMe */ const TestEnvironment = (require(testEnvironment): EnvironmentClass); 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 + ? require('jest-circus/runner') // eslint-disable-line import/no-extraneous-dependencies : /* $FlowFixMe */ require(config.testRunner)): TestFramework); /* $FlowFixMe */