Skip to content

Commit 00f75d3

Browse files
test: update
1 parent a69cd9b commit 00f75d3

19 files changed

+751
-148
lines changed

Diff for: jest.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ module.exports = {
33
transformIgnorePatterns: ['/node_modules/', '<rootDir>/dist/'],
44
watchPathIgnorePatterns: ['<rootDir>/test/js'],
55
setupFilesAfterEnv: ['<rootDir>/setupTest.js'],
6+
snapshotResolver: './test/helpers/snapshotResolver.js',
67
};
File renamed without changes.

Diff for: test/__snapshots__/HMR.test.js.snap.webpack5

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`HMR should handle error event 1`] = `"[HMR] css reload %s"`;
4+
5+
exports[`HMR should handle error event 2`] = `"<link rel=\\"stylesheet\\" href=\\"/dist/main.css\\"><link rel=\\"stylesheet\\" href=\\"http://localhost/dist/main.css?1479427200000\\">"`;
6+
7+
exports[`HMR should reloads with # link href 1`] = `"[HMR] css reload %s"`;
8+
9+
exports[`HMR should reloads with # link href 2`] = `"<link rel=\\"stylesheet\\" href=\\"/dist/main.css\\"><link rel=\\"stylesheet\\" href=\\"http://localhost/dist/main.css?1479427200000\\"><link rel=\\"shortcut icon\\" href=\\"#href\\">"`;
10+
11+
exports[`HMR should reloads with absolute remove url 1`] = `"[HMR] css reload %s"`;
12+
13+
exports[`HMR should reloads with absolute remove url 2`] = `"<link rel=\\"stylesheet\\" href=\\"/dist/main.css\\"><link rel=\\"stylesheet\\" href=\\"http://localhost/dist/main.css?1479427200000\\"><link rel=\\"stylesheet\\" href=\\"http://dev.com/dist/main.css\\">"`;
14+
15+
exports[`HMR should reloads with link without href 1`] = `"[HMR] css reload %s"`;
16+
17+
exports[`HMR should reloads with link without href 2`] = `"<link rel=\\"stylesheet\\" href=\\"/dist/main.css\\"><link rel=\\"stylesheet\\" href=\\"http://localhost/dist/main.css?1479427200000\\"><link rel=\\"shortcut icon\\">"`;
18+
19+
exports[`HMR should reloads with locals 1`] = `"[HMR] Detected local css modules. Reload all css"`;
20+
21+
exports[`HMR should reloads with locals 2`] = `"<link rel=\\"stylesheet\\" href=\\"/dist/main.css\\"><link rel=\\"stylesheet\\" href=\\"http://localhost/dist/main.css?1479427200000\\">"`;
22+
23+
exports[`HMR should reloads with non http/https link href 1`] = `"[HMR] css reload %s"`;
24+
25+
exports[`HMR should reloads with non http/https link href 2`] = `"<link rel=\\"stylesheet\\" href=\\"/dist/main.css\\"><link rel=\\"stylesheet\\" href=\\"http://localhost/dist/main.css?1479427200000\\"><link rel=\\"shortcut icon\\" href=\\"data:;base64,=\\">"`;
26+
27+
exports[`HMR should reloads with non-file script in the end of page 1`] = `"[HMR] Reload all css"`;
28+
29+
exports[`HMR should reloads with non-file script in the end of page 2`] = `"<link rel=\\"stylesheet\\" href=\\"/dist/main.css\\"><link rel=\\"stylesheet\\" href=\\"http://localhost/dist/main.css?1479427200000\\">"`;
30+
31+
exports[`HMR should work reload all css 1`] = `"[HMR] Reload all css"`;
32+
33+
exports[`HMR should work reload all css 2`] = `"<link rel=\\"stylesheet\\" href=\\"/dist/main.css\\"><link rel=\\"stylesheet\\" href=\\"http://localhost/dist/main.css?1479427200000\\">"`;
34+
35+
exports[`HMR should works 1`] = `"[HMR] css reload %s"`;
36+
37+
exports[`HMR should works 2`] = `"<link rel=\\"stylesheet\\" href=\\"/dist/main.css\\"><link rel=\\"stylesheet\\" href=\\"http://localhost/dist/main.css?1479427200000\\">"`;
38+
39+
exports[`HMR should works with multiple updates 1`] = `"[HMR] css reload %s"`;
40+
41+
exports[`HMR should works with multiple updates 2`] = `"<link rel=\\"stylesheet\\" href=\\"/dist/main.css\\"><link rel=\\"stylesheet\\" href=\\"http://localhost/dist/main.css?1479427200000\\">"`;
42+
43+
exports[`HMR should works with multiple updates 3`] = `"<link rel=\\"stylesheet\\" href=\\"http://localhost/dist/main.css?1479427200000\\"><link rel=\\"stylesheet\\" href=\\"http://localhost/dist/main.css?1479427200001\\">"`;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`attributes option should work with attributes option: DOM 1`] = `
4+
"<!DOCTYPE html><html><head>
5+
<title>style-loader test</title>
6+
<style id=\\"existing-style\\">.existing { color: yellow }</style>
7+
<link id=\\"target\\" data-target=\\"example\\" rel=\\"stylesheet\\" type=\\"text/css\\" href=\\"simple.css\\"><script charset=\\"utf-8\\" src=\\"simple.bundle.js\\"></script></head>
8+
<body>
9+
<h1>Body</h1>
10+
<div class=\\"target\\"></div>
11+
<iframe class=\\"iframeTarget\\"></iframe>
12+
13+
14+
</body></html>"
15+
`;
16+
17+
exports[`attributes option should work with attributes option: errors 1`] = `Array []`;
18+
19+
exports[`attributes option should work with attributes option: warnings 1`] = `Array []`;
20+
21+
exports[`attributes option should work without attributes option: DOM 1`] = `
22+
"<!DOCTYPE html><html><head>
23+
<title>style-loader test</title>
24+
<style id=\\"existing-style\\">.existing { color: yellow }</style>
25+
<link rel=\\"stylesheet\\" type=\\"text/css\\" href=\\"simple.css\\"><script charset=\\"utf-8\\" src=\\"simple.bundle.js\\"></script></head>
26+
<body>
27+
<h1>Body</h1>
28+
<div class=\\"target\\"></div>
29+
<iframe class=\\"iframeTarget\\"></iframe>
30+
31+
32+
</body></html>"
33+
`;
34+
35+
exports[`attributes option should work without attributes option: errors 1`] = `Array []`;
36+
37+
exports[`attributes option should work without attributes option: warnings 1`] = `Array []`;

