Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Revert "Add new "setupTestFramework" option (#4976)" #5025

Merged
merged 1 commit into from
Dec 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
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
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