Skip to content

Commit 954713a

Browse files
committed
Removed default support for @providesModule
1 parent 4c75933 commit 954713a

File tree

6 files changed

+347
-407
lines changed

6 files changed

+347
-407
lines changed

packages/jest-haste-map/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"dependencies": {
1111
"fb-watchman": "^2.0.0",
1212
"graceful-fs": "^4.1.11",
13-
"jest-docblock": "^22.4.0",
1413
"jest-serializer": "^22.4.0",
1514
"jest-worker": "^22.2.2",
1615
"micromatch": "^2.3.11",
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,119 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3+
exports[`HasteMap builds a haste map on a fresh cache with SHA-1s uses watchman: false 1`] = `
4+
Object {
5+
"/fruits/Banana.js": Array [
6+
"Banana",
7+
32,
8+
1,
9+
Array [
10+
"Strawberry",
11+
],
12+
"5ed33593647e9ed632d8133a91b2dbef416a5d77",
13+
],
14+
"/fruits/Pear.js": Array [
15+
"Pear",
16+
32,
17+
1,
18+
Array [
19+
"Banana",
20+
"Strawberry",
21+
],
22+
"210aa3531d1646b6469d88d80168417f8dd08c7f",
23+
],
24+
"/fruits/Strawberry.js": Array [
25+
"Strawberry",
26+
32,
27+
1,
28+
Array [],
29+
"65a371cc1a610b7cad68798d6d4ff5a941f837b8",
30+
],
31+
"/fruits/__mocks__/Pear.js": Array [
32+
"",
33+
32,
34+
1,
35+
Array [
36+
"Melon",
37+
],
38+
"e0753bafe7b1f7a460fe8af9925f15e79960bb20",
39+
],
40+
"/vegetables/Melon.js": Array [
41+
"Melon",
42+
32,
43+
1,
44+
Array [],
45+
"ff9c3f399d8f8bc7e67f99d065efff6570ce9347",
46+
],
47+
}
48+
`;
49+
50+
exports[`HasteMap builds a haste map on a fresh cache with SHA-1s uses watchman: true 1`] = `
51+
Object {
52+
"/fruits/Banana.js": Array [
53+
"Banana",
54+
32,
55+
1,
56+
Array [
57+
"Strawberry",
58+
],
59+
"5ed33593647e9ed632d8133a91b2dbef416a5d77",
60+
],
61+
"/fruits/Pear.js": Array [
62+
"Pear",
63+
32,
64+
1,
65+
Array [
66+
"Banana",
67+
"Strawberry",
68+
],
69+
"210aa3531d1646b6469d88d80168417f8dd08c7f",
70+
],
71+
"/fruits/Strawberry.js": Array [
72+
"Strawberry",
73+
32,
74+
1,
75+
Array [],
76+
"65a371cc1a610b7cad68798d6d4ff5a941f837b8",
77+
],
78+
"/fruits/__mocks__/Pear.js": Array [
79+
"",
80+
32,
81+
1,
82+
Array [
83+
"Melon",
84+
],
85+
"e0753bafe7b1f7a460fe8af9925f15e79960bb20",
86+
],
87+
"/vegetables/Melon.js": Array [
88+
"Melon",
89+
32,
90+
1,
91+
Array [],
92+
"ff9c3f399d8f8bc7e67f99d065efff6570ce9347",
93+
],
94+
}
95+
`;
96+
397
exports[`HasteMap file system changes processing recovery from duplicate module IDs recovers when the most recent duplicate is fixed 1`] = `
498
"The name \`Pear\` was looked up in the Haste module map. It cannot be resolved, because there exists several different files, or packages, that provide a module for that particular name and platform. The platform is generic (no extension). You must delete or blacklist files until there remains only one of these:
599
6-
* \`/fruits/blueberry.js\` (module)
7-
* \`/fruits/pear.js\` (module)
100+
* \`/fruits/Pear.js\` (module)
101+
* \`/fruits/another/Pear.js\` (module)
8102
"
9103
`;
10104

11105
exports[`HasteMap file system changes processing recovery from duplicate module IDs recovers when the oldest version of the duplicates is fixed 1`] = `
12106
"The name \`Pear\` was looked up in the Haste module map. It cannot be resolved, because there exists several different files, or packages, that provide a module for that particular name and platform. The platform is generic (no extension). You must delete or blacklist files until there remains only one of these:
13107
14-
* \`/fruits/blueberry.js\` (module)
15-
* \`/fruits/pear.js\` (module)
108+
* \`/fruits/Pear.js\` (module)
109+
* \`/fruits/another/Pear.js\` (module)
16110
"
17111
`;
18112

19113
exports[`HasteMap throws on duplicate module ids if "throwOnModuleCollision" is set to true 1`] = `
20114
[Error: jest-haste-map: @providesModule naming collision:
21115
Duplicate module name: Strawberry
22-
Paths: /fruits/raspberry.js collides with /fruits/strawberry.js
116+
Paths: /fruits/another/Strawberry.js collides with /fruits/Strawberry.js
23117
24118
This error is caused by a @providesModule declaration with the same name across two different files.]
25119
`;
@@ -32,22 +126,22 @@ exports[`HasteMap tries to crawl using node as a fallback 1`] = `
32126

33127
exports[`HasteMap warns on duplicate mock files 1`] = `
34128
"jest-haste-map: duplicate manual mock found:
35-
Module name: subdir/blueberry
36-
Duplicate Mock path: /fruits2/__mocks__/subdir/blueberry.js
129+
Module name: blueberry
130+
Duplicate Mock path: /fruits/dir2/__mocks__/blueberry.js
37131
This warning is caused by two manual mock files with the same file name.
38132
Jest will use the mock file found in:
39-
/fruits2/__mocks__/subdir/blueberry.js
133+
/fruits/dir2/__mocks__/blueberry.js
40134
Please delete one of the following two files:
41-
/fruits1/__mocks__/subdir/blueberry.js
42-
/fruits2/__mocks__/subdir/blueberry.js
135+
/fruits/dir1/__mocks__/blueberry.js
136+
/fruits/dir2/__mocks__/blueberry.js
43137
44138
"
45139
`;
46140

47141
exports[`HasteMap warns on duplicate module ids 1`] = `
48142
"jest-haste-map: @providesModule naming collision:
49143
Duplicate module name: Strawberry
50-
Paths: /fruits/raspberry.js collides with /fruits/strawberry.js
144+
Paths: /fruits/another/Strawberry.js collides with /fruits/Strawberry.js
51145
52146
This warning is caused by a @providesModule declaration with the same name across two different files."
53147
`;

packages/jest-haste-map/src/__tests__/haste_impl.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88

99
module.exports = {
1010
getHasteName(path) {
11-
return path.substr(path.lastIndexOf('/') + 1).replace(/\.js$/, '');
11+
if (path.includes('__mocks__') || path.includes('NoHaste')) {
12+
return undefined;
13+
}
14+
15+
return path
16+
.substr(path.lastIndexOf('/') + 1)
17+
.replace(/(\.(android|ios))?\.js$/, '');
1218
},
1319
};

0 commit comments

Comments
 (0)