Skip to content

Commit a59ca51

Browse files
committed
Remove providesModuleNodeModules from Jest.
1 parent 46f9a97 commit a59ca51

File tree

17 files changed

+14
-160
lines changed

17 files changed

+14
-160
lines changed

CHANGELOG.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@
88

99
### Fixes
1010

11-
- `[babel-plugin-jest-hoist]` Expand list of whitelisted globals in global mocks ([#8429](https://github.com/facebook/jest/pull/8429)
11+
- `[babel-plugin-jest-hoist]` Expand list of whitelisted globals in global mocks ([#8429](https://github.com/facebook/jest/pull/8429))
1212
- `[jest-core]` Make watch plugin initialization errors look nice ([#8422](https://github.com/facebook/jest/pull/8422))
1313

1414
### Chore & Maintenance
1515

16-
- `[jest-leak-detector]` remove code repeat ([#8438](https://github.com/facebook/jest/pull/8438)
17-
- `[docs]` Add example to `jest.requireActual` ([#8482](https://github.com/facebook/jest/pull/8482)
16+
- `[jest-leak-detector]` remove code repeat ([#8438](https://github.com/facebook/jest/pull/8438))
17+
- `[docs]` Add example to `jest.requireActual` ([#8482](https://github.com/facebook/jest/pull/8482))
18+
- `[jest-haste-map]` removed `providesModuleNodeModules` ([#8535](https://github.com/facebook/jest/pull/8535))
1819

1920
### Performance
2021

TestUtils.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,7 @@ const DEFAULT_PROJECT_CONFIG: Config.ProjectConfig = {
8383
globalSetup: null,
8484
globalTeardown: null,
8585
globals: {},
86-
haste: {
87-
providesModuleNodeModules: [],
88-
},
86+
haste: {},
8987
moduleDirectories: [],
9088
moduleFileExtensions: ['js'],
9189
moduleLoader: '/test_module_loader_path',

e2e/__tests__/__snapshots__/showConfig.test.ts.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ exports[`--showConfig outputs config info and exits 1`] = `
2424
"globals": {},
2525
"haste": {
2626
"computeSha1": false,
27-
"providesModuleNodeModules": [],
2827
"throwOnModuleCollision": false
2928
},
3029
"moduleDirectories": [

packages/jest-config/src/Defaults.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ const defaultOptions: Config.DefaultOptions = {
3636
globals: {},
3737
haste: {
3838
computeSha1: false,
39-
providesModuleNodeModules: [],
4039
throwOnModuleCollision: false,
4140
},
4241
maxConcurrency: 5,

packages/jest-config/src/ValidConfig.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ const initialOptions: Config.InitialOptions = {
5656
defaultPlatform: 'ios',
5757
hasteImplModulePath: '<rootDir>/haste_impl.js',
5858
platforms: ['ios', 'android'],
59-
providesModuleNodeModules: ['react', 'react-native'],
6059
throwOnModuleCollision: false,
6160
},
6261
json: false,

packages/jest-core/src/__tests__/SearchSource.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,6 @@ describe('SearchSource', () => {
386386
'__tests__',
387387
'haste_impl.js',
388388
),
389-
providesModuleNodeModules: [],
390389
},
391390
name: 'SearchSource-findRelatedTests-tests',
392391
rootDir,

packages/jest-core/src/lib/__tests__/__snapshots__/log_debug_messages.test.ts.snap

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ exports[`prints the config object 1`] = `
1919
"globalSetup": null,
2020
"globalTeardown": null,
2121
"globals": {},
22-
"haste": {
23-
"providesModuleNodeModules": []
24-
},
22+
"haste": {},
2523
"moduleDirectories": [],
2624
"moduleFileExtensions": [
2725
"js"

packages/jest-haste-map/src/__tests__/index.test.js

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,6 @@ describe('HasteMap', () => {
332332
const hasteMap = new HasteMap({
333333
...defaultConfig,
334334
mocksPattern: '/__mocks__/',
335-
providesModuleNodeModules: ['react', 'fbjs'],
336335
});
337336

338337
return hasteMap.build().then(({__hasteMapForTest: data}) => {
@@ -344,23 +343,6 @@ describe('HasteMap', () => {
344343
'fruits/Pear.js': ['Pear', 32, 42, 1, 'Banana\0Strawberry', null],
345344
'fruits/Strawberry.js': ['Strawberry', 32, 42, 1, '', null],
346345
'fruits/__mocks__/Pear.js': ['', 32, 42, 1, 'Melon', null],
347-
// node modules
348-
'fruits/node_modules/fbjs/lib/flatMap.js': [
349-
'flatMap',
350-
32,
351-
42,
352-
1,
353-
'',
354-
null,
355-
],
356-
'fruits/node_modules/react/React.js': [
357-
'React',
358-
32,
359-
42,
360-
1,
361-
'Component',
362-
null,
363-
],
364346
'vegetables/Melon.js': ['Melon', 32, 42, 1, '', null],
365347
}),
366348
);
@@ -370,21 +352,9 @@ describe('HasteMap', () => {
370352
Banana: {[H.GENERIC_PLATFORM]: ['fruits/Banana.js', H.MODULE]},
371353
Melon: {[H.GENERIC_PLATFORM]: ['vegetables/Melon.js', H.MODULE]},
372354
Pear: {[H.GENERIC_PLATFORM]: ['fruits/Pear.js', H.MODULE]},
373-
React: {
374-
[H.GENERIC_PLATFORM]: [
375-
'fruits/node_modules/react/React.js',
376-
H.MODULE,
377-
],
378-
},
379355
Strawberry: {
380356
[H.GENERIC_PLATFORM]: ['fruits/Strawberry.js', H.MODULE],
381357
},
382-
flatMap: {
383-
[H.GENERIC_PLATFORM]: [
384-
'fruits/node_modules/fbjs/lib/flatMap.js',
385-
H.MODULE,
386-
],
387-
},
388358
}),
389359
);
390360

packages/jest-haste-map/src/index.ts

Lines changed: 2 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ type Options = {
6464
mocksPattern?: string;
6565
name: string;
6666
platforms: Array<string>;
67-
providesModuleNodeModules?: Array<string>;
6867
resetCache?: boolean;
6968
retainAllFiles: boolean;
7069
rootDir: string;
@@ -131,28 +130,6 @@ const canUseWatchman = ((): boolean => {
131130
return false;
132131
})();
133132

134-
const escapePathSeparator = (string: string) =>
135-
path.sep === '\\' ? string.replace(/(\/|\\)/g, '\\\\') : string;
136-
137-
const getWhiteList = (list: Array<string> | undefined): RegExp | null => {
138-
if (list && list.length) {
139-
const newList = list.map(item =>
140-
escapePathSeparator(item.replace(/(\/)/g, path.sep)),
141-
);
142-
return new RegExp(
143-
'(' +
144-
escapePathSeparator(NODE_MODULES) +
145-
'(?:' +
146-
newList.join('|') +
147-
')(?=$|' +
148-
escapePathSeparator(path.sep) +
149-
'))',
150-
'g',
151-
);
152-
}
153-
return null;
154-
};
155-
156133
/**
157134
* HasteMap is a JavaScript implementation of Facebook's haste module system.
158135
*
@@ -239,7 +216,6 @@ class HasteMap extends EventEmitter {
239216
private _console: Console;
240217
private _options: InternalOptions;
241218
private _watchers: Array<Watcher>;
242-
private _whitelist: RegExp | null;
243219
private _worker: WorkerInterface | null;
244220

245221
constructor(options: Options) {
@@ -317,7 +293,6 @@ class HasteMap extends EventEmitter {
317293
hasteImplHash,
318294
dependencyExtractorHash,
319295
);
320-
this._whitelist = getWhiteList(options.providesModuleNodeModules);
321296
this._buildPromise = null;
322297
this._watchers = [];
323298
this._worker = null;
@@ -552,7 +527,7 @@ class HasteMap extends EventEmitter {
552527

553528
// If we retain all files in the virtual HasteFS representation, we avoid
554529
// reading them if they aren't important (node_modules).
555-
if (this._options.retainAllFiles && this._isNodeModulesDir(filePath)) {
530+
if (this._options.retainAllFiles && filePath.includes(NODE_MODULES)) {
556531
if (computeSha1) {
557532
return this._getWorker(workerOptions)
558533
.getSha1({
@@ -1076,32 +1051,10 @@ class HasteMap extends EventEmitter {
10761051

10771052
return (
10781053
ignoreMatched ||
1079-
(!this._options.retainAllFiles && this._isNodeModulesDir(filePath))
1054+
(!this._options.retainAllFiles && filePath.includes(NODE_MODULES))
10801055
);
10811056
}
10821057

1083-
private _isNodeModulesDir(filePath: Config.Path): boolean {
1084-
if (!filePath.includes(NODE_MODULES)) {
1085-
return false;
1086-
}
1087-
1088-
if (this._whitelist) {
1089-
const whitelist = this._whitelist;
1090-
const match = whitelist.exec(filePath);
1091-
const matchEndIndex = whitelist.lastIndex;
1092-
whitelist.lastIndex = 0;
1093-
1094-
if (!match) {
1095-
return true;
1096-
}
1097-
1098-
const filePathInPackage = filePath.substr(matchEndIndex);
1099-
return filePathInPackage.startsWith(NODE_MODULES);
1100-
}
1101-
1102-
return true;
1103-
}
1104-
11051058
private _createEmptyMap(): InternalHasteMap {
11061059
return {
11071060
clocks: new Map(),

packages/jest-runtime/src/__tests__/runtime_require_module.test.js

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -248,22 +248,6 @@ describe('Runtime requireModule', () => {
248248
expect(hastePackage.isHastePackage).toBe(true);
249249
}));
250250

251-
it('resolves node modules properly when crawling node_modules', () =>
252-
// While we are crawling a node module, we shouldn't put package.json
253-
// files of node modules to resolve to `package.json` but rather resolve
254-
// to whatever the package.json's `main` field says.
255-
createRuntime(__filename, {
256-
haste: {
257-
providesModuleNodeModules: ['not-a-haste-package'],
258-
},
259-
}).then(runtime => {
260-
const hastePackage = runtime.requireModule(
261-
runtime.__mockRootPath,
262-
'not-a-haste-package',
263-
);
264-
expect(hastePackage.isNodeModule).toBe(true);
265-
}));
266-
267251
it('resolves platform extensions based on the default platform', () =>
268252
Promise.all([
269253
createRuntime(__filename).then(runtime => {

packages/jest-runtime/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ class Runtime {
244244
mocksPattern: escapePathForRegex(path.sep + '__mocks__' + path.sep),
245245
name: config.name,
246246
platforms: config.haste.platforms || ['ios', 'android'],
247-
providesModuleNodeModules: config.haste.providesModuleNodeModules,
248247
resetCache: options && options.resetCache,
249248
retainAllFiles: false,
250249
rootDir: config.rootDir,

packages/jest-transform/src/__tests__/__snapshots__/script_transformer.test.js.snap

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ Object {
2020
"globalSetup": null,
2121
"globalTeardown": null,
2222
"globals": Object {},
23-
"haste": Object {
24-
"providesModuleNodeModules": Array [],
25-
},
23+
"haste": Object {},
2624
"moduleDirectories": Array [],
2725
"moduleFileExtensions": Array [
2826
"js",
@@ -224,7 +222,7 @@ exports[`ScriptTransformer uses multiple preprocessors 1`] = `
224222
const TRANSFORMED = {
225223
filename: '/fruits/banana.js',
226224
script: 'module.exports = \\"banana\\";',
227-
config: '{\\"automock\\":false,\\"browser\\":false,\\"cache\\":true,\\"cacheDirectory\\":\\"/cache/\\",\\"clearMocks\\":false,\\"coveragePathIgnorePatterns\\":[],\\"cwd\\":\\"/test_root_dir/\\",\\"detectLeaks\\":false,\\"detectOpenHandles\\":false,\\"errorOnDeprecated\\":false,\\"extraGlobals\\":[],\\"filter\\":null,\\"forceCoverageMatch\\":[],\\"globalSetup\\":null,\\"globalTeardown\\":null,\\"globals\\":{},\\"haste\\":{\\"providesModuleNodeModules\\":[]},\\"moduleDirectories\\":[],\\"moduleFileExtensions\\":[\\"js\\"],\\"moduleLoader\\":\\"/test_module_loader_path\\",\\"moduleNameMapper\\":[],\\"modulePathIgnorePatterns\\":[],\\"modulePaths\\":[],\\"name\\":\\"test\\",\\"prettierPath\\":\\"prettier\\",\\"resetMocks\\":false,\\"resetModules\\":false,\\"resolver\\":null,\\"restoreMocks\\":false,\\"rootDir\\":\\"/\\",\\"roots\\":[],\\"runner\\":\\"jest-runner\\",\\"setupFiles\\":[],\\"setupFilesAfterEnv\\":[],\\"skipFilter\\":false,\\"skipNodeResolution\\":false,\\"snapshotResolver\\":null,\\"snapshotSerializers\\":[],\\"testEnvironment\\":\\"node\\",\\"testEnvironmentOptions\\":{},\\"testLocationInResults\\":false,\\"testMatch\\":[],\\"testPathIgnorePatterns\\":[],\\"testRegex\\":[\\"\\\\\\\\.test\\\\\\\\.js$\\"],\\"testRunner\\":\\"jest-jasmine2\\",\\"testURL\\":\\"\\",\\"timers\\":\\"real\\",\\"transform\\":[[\\"^.+\\\\\\\\.js$\\",\\"test_preprocessor\\"],[\\"^.+\\\\\\\\.css$\\",\\"css-preprocessor\\"]],\\"transformIgnorePatterns\\":[\\"/node_modules/\\"],\\"unmockedModulePathPatterns\\":null,\\"watchPathIgnorePatterns\\":[]}',
225+
config: '{\\"automock\\":false,\\"browser\\":false,\\"cache\\":true,\\"cacheDirectory\\":\\"/cache/\\",\\"clearMocks\\":false,\\"coveragePathIgnorePatterns\\":[],\\"cwd\\":\\"/test_root_dir/\\",\\"detectLeaks\\":false,\\"detectOpenHandles\\":false,\\"errorOnDeprecated\\":false,\\"extraGlobals\\":[],\\"filter\\":null,\\"forceCoverageMatch\\":[],\\"globalSetup\\":null,\\"globalTeardown\\":null,\\"globals\\":{},\\"haste\\":{},\\"moduleDirectories\\":[],\\"moduleFileExtensions\\":[\\"js\\"],\\"moduleLoader\\":\\"/test_module_loader_path\\",\\"moduleNameMapper\\":[],\\"modulePathIgnorePatterns\\":[],\\"modulePaths\\":[],\\"name\\":\\"test\\",\\"prettierPath\\":\\"prettier\\",\\"resetMocks\\":false,\\"resetModules\\":false,\\"resolver\\":null,\\"restoreMocks\\":false,\\"rootDir\\":\\"/\\",\\"roots\\":[],\\"runner\\":\\"jest-runner\\",\\"setupFiles\\":[],\\"setupFilesAfterEnv\\":[],\\"skipFilter\\":false,\\"skipNodeResolution\\":false,\\"snapshotResolver\\":null,\\"snapshotSerializers\\":[],\\"testEnvironment\\":\\"node\\",\\"testEnvironmentOptions\\":{},\\"testLocationInResults\\":false,\\"testMatch\\":[],\\"testPathIgnorePatterns\\":[],\\"testRegex\\":[\\"\\\\\\\\.test\\\\\\\\.js$\\"],\\"testRunner\\":\\"jest-jasmine2\\",\\"testURL\\":\\"\\",\\"timers\\":\\"real\\",\\"transform\\":[[\\"^.+\\\\\\\\.js$\\",\\"test_preprocessor\\"],[\\"^.+\\\\\\\\.css$\\",\\"css-preprocessor\\"]],\\"transformIgnorePatterns\\":[\\"/node_modules/\\"],\\"unmockedModulePathPatterns\\":null,\\"watchPathIgnorePatterns\\":[]}',
228226
};
229227
230228
}});"
@@ -250,7 +248,7 @@ exports[`ScriptTransformer uses the supplied preprocessor 1`] = `
250248
const TRANSFORMED = {
251249
filename: '/fruits/banana.js',
252250
script: 'module.exports = \\"banana\\";',
253-
config: '{\\"automock\\":false,\\"browser\\":false,\\"cache\\":true,\\"cacheDirectory\\":\\"/cache/\\",\\"clearMocks\\":false,\\"coveragePathIgnorePatterns\\":[],\\"cwd\\":\\"/test_root_dir/\\",\\"detectLeaks\\":false,\\"detectOpenHandles\\":false,\\"errorOnDeprecated\\":false,\\"extraGlobals\\":[],\\"filter\\":null,\\"forceCoverageMatch\\":[],\\"globalSetup\\":null,\\"globalTeardown\\":null,\\"globals\\":{},\\"haste\\":{\\"providesModuleNodeModules\\":[]},\\"moduleDirectories\\":[],\\"moduleFileExtensions\\":[\\"js\\"],\\"moduleLoader\\":\\"/test_module_loader_path\\",\\"moduleNameMapper\\":[],\\"modulePathIgnorePatterns\\":[],\\"modulePaths\\":[],\\"name\\":\\"test\\",\\"prettierPath\\":\\"prettier\\",\\"resetMocks\\":false,\\"resetModules\\":false,\\"resolver\\":null,\\"restoreMocks\\":false,\\"rootDir\\":\\"/\\",\\"roots\\":[],\\"runner\\":\\"jest-runner\\",\\"setupFiles\\":[],\\"setupFilesAfterEnv\\":[],\\"skipFilter\\":false,\\"skipNodeResolution\\":false,\\"snapshotResolver\\":null,\\"snapshotSerializers\\":[],\\"testEnvironment\\":\\"node\\",\\"testEnvironmentOptions\\":{},\\"testLocationInResults\\":false,\\"testMatch\\":[],\\"testPathIgnorePatterns\\":[],\\"testRegex\\":[\\"\\\\\\\\.test\\\\\\\\.js$\\"],\\"testRunner\\":\\"jest-jasmine2\\",\\"testURL\\":\\"\\",\\"timers\\":\\"real\\",\\"transform\\":[[\\"^.+\\\\\\\\.js$\\",\\"test_preprocessor\\"]],\\"transformIgnorePatterns\\":[\\"/node_modules/\\"],\\"unmockedModulePathPatterns\\":null,\\"watchPathIgnorePatterns\\":[]}',
251+
config: '{\\"automock\\":false,\\"browser\\":false,\\"cache\\":true,\\"cacheDirectory\\":\\"/cache/\\",\\"clearMocks\\":false,\\"coveragePathIgnorePatterns\\":[],\\"cwd\\":\\"/test_root_dir/\\",\\"detectLeaks\\":false,\\"detectOpenHandles\\":false,\\"errorOnDeprecated\\":false,\\"extraGlobals\\":[],\\"filter\\":null,\\"forceCoverageMatch\\":[],\\"globalSetup\\":null,\\"globalTeardown\\":null,\\"globals\\":{},\\"haste\\":{},\\"moduleDirectories\\":[],\\"moduleFileExtensions\\":[\\"js\\"],\\"moduleLoader\\":\\"/test_module_loader_path\\",\\"moduleNameMapper\\":[],\\"modulePathIgnorePatterns\\":[],\\"modulePaths\\":[],\\"name\\":\\"test\\",\\"prettierPath\\":\\"prettier\\",\\"resetMocks\\":false,\\"resetModules\\":false,\\"resolver\\":null,\\"restoreMocks\\":false,\\"rootDir\\":\\"/\\",\\"roots\\":[],\\"runner\\":\\"jest-runner\\",\\"setupFiles\\":[],\\"setupFilesAfterEnv\\":[],\\"skipFilter\\":false,\\"skipNodeResolution\\":false,\\"snapshotResolver\\":null,\\"snapshotSerializers\\":[],\\"testEnvironment\\":\\"node\\",\\"testEnvironmentOptions\\":{},\\"testLocationInResults\\":false,\\"testMatch\\":[],\\"testPathIgnorePatterns\\":[],\\"testRegex\\":[\\"\\\\\\\\.test\\\\\\\\.js$\\"],\\"testRunner\\":\\"jest-jasmine2\\",\\"testURL\\":\\"\\",\\"timers\\":\\"real\\",\\"transform\\":[[\\"^.+\\\\\\\\.js$\\",\\"test_preprocessor\\"]],\\"transformIgnorePatterns\\":[\\"/node_modules/\\"],\\"unmockedModulePathPatterns\\":null,\\"watchPathIgnorePatterns\\":[]}',
254252
};
255253
256254
}});"

packages/jest-types/src/Config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export type HasteConfig = {
1717
defaultPlatform?: string | null | undefined;
1818
hasteImplModulePath?: string;
1919
platforms?: Array<string>;
20-
providesModuleNodeModules: Array<string>;
2120
throwOnModuleCollision?: boolean;
2221
};
2322

packages/jest-validate/src/__tests__/__snapshots__/validate.test.js.snap

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,7 @@ exports[`pretty prints valid config for Object 1`] = `
109109
<red></>
110110
<red> Example:</>
111111
<red> {</>
112-
<red> <bold>\\"haste\\"</>: <bold>{</></>
113-
<red><bold> \\"providesModuleNodeModules\\": [</></>
114-
<red><bold> \\"react\\",</></>
115-
<red><bold> \\"react-native\\"</></>
116-
<red><bold> ]</></>
117-
<red><bold> }</></>
112+
<red> <bold>\\"haste\\"</>: <bold>{}</></>
118113
<red> }</>
119114
<red></>"
120115
`;

packages/jest-validate/src/__tests__/fixtures/jestConfig.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ const defaultConfig = {
3030
coverageReporters: ['json', 'text', 'lcov', 'clover'],
3131
expand: false,
3232
globals: {},
33-
haste: {
34-
providesModuleNodeModules: [],
35-
},
33+
haste: {},
3634
moduleDirectories: ['node_modules'],
3735
moduleFileExtensions: ['js', 'json', 'jsx', 'node'],
3836
moduleNameMapper: {},
@@ -83,9 +81,7 @@ const validConfig = {
8381
expand: false,
8482
forceExit: false,
8583
globals: {},
86-
haste: {
87-
providesModuleNodeModules: ['react', 'react-native'],
88-
},
84+
haste: {},
8985
logHeapUsage: true,
9086
moduleDirectories: ['node_modules'],
9187
moduleFileExtensions: ['js', 'json', 'jsx', 'node'],

packages/jest-validate/src/__tests__/validate.test.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -75,20 +75,6 @@ test('omits null and undefined config values', () => {
7575
});
7676
});
7777

78-
test('recursively omits null and undefined config values', () => {
79-
const config = {
80-
haste: {
81-
providesModuleNodeModules: null,
82-
},
83-
};
84-
expect(
85-
validate(config, {exampleConfig: validConfig, recursive: true}),
86-
).toEqual({
87-
hasDeprecationWarnings: false,
88-
isValid: true,
89-
});
90-
});
91-
9278
test.each([
9379
[function() {}, function() {}],
9480
[async function() {}, function() {}],

website/versioned_docs/version-22.x/TutorialReactNative.md

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -201,22 +201,3 @@ jest.mock('Text', () => {
201201
In other cases you may want to mock a native module that isn't a React component. The same technique can be applied. We recommend inspecting the native module's source code and logging the module when running a react native app on a real device and then modeling a manual mock after the real module.
202202

203203
If you end up mocking the same modules over and over it is recommended to define these mocks in a separate file and add it to the list of `setupFiles`.
204-
205-
### `@providesModule`
206-
207-
If you'd like to use Facebook's `@providesModule` module system through an npm package, the default haste config option must be overwritten and npm modules must be added to `providesModuleNodeModules`:
208-
209-
```json
210-
"haste": {
211-
"defaultPlatform": "ios",
212-
"platforms": ["android", "ios"],
213-
"providesModuleNodeModules": [
214-
"react",
215-
"react-native",
216-
"my-awesome-module",
217-
"my-text-component"
218-
]
219-
},
220-
```
221-
222-
If you'd like to test a different default platform or if you are building for other platforms, the `defaultPlatform` and `platforms` configuration option can be updated.

0 commit comments

Comments
 (0)