Diff for: test/__snapshots__/emit-option.test.js.snap

-37
This file was deleted.

Diff for: test/__snapshots__/emit-option.test.js.snap.webpack4

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`emit option should work when emit option is "false": assets 1`] = `
4+
Array [
5+
"main.js",
6+
"react.svg",
7+
]
8+
`;
9+
10+
exports[`emit option should work when emit option is "false": errors 1`] = `Array []`;
11+
12+
exports[`emit option should work when emit option is "false": warnings 1`] = `Array []`;
13+
14+
exports[`emit option should work when emit option is "true": assets 1`] = `
15+
Array [
16+
"main.css",
17+
"main.js",
18+
"react.svg",
19+
]
20+
`;
21+
22+
exports[`emit option should work when emit option is "true": errors 1`] = `Array []`;
23+
24+
exports[`emit option should work when emit option is "true": warnings 1`] = `Array []`;
25+
26+
exports[`emit option should work with locals when emit option is "false": DOM 1`] = `
27+
"<!DOCTYPE html><html><head>
28+
<title>style-loader test</title>
29+
<style id=\\"existing-style\\">.existing { color: yellow }</style>
30+
</head>
31+
<body>
32+
css.foo: _1F17fUrdX_cbcyDHpFqmAD
33+
css.bar: _3TZVxmkrZR2cTfifKhDoZn
34+
css.baz: M-pzkE59YBii7EXzFyxE6
35+
</body></html>"
36+
`;
37+
38+
exports[`emit option should work with locals when emit option is "false": errors 1`] = `Array []`;
39+
40+
exports[`emit option should work with locals when emit option is "false": warnings 1`] = `Array []`;
41+
42+
exports[`emit option should work without emit option: assets 1`] = `
43+
Array [
44+
"main.bundle.js",
45+
"main.css",
46+
"react.svg",
47+
]
48+
`;
49+
50+
exports[`emit option should work without emit option: errors 1`] = `Array []`;
51+
52+
exports[`emit option should work without emit option: warnings 1`] = `Array []`;

Diff for: test/__snapshots__/emit-option.test.js.snap.webpack5

