Skip to content

Commit 7fbf3af

Browse files
authored
Merge pull request webpack#13510 from webpack/dependabot/npm_and_yarn/jest-27.0.4
chore(deps-dev): bump jest from 26.6.3 to 27.0.6
2 parents 4c8ca9d + cdeded5 commit 7fbf3af

13 files changed

Lines changed: 778 additions & 1501 deletions

File tree

azure-pipelines.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ jobs:
1616
- script: |
1717
set -e
1818
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
19-
export CI=true
2019
node -v
2120
yarn -v
2221
displayName: "Print versions"
@@ -39,6 +38,8 @@ jobs:
3938
yarn test:basic --ci --reporters=default --reporters=jest-junit
4039
export JEST_JUNIT_OUTPUT_NAME=unit-junit.xml
4140
yarn test:unit --ci --reporters=default --reporters=jest-junit
41+
env:
42+
CI: true
4243
displayName: "Run basic tests"
4344
- task: PublishTestResults@2
4445
inputs:
@@ -67,7 +68,6 @@ jobs:
6768
- script: |
6869
set -e
6970
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
70-
export CI=true
7171
node -v
7272
yarn -v
7373
displayName: "Print versions"
@@ -92,6 +92,8 @@ jobs:
9292
yarn typings-lint
9393
yarn pretty-lint
9494
yarn spellcheck
95+
env:
96+
CI: true
9597
displayName: "Run linting"
9698
- task: PublishTestResults@2
9799
inputs:
@@ -142,14 +144,16 @@ jobs:
142144
- script: |
143145
yarn cover:integration --ci --maxWorkers=2 --reporters=default --reporters=jest-junit
144146
yarn cover:merge
145-
env: CI=true
147+
env:
148+
CI: true
146149
displayName: "Run tests with coverage"
147150
- task: PublishTestResults@2
148151
inputs:
149152
testRunTitle: "Windows with Node.js $(node_version)"
150153
testResultsFiles: "**/junit.xml"
151154
condition: succeededOrFailed()
152155
displayName: "Publish test results"
156+
153157
- job: Linux
154158
dependsOn:
155159
- basic
@@ -178,7 +182,6 @@ jobs:
178182
- script: |
179183
set -e
180184
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
181-
export CI=true
182185
node -v
183186
yarn -v
184187
displayName: "Print versions"
@@ -199,6 +202,8 @@ jobs:
199202
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
200203
yarn cover:integration --ci --maxWorkers=2 --reporters=default --reporters=jest-junit
201204
yarn cover:merge
205+
env:
206+
CI: true
202207
displayName: "Run tests with coverage"
203208
- task: PublishTestResults@2
204209
inputs:
@@ -231,7 +236,6 @@ jobs:
231236
- script: |
232237
set -e
233238
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
234-
export CI=true
235239
node -v
236240
yarn -v
237241
displayName: "Print versions"
@@ -252,6 +256,8 @@ jobs:
252256
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
253257
yarn cover:integration --ci --reporters=default --reporters=jest-junit
254258
yarn cover:merge
259+
env:
260+
CI: true
255261
displayName: "Run tests with coverage"
256262
- task: PublishTestResults@2
257263
inputs:

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"@babel/core": "^7.11.1",
3939
"@babel/preset-react": "^7.10.4",
4040
"@types/es-module-lexer": "^0.4.1",
41-
"@types/jest": "^26.0.15",
41+
"@types/jest": "^26.0.24",
4242
"@types/node": "^15.0.1",
4343
"babel-loader": "^8.1.0",
4444
"benchmark": "^2.1.4",
@@ -54,7 +54,7 @@
5454
"es6-promise-polyfill": "^1.2.0",
5555
"eslint": "^7.14.0",
5656
"eslint-config-prettier": "^8.1.0",
57-
"eslint-plugin-jest": "^24.1.3",
57+
"eslint-plugin-jest": "^24.3.6",
5858
"eslint-plugin-jsdoc": "^33.0.0",
5959
"eslint-plugin-node": "^11.0.0",
6060
"eslint-plugin-prettier": "^3.1.4",
@@ -63,7 +63,8 @@
6363
"husky": "^6.0.0",
6464
"is-ci": "^3.0.0",
6565
"istanbul": "^0.4.5",
66-
"jest": "^26.6.3",
66+
"jest": "^27.0.6",
67+
"jest-circus": "^27.0.6",
6768
"jest-diff": "^27.0.2",
6869
"jest-junit": "^12.0.0",
6970
"json-loader": "^0.5.7",
@@ -75,7 +76,7 @@
7576
"lodash": "^4.17.19",
7677
"lodash-es": "^4.17.15",
7778
"memfs": "^3.2.0",
78-
"mini-css-extract-plugin": "^1.0.0",
79+
"mini-css-extract-plugin": "^1.6.1",
7980
"mini-svg-data-uri": "^1.2.3",
8081
"nyc": "^15.1.0",
8182
"open-cli": "^6.0.1",
@@ -131,6 +132,7 @@
131132
],
132133
"scripts": {
133134
"setup": "node ./setup/setup.js",
135+
"jest": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --logHeapUsage",
134136
"test": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --logHeapUsage",
135137
"test:update-snapshots": "yarn jest -u",
136138
"test:integration": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --logHeapUsage --testMatch \"<rootDir>/test/*.test.js\"",

test/Compiler.test.js

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ describe("Compiler", () => {
302302
done();
303303
});
304304
});
305-
it("should bubble up errors when wrapped in a promise and bail is true", async done => {
305+
it("should bubble up errors when wrapped in a promise and bail is true", async () => {
306306
try {
307307
const createCompiler = options => {
308308
return new Promise((resolve, reject) => {
@@ -330,42 +330,35 @@ describe("Compiler", () => {
330330
},
331331
bail: true
332332
});
333-
done();
334333
} catch (err) {
335334
expect(err.toString()).toMatch(
336335
"ModuleNotFoundError: Module not found: Error: Can't resolve './missing-file'"
337336
);
338-
done();
339337
}
340338
});
341-
it("should not emit compilation errors in async (watch)", async done => {
342-
try {
343-
const createStats = options => {
344-
return new Promise((resolve, reject) => {
345-
const c = webpack(options);
346-
c.outputFileSystem = createFsFromVolume(new Volume());
347-
const watching = c.watch({}, (err, stats) => {
348-
watching.close(() => {
349-
if (err) return reject(err);
350-
resolve(stats);
351-
});
339+
it("should not emit compilation errors in async (watch)", async () => {
340+
const createStats = options => {
341+
return new Promise((resolve, reject) => {
342+
const c = webpack(options);
343+
c.outputFileSystem = createFsFromVolume(new Volume());
344+
const watching = c.watch({}, (err, stats) => {
345+
watching.close(() => {
346+
if (err) return reject(err);
347+
resolve(stats);
352348
});
353349
});
354-
};
355-
const stats = await createStats({
356-
context: __dirname,
357-
mode: "production",
358-
entry: "./missing-file",
359-
output: {
360-
path: "/directory",
361-
filename: "bundle.js"
362-
}
363350
});
364-
expect(stats).toBeInstanceOf(Stats);
365-
done();
366-
} catch (err) {
367-
done(err);
368-
}
351+
};
352+
const stats = await createStats({
353+
context: __dirname,
354+
mode: "production",
355+
entry: "./missing-file",
356+
output: {
357+
path: "/directory",
358+
filename: "bundle.js"
359+
}
360+
});
361+
expect(stats).toBeInstanceOf(Stats);
369362
});
370363

371364
it("should not emit on errors (watch)", done => {

test/ConfigTestCases.template.js

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,15 @@ const describeCases = config => {
168168
const deprecationTracker = deprecationTracking.start();
169169
require("..")(options, err => {
170170
deprecationTracker();
171+
const infrastructureLogging = stderr.toString();
172+
if (infrastructureLogging) {
173+
return done(
174+
new Error(
175+
"Errors/Warnings during build:\n" +
176+
infrastructureLogging
177+
)
178+
);
179+
}
171180
if (err) return handleFatalError(err, done);
172181
done();
173182
});
@@ -185,6 +194,15 @@ const describeCases = config => {
185194
errorsCount: true
186195
});
187196
if (errorsCount === 0) {
197+
const infrastructureLogging = stderr.toString();
198+
if (infrastructureLogging) {
199+
return done(
200+
new Error(
201+
"Errors/Warnings during build:\n" +
202+
infrastructureLogging
203+
)
204+
);
205+
}
188206
const allModules = children
189207
? children.reduce(
190208
(all, { modules }) => all.concat(modules),
@@ -209,7 +227,7 @@ const describeCases = config => {
209227
}
210228
done();
211229
});
212-
}, 20000);
230+
}, 40000);
213231
}
214232
it(`${testName} should compile`, done => {
215233
rimraf.sync(outputDirectory);
@@ -260,7 +278,7 @@ const describeCases = config => {
260278
}
261279
const infrastructureLogging = stderr.toString();
262280
if (infrastructureLogging) {
263-
done(
281+
return done(
264282
new Error(
265283
"Errors/Warnings during build:\n" + infrastructureLogging
266284
)
@@ -551,15 +569,15 @@ const describeCases = config => {
551569
})
552570
.catch(done);
553571
});
554-
});
572+
}, 30000);
555573

556574
const {
557575
it: _it,
558576
beforeEach: _beforeEach,
559577
afterEach: _afterEach,
560578
setDefaultTimeout,
561579
getNumberOfTests
562-
} = createLazyTestEnv(jasmine.getEnv(), 10000);
580+
} = createLazyTestEnv(10000);
563581
});
564582
}
565583
});

test/Errors.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ it("should emit warning for missingFile", async () => {
165165
"warnings": Array [],
166166
}
167167
`);
168-
});
168+
}, 20000);
169169

170170
it("should emit warning for require.extensions", async () => {
171171
await expect(compile({ entry: "./require.extensions" })).resolves

test/HotTestCases.template.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ const describeCases = config => {
323323
beforeEach: _beforeEach,
324324
afterEach: _afterEach,
325325
getNumberOfTests
326-
} = createLazyTestEnv(jasmine.getEnv(), 20000);
326+
} = createLazyTestEnv(20000);
327327
});
328328
});
329329
});

test/TestCases.template.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,6 @@ const describeCases = config => {
430430
);
431431

432432
const { it: _it, getNumberOfTests } = createLazyTestEnv(
433-
jasmine.getEnv(),
434433
testConfig.timeout || 10000
435434
);
436435
});

test/WatchClose.test.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ describe("WatchClose", () => {
4242
});
4343
}
4444

45-
it("each callback should be called", async done => {
45+
it("each callback should be called", async () => {
4646
let num = 0;
4747

4848
await Promise.all([
@@ -55,8 +55,6 @@ describe("WatchClose", () => {
5555
]);
5656

5757
expect(num).toBe(1111);
58-
59-
done();
6058
});
6159
});
6260
});

test/WatchTestCases.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,6 @@ describe("WatchTestCases", () => {
379379

380380
for (const run of runs) {
381381
const { it: _it, getNumberOfTests } = createLazyTestEnv(
382-
jasmine.getEnv(),
383382
10000,
384383
run.name
385384
);

test/cases/parsing/es6.nominimize/index.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import a from "./a";
44

5-
it("should parse classes", function() {
5+
it("should parse classes", function () {
66
class MyClass {
77
constructor() {
88
this.a = require("./a");
@@ -24,40 +24,42 @@ it("should parse classes", function() {
2424
expect(x.c()).toBe("c");
2525
});
2626

27-
it("should parse spread operator"/*, function() {
27+
it("should parse spread operator", function () {
2828
expect([0, ...require("./array")]).toEqual([0, 1, 2, 3]);
29-
expect(({z: 0, ...require("./object")})).toEqual({z: 0, a: 1, b: 2, c: 3});
30-
}*/);
29+
expect({ z: 0, ...require("./object") }).toEqual({ z: 0, a: 1, b: 2, c: 3 });
30+
});
3131

32-
it("should parse arrow function", function() {
32+
it("should parse arrow function", function () {
3333
expect((() => require("./a"))()).toBe("a");
34-
expect((() => {
35-
return require("./a");
36-
})()).toBe("a");
34+
expect(
35+
(() => {
36+
return require("./a");
37+
})()
38+
).toBe("a");
3739
require.ensure([], () => {
3840
require("./a");
3941
});
4042
require.ensure([], () => {
4143
require("./async");
4244
});
43-
if(module.hot) {
45+
if (module.hot) {
4446
module.hot.accept("./a", () => {
4547
var x = 1;
4648
});
4749
}
4850
});
4951

50-
it("should parse template literals", function() {
52+
it("should parse template literals", function () {
5153
function tag(strings, value) {
5254
return value;
5355
}
5456
var x = `a${require("./b")}c`;
5557
var y = tag`a${require("./b")}c`;
5658
expect(x).toBe("abc");
5759
expect(y).toBe("b");
58-
})
60+
});
5961

60-
it("should parse generators and yield", function() {
62+
it("should parse generators and yield", function () {
6163
function* gen() {
6264
yield require("./a");
6365
yield require("./b");
@@ -66,4 +68,4 @@ it("should parse generators and yield", function() {
6668
expect(x.next().value).toBe("a");
6769
expect(x.next().value).toBe("b");
6870
expect(x.next().done).toBe(true);
69-
})
71+
});

0 commit comments

Comments
 (0)