Skip to content

Commit

Permalink
Expose throwOnModuleCollision (#8113)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjesun authored Mar 12, 2019
1 parent aece656 commit 8c128fa
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 1 deletion.
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

0 comments on commit 8c128fa

Please sign in to comment.