diff --git a/package.json b/package.json index 7af9d09bbfe5..3967567b6667 100644 --- a/package.json +++ b/package.json @@ -127,9 +127,7 @@ "transform": { "^.+\\.js$": "/packages/babel-jest" }, - "setupTestFramework": [ - "/test_setup_file.js" - ], + "setupTestFrameworkScriptFile": "/test_setup_file.js", "snapshotSerializers": [ "/packages/pretty-format/build/plugins/convert_ansi.js" ], diff --git a/packages/jest-cli/src/cli/args.js b/packages/jest-cli/src/cli/args.js index 2620f050368f..c312674a2d9e 100644 --- a/packages/jest-cli/src/cli/args.js +++ b/packages/jest-cli/src/cli/args.js @@ -426,13 +426,7 @@ export const options = { setupFiles: { description: 'The paths to modules that run some code to configure or ' + - 'set up the testing environment before each test.', - type: 'array', - }, - setupTestFramework: { - description: - 'Allows to setup the Jasmine environment from the global namespace, ' + - 'instead of injecting the module inside the context', + 'set up the testing environment before each test. ', type: 'array', }, setupTestFrameworkScriptFile: { diff --git a/packages/jest-config/src/index.js b/packages/jest-config/src/index.js index 4305850c62bb..d070c3789173 100644 --- a/packages/jest-config/src/index.js +++ b/packages/jest-config/src/index.js @@ -142,7 +142,6 @@ const getConfigs = ( roots: options.roots, runner: options.runner, setupFiles: options.setupFiles, - setupTestFramework: options.setupTestFramework, setupTestFrameworkScriptFile: options.setupTestFrameworkScriptFile, skipNodeResolution: options.skipNodeResolution, snapshotSerializers: options.snapshotSerializers, diff --git a/packages/jest-config/src/normalize.js b/packages/jest-config/src/normalize.js index 472c983f4ac2..412289e19071 100644 --- a/packages/jest-config/src/normalize.js +++ b/packages/jest-config/src/normalize.js @@ -359,7 +359,6 @@ export default function normalize(options: InitialOptions, argv: Argv) { value = normalizeCollectCoverageOnlyFrom(options, key); break; case 'setupFiles': - case 'setupTestFramework': case 'snapshotSerializers': value = options[key] && diff --git a/packages/jest-config/src/valid_config.js b/packages/jest-config/src/valid_config.js index c1c5fa9a9707..5c6bf89f166d 100644 --- a/packages/jest-config/src/valid_config.js +++ b/packages/jest-config/src/valid_config.js @@ -72,7 +72,7 @@ export default ({ runTestsByPath: false, runner: 'jest-runner', setupFiles: ['/setup.js'], - setupTestFramework: ['/test_setup_file.js'], + setupTestFrameworkScriptFile: '/test_setup_file.js', silent: true, skipNodeResolution: false, snapshotSerializers: ['my-serializer-module'], diff --git a/packages/jest-jasmine2/src/index.js b/packages/jest-jasmine2/src/index.js index c6e8e4a5fc26..ea3b91ba8eab 100644 --- a/packages/jest-jasmine2/src/index.js +++ b/packages/jest-jasmine2/src/index.js @@ -112,12 +112,6 @@ async function jasmine2( runtime.requireModule(config.setupTestFrameworkScriptFile); } - if (config.setupTestFramework && config.setupTestFramework.length) { - config.setupTestFramework.forEach(module => { - require(module)(environment.global); - }); - } - runtime .requireModule(require.resolve('source-map-support'), 'source-map-support') .install({ diff --git a/test_setup_file.js b/test_setup_file.js index e6613fb969a1..b6c5c3b99e16 100644 --- a/test_setup_file.js +++ b/test_setup_file.js @@ -7,17 +7,11 @@ const jasmineReporters = require('jasmine-reporters'); -module.exports = function(global) { - const {jasmine} = global; +// Some of the `jest-runtime` tests are very slow and cause +// timeouts on travis +jest.setTimeout(70000); - if (jasmine) { - // Some of the `jest-runtime` tests are very slow and cause timeouts on - // Travis CI. - jasmine.DEFAULT_TIMEOUT_INTERVAL = 70000; - - // Running on AppVeyor, add the custom reporter. - if (process.env.APPVEYOR_API_URL) { - jasmine.getEnv().addReporter(new jasmineReporters.AppVeyorReporter()); - } - } -}; +if (global.jasmine && process.env.APPVEYOR_API_URL) { + // Running on AppVeyor, add the custom reporter. + jasmine.getEnv().addReporter(new jasmineReporters.AppVeyorReporter()); +} diff --git a/test_utils.js b/test_utils.js index 3fa55abc6271..d3bf95950d99 100644 --- a/test_utils.js +++ b/test_utils.js @@ -84,7 +84,6 @@ const DEFAULT_PROJECT_CONFIG: ProjectConfig = { roots: [], runner: 'jest-runner', setupFiles: [], - setupTestFramework: [], setupTestFrameworkScriptFile: null, skipNodeResolution: false, snapshotSerializers: [], diff --git a/types/Argv.js b/types/Argv.js index f9542351aafe..7125a0f75ce9 100644 --- a/types/Argv.js +++ b/types/Argv.js @@ -61,7 +61,6 @@ export type Argv = {| rootDir: string, roots: Array, setupFiles: Array, - setupTestFramework: Array, setupTestFrameworkScriptFile: string, silent: boolean, snapshotSerializers: Array, diff --git a/types/Config.js b/types/Config.js index 9dfa137b7ce4..585cd27ee8ce 100644 --- a/types/Config.js +++ b/types/Config.js @@ -116,7 +116,6 @@ export type InitialOptions = { runTestsByPath?: boolean, scriptPreprocessor?: string, setupFiles?: Array, - setupTestFramework?: Array, setupTestFrameworkScriptFile?: Path, silent?: boolean, skipNodeResolution?: boolean, @@ -219,7 +218,6 @@ export type ProjectConfig = {| roots: Array, runner: string, setupFiles: Array, - setupTestFramework: Array, setupTestFrameworkScriptFile: ?Path, skipNodeResolution: boolean, snapshotSerializers: Array,