Skip to content

Commit

Permalink
Revert "Add new "setupTestFramework" option (#4976)" (#5025)
Browse files Browse the repository at this point in the history
This reverts commit dbfd787.
  • Loading branch information
mjesun authored and cpojer committed Dec 6, 2017
1 parent 0ce82e6 commit 6ade256
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 36 deletions.
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,7 @@
"transform": {
"^.+\\.js$": "<rootDir>/packages/babel-jest"
},
"setupTestFramework": [
"<rootDir>/test_setup_file.js"
],
"setupTestFrameworkScriptFile": "<rootDir>/test_setup_file.js",
"snapshotSerializers": [
"<rootDir>/packages/pretty-format/build/plugins/convert_ansi.js"
],
Expand Down
8 changes: 1 addition & 7 deletions packages/jest-cli/src/cli/args.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
1 change: 0 additions & 1 deletion packages/jest-config/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion packages/jest-config/src/normalize.js
Original file line number Diff line number Diff line change
Expand Up @@ -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] &&
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-config/src/valid_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default ({
runTestsByPath: false,
runner: 'jest-runner',
setupFiles: ['<rootDir>/setup.js'],
setupTestFramework: ['<rootDir>/test_setup_file.js'],
setupTestFrameworkScriptFile: '<rootDir>/test_setup_file.js',
silent: true,
skipNodeResolution: false,
snapshotSerializers: ['my-serializer-module'],
Expand Down
6 changes: 0 additions & 6 deletions packages/jest-jasmine2/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
20 changes: 7 additions & 13 deletions test_setup_file.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
1 change: 0 additions & 1 deletion test_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ const DEFAULT_PROJECT_CONFIG: ProjectConfig = {
roots: [],
runner: 'jest-runner',
setupFiles: [],
setupTestFramework: [],
setupTestFrameworkScriptFile: null,
skipNodeResolution: false,
snapshotSerializers: [],
Expand Down
1 change: 0 additions & 1 deletion types/Argv.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ export type Argv = {|
rootDir: string,
roots: Array<string>,
setupFiles: Array<string>,
setupTestFramework: Array<string>,
setupTestFrameworkScriptFile: string,
silent: boolean,
snapshotSerializers: Array<string>,
Expand Down
2 changes: 0 additions & 2 deletions types/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ export type InitialOptions = {
runTestsByPath?: boolean,
scriptPreprocessor?: string,
setupFiles?: Array<Path>,
setupTestFramework?: Array<Path>,
setupTestFrameworkScriptFile?: Path,
silent?: boolean,
skipNodeResolution?: boolean,
Expand Down Expand Up @@ -219,7 +218,6 @@ export type ProjectConfig = {|
roots: Array<Path>,
runner: string,
setupFiles: Array<Path>,
setupTestFramework: Array<Path>,
setupTestFrameworkScriptFile: ?Path,
skipNodeResolution: boolean,
snapshotSerializers: Array<Path>,
Expand Down

0 comments on commit 6ade256

Please sign in to comment.