Skip to content

Commit

Permalink
Updates snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
Maël Nison committed Apr 10, 2018
1 parent 67454a2 commit d6d9fc8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ exports[`--showConfig outputs config info and exits 1`] = `
\\"testRunner\\": \\"<<REPLACED_JEST_PACKAGES_DIR>>/jest-jasmine2/build/index.js\\",
\\"testURL\\": \\"about:blank\\",
\\"timers\\": \\"real\\",
\\"transform\\": [
[
\\"^.+\\\\\\\\.jsx?$\\",
\\"<<REPLACED_JEST_PACKAGES_DIR>>/babel-jest/build/index.js\\"
]
],
\\"transformIgnorePatterns\\": [
\\"/node_modules/\\"
],
Expand Down
11 changes: 5 additions & 6 deletions packages/jest-config/src/__tests__/normalize.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -684,9 +684,10 @@ describe('babel-jest', () => {
beforeEach(() => {
Resolver = require('jest-resolve');
Resolver.findNodeModule = jest.fn(
name => {
return name.indexOf('babel-jest') === -1 ? path.sep + 'node_modules' + path.sep + name : name;
}
name =>
name.indexOf('babel-jest') === -1
? path.sep + 'node_modules' + path.sep + name
: name,
);
});

Expand All @@ -699,9 +700,7 @@ describe('babel-jest', () => {
);

expect(options.transform[0][0]).toBe(DEFAULT_JS_PATTERN);
expect(options.transform[0][1]).toEqual(
require.resolve('babel-jest'),
);
expect(options.transform[0][1]).toEqual(require.resolve('babel-jest'));
expect(options.setupFiles).toEqual([
path.sep +
'node_modules' +
Expand Down
13 changes: 4 additions & 9 deletions packages/jest-config/src/normalize.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ import {
getTestEnvironment,
resolve,
} from './utils';
import {
NODE_MODULES,
DEFAULT_JS_PATTERN,
DEFAULT_REPORTER_LABEL,
} from './constants';
import {DEFAULT_JS_PATTERN, DEFAULT_REPORTER_LABEL} from './constants';
import {validateReporters} from './reporter_validation_errors';
import DEFAULT_CONFIG from './defaults';
import DEPRECATED_CONFIG from './deprecated';
Expand Down Expand Up @@ -103,7 +99,6 @@ const setupPreset = (
};

const setupBabelJest = (options: InitialOptions) => {
const basedir = options.rootDir;
const transform = options.transform;
let babelJest;
if (transform) {
Expand All @@ -113,19 +108,19 @@ const setupBabelJest = (options: InitialOptions) => {
});

if (customJSPattern) {
const customJSTransformer = options.transform[customJSPattern];
const customJSTransformer = transform[customJSPattern];

if (customJSTransformer === 'babel-jest') {
babelJest = require.resolve('babel-jest');
options.transform[customJSPattern] = babelJest;
transform[customJSPattern] = babelJest;
} else if (customJSTransformer.includes('babel-jest')) {
babelJest = customJSTransformer;
}
}
} else {
babelJest = require.resolve('babel-jest');
options.transform = {
[DEFAULT_JS_PATTERN]: babelJest
[DEFAULT_JS_PATTERN]: babelJest,
};
}

Expand Down

0 comments on commit d6d9fc8

Please sign in to comment.