diff --git a/packages/jest-cli/src/runJest.js b/packages/jest-cli/src/runJest.js index ae7257900460..9eb7007a2518 100644 --- a/packages/jest-cli/src/runJest.js +++ b/packages/jest-cli/src/runJest.js @@ -29,14 +29,6 @@ import FailedTestsCache from './FailedTestsCache'; import {JestHook} from 'jest-watcher'; import collectNodeHandles from './collectHandles'; -const setConfig = (contexts, newConfig) => - contexts.forEach( - context => - (context.config = Object.freeze( - Object.assign({}, context.config, newConfig), - )), - ); - const getTestPaths = async ( globalConfig, context, @@ -256,15 +248,6 @@ export default (async function runJest({ globalConfig = Object.freeze(newConfig); } - // When using more than one context, make all printed paths relative to the - // current cwd. Do not modify rootDir, since will be used by custom resolvers. - // If --runInBand is true, the resolver saved a copy during initialization, - // however, if it is running on spawned processes, the initiation of the - // custom resolvers is done within each spawned process and it needs the - // original value of rootDir. Instead, use the {cwd: Path} property to resolve - // paths when printing. - setConfig(contexts, {cwd: process.cwd()}); - let collectHandles; if (globalConfig.detectOpenHandles) { diff --git a/packages/jest-config/src/Defaults.js b/packages/jest-config/src/Defaults.js index fd2c040015d0..fefe239a189a 100644 --- a/packages/jest-config/src/Defaults.js +++ b/packages/jest-config/src/Defaults.js @@ -29,6 +29,7 @@ export default ({ coveragePathIgnorePatterns: [NODE_MODULES_REGEXP], coverageReporters: ['json', 'text', 'lcov', 'clover'], coverageThreshold: null, + cwd: process.cwd(), detectLeaks: false, detectOpenHandles: false, errorOnDeprecated: false, diff --git a/types/Config.js b/types/Config.js index d13f38827d4a..b08323e950bb 100644 --- a/types/Config.js +++ b/types/Config.js @@ -35,6 +35,7 @@ export type DefaultOptions = {| coveragePathIgnorePatterns: Array, coverageReporters: Array, coverageThreshold: ?{global: {[key: string]: number}}, + cwd: Path, errorOnDeprecated: boolean, expand: boolean, filter: ?Path,