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

Expose throwOnModuleCollision #8113

Merged
merged 1 commit into from
Mar 12, 2019
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

### Features

- `[jest-haste-map]` Expose `throwOnModuleCollision` via `config.haste` ([#8113](https://github.com/facebook/jest/pull/8113))

### Fixes

### Chore & Maintenance
Expand Down
3 changes: 2 additions & 1 deletion e2e/__tests__/__snapshots__/showConfig.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ exports[`--showConfig outputs config info and exits 1`] = `
"globals": {},
"haste": {
"computeSha1": false,
"providesModuleNodeModules": []
"providesModuleNodeModules": [],
"throwOnModuleCollision": false
},
"moduleDirectories": [
"node_modules"
Expand Down
1 change: 1 addition & 0 deletions packages/jest-config/src/Defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const defaultOptions: Config.DefaultOptions = {
haste: {
computeSha1: false,
providesModuleNodeModules: [],
throwOnModuleCollision: false,
},
maxConcurrency: 5,
moduleDirectories: ['node_modules'],
Expand Down
1 change: 1 addition & 0 deletions packages/jest-config/src/ValidConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const initialOptions: Config.InitialOptions = {
hasteImplModulePath: '<rootDir>/haste_impl.js',
platforms: ['ios', 'android'],
providesModuleNodeModules: ['react', 'react-native'],
throwOnModuleCollision: false,
},
json: false,
lastCommit: false,
Expand Down
1 change: 1 addition & 0 deletions packages/jest-runtime/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ class Runtime {
retainAllFiles: false,
rootDir: config.rootDir,
roots: config.roots,
throwOnModuleCollision: config.haste.throwOnModuleCollision,
useWatchman: options && options.watchman,
watch: options && options.watch,
});
Expand Down
1 change: 1 addition & 0 deletions packages/jest-types/src/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export type HasteConfig = {
hasteImplModulePath?: string;
platforms?: Array<string>;
providesModuleNodeModules: Array<string>;
throwOnModuleCollision?: boolean;
};

export type ReporterConfig = [string, {[key: string]: unknown}];
Expand Down
1 change: 1 addition & 0 deletions types/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export type HasteConfig = {|
hasteImplModulePath?: string,
platforms?: Array<string>,
providesModuleNodeModules: Array<string>,
throwOnModuleCollision?: boolean,
|};

export type ReporterConfig = [string, Object];
Expand Down