+169
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`emit option should invalidate the cache with disabled "emit" option: assets 1`] = `
4+
Array [
5+
"main.js",
6+
"static/react.svg",
7+
]
8+
`;
9+
10+
exports[`emit option should invalidate the cache with disabled "emit" option: assets 2`] = `
11+
Array [
12+
"main.js",
13+
]
14+
`;
15+
16+
exports[`emit option should invalidate the cache with disabled "emit" option: emittedAssets 1`] = `
17+
Array [
18+
"main.js",
19+
"static/react.svg",
20+
]
21+
`;
22+
23+
exports[`emit option should invalidate the cache with disabled "emit" option: emittedAssets 2`] = `Array []`;
24+
25+
exports[`emit option should invalidate the cache with disabled "emit" option: errors 1`] = `Array []`;
26+
27+
exports[`emit option should invalidate the cache with disabled "emit" option: errors 2`] = `Array []`;
28+
29+
exports[`emit option should invalidate the cache with disabled "emit" option: warnings 1`] = `Array []`;
30+
31+
exports[`emit option should invalidate the cache with disabled "emit" option: warnings 2`] = `Array []`;
32+
33+
exports[`emit option should work when emit option is "false": assets 1`] = `
34+
Array [
35+
"main.js",
36+
"react.svg",
37+
]
38+
`;
39+
40+
exports[`emit option should work when emit option is "false": errors 1`] = `Array []`;
41+
42+
exports[`emit option should work when emit option is "false": warnings 1`] = `Array []`;
43+
44+
exports[`emit option should work when emit option is "true": assets 1`] = `
45+
Array [
46+
"main.css",
47+
"main.js",
48+
"react.svg",
49+
]
50+
`;
51+
52+
exports[`emit option should work when emit option is "true": errors 1`] = `Array []`;
53+
54+
exports[`emit option should work when emit option is "true": warnings 1`] = `Array []`;
55+
56+
exports[`emit option should work with locals and invalidate cache when emit option is "false": DOM 1`] = `
57+
"<!DOCTYPE html><html><head>
58+
<title>style-loader test</title>
59+
<style id=\\"existing-style\\">.existing { color: yellow }</style>
60+
</head>
61+
<body>
62+
css.foo: _1F17fUrdX_cbcyDHpFqmAD
63+
css.bar: _3TZVxmkrZR2cTfifKhDoZn
64+
css.baz: M-pzkE59YBii7EXzFyxE6
65+
</body></html>"
66+
`;
67+
68+
exports[`emit option should work with locals and invalidate cache when emit option is "false": DOM 2`] = `
69+
"<!DOCTYPE html><html><head>
70+
<title>style-loader test</title>
71+
<style id=\\"existing-style\\">.existing { color: yellow }</style>
72+
</head>
73+
<body>
74+
css.foo-bar: VWLDg_rByGM4Rdhz5T3Ns
75+
css.bar: _3TZVxmkrZR2cTfifKhDoZn
76+
css.baz: M-pzkE59YBii7EXzFyxE6
77+
</body></html>"
78+
`;
79+
80+
exports[`emit option should work with locals and invalidate cache when emit option is "false": assets 1`] = `
81+
Array [
82+
"main.js",
83+
]
84+
`;
85+
86+
exports[`emit option should work with locals and invalidate cache when emit option is "false": assets 2`] = `
87+
Array [
88+
"main.js",
89+
]
90+
`;
91+
92+
exports[`emit option should work with locals and invalidate cache when emit option is "false": emittedAssets 1`] = `
93+
Array [
94+
"main.js",
95+
]
96+
`;
97+
98+
exports[`emit option should work with locals and invalidate cache when emit option is "false": emittedAssets 2`] = `
99+
Array [
100+
"main.js",
101+
]
102+
`;
103+
104+
exports[`emit option should work with locals and invalidate cache when emit option is "false": errors 1`] = `Array []`;
105+
106+
exports[`emit option should work with locals and invalidate cache when emit option is "false": errors 2`] = `Array []`;
107+
108+
exports[`emit option should work with locals and invalidate cache when emit option is "false": warnings 1`] = `Array []`;
109+
110+
exports[`emit option should work with locals and invalidate cache when emit option is "false": warnings 2`] = `Array []`;
111+
112+
exports[`emit option should work with locals when emit option is "false": DOM 1`] = `
113+
"<!DOCTYPE html><html><head>
114+
<title>style-loader test</title>
115+
<style id=\\"existing-style\\">.existing { color: yellow }</style>
116+
</head>
117+
<body>
118+
css.foo: _1F17fUrdX_cbcyDHpFqmAD
119+
css.bar: _3TZVxmkrZR2cTfifKhDoZn
120+
css.baz: M-pzkE59YBii7EXzFyxE6
121+
</body></html>"
122+
`;
123+
124+
exports[`emit option should work with locals when emit option is "false": errors 1`] = `Array []`;
125+
126+
exports[`emit option should work with locals when emit option is "false": warnings 1`] = `Array []`;
127+
128+
exports[`emit option should work with the "memory" cache and disabled "emit" option: assets 1`] = `
129+
Array [
130+
"main.js",
131+
"static/react.svg",
132+
]
133+
`;
134+
135+
exports[`emit option should work with the "memory" cache and disabled "emit" option: assets 2`] = `
136+
Array [
137+
"main.js",
138+
"static/react.svg",
139+
]
140+
`;
141+
142+
exports[`emit option should work with the "memory" cache and disabled "emit" option: emittedAssets 1`] = `
143+
Array [
144+
"main.js",
145+
"static/react.svg",
146+
]
147+
`;
148+
149+
exports[`emit option should work with the "memory" cache and disabled "emit" option: emittedAssets 2`] = `Array []`;
150+
151+
exports[`emit option should work with the "memory" cache and disabled "emit" option: errors 1`] = `Array []`;
152+
153+
exports[`emit option should work with the "memory" cache and disabled "emit" option: errors 2`] = `Array []`;
154+
155+
exports[`emit option should work with the "memory" cache and disabled "emit" option: warnings 1`] = `Array []`;
156+
157+
exports[`emit option should work with the "memory" cache and disabled "emit" option: warnings 2`] = `Array []`;
158+
159+
exports[`emit option should work without emit option: assets 1`] = `
160+
Array [
161+
"main.bundle.js",
162+
"main.css",
163+
"react.svg",
164+
]
165+
`;
166+
167+
exports[`emit option should work without emit option: errors 1`] = `Array []`;
168+
169+
exports[`emit option should work without emit option: warnings 1`] = `Array []`;

0 commit comments

Comments
 (0)