Skip to content

Commit

Permalink
Move assignment of cwd to default config
Browse files Browse the repository at this point in the history
  • Loading branch information
rubennorte committed Oct 12, 2018
1 parent 5fcaa24 commit d0751dd
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 17 deletions.
17 changes: 0 additions & 17 deletions packages/jest-cli/src/runJest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions packages/jest-config/src/Defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions types/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export type DefaultOptions = {|
coveragePathIgnorePatterns: Array<string>,
coverageReporters: Array<string>,
coverageThreshold: ?{global: {[key: string]: number}},
cwd: Path,
errorOnDeprecated: boolean,
expand: boolean,
filter: ?Path,
Expand Down

0 comments on commit d0751dd

Please sign in to comment.