Skip to content

Commit 365beb1

Browse files
authored
Merge pull request webpack#7699 from webpack/ci/upgrade-jest
upgrade jest
2 parents baa450d + f0cd451 commit 365beb1

File tree

36 files changed

+563
-533
lines changed

36 files changed

+563
-533
lines changed

.eslintrc.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ module.exports = {
6161
browser: true
6262
},
6363
globals: {
64-
Promise: false,
64+
Promise: false
6565
},
6666
parserOptions: {
6767
ecmaVersion: 5
@@ -71,6 +71,9 @@ module.exports = {
7171
files: ["test/**/*.js"],
7272
env: {
7373
"jest/globals": true
74+
},
75+
globals: {
76+
nsObj: false
7477
}
7578
}
7679
]

package.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"istanbul": "^0.4.5",
5757
"jade": "^1.11.0",
5858
"jade-loader": "~0.8.0",
59-
"jest": "^23.0.1",
59+
"jest": "^23.3.0",
6060
"jest-silent-reporter": "^0.0.5",
6161
"json-loader": "^0.5.7",
6262
"less": "^2.5.1",
@@ -82,6 +82,14 @@
8282
"worker-loader": "^1.1.1",
8383
"xxhashjs": "^0.2.1"
8484
},
85+
"resolutions": {
86+
"**/jest-message-util/micromatch": "^2.3.11",
87+
"**/jest-cli/micromatch": "^2.3.11",
88+
"**/jest-runtime/micromatch": "^2.3.11",
89+
"**/jest-haste-map/micromatch": "^2.3.11",
90+
"**/jest-haste-map/sane/micromatch": "^2.3.11",
91+
"**/jest-config/babel-jest/babel-plugin-istanbul/test-exclude/micromatch": "^2.3.11"
92+
},
8593
"engines": {
8694
"node": ">=6.11.5"
8795
},
@@ -179,7 +187,8 @@
179187
"coveragePathIgnorePatterns": [
180188
"\\.runtime\\.js$",
181189
"<rootDir>/test/",
182-
"<rootDir>/schemas/"
190+
"<rootDir>/schemas/",
191+
"<rootDir>/node_modules/"
183192
],
184193
"testEnvironment": "node",
185194
"coverageReporters": [

test/ConfigTestCases.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ describe("ConfigTestCases", () => {
211211
) {
212212
fn = vm.runInNewContext(
213213
"(function(require, module, exports, __dirname, __filename, it, beforeEach, afterEach, expect, jest, window) {" +
214+
'function nsObj(m) { Object.defineProperty(m, Symbol.toStringTag, { value: "Module" }); return m; }' +
214215
content +
215216
"\n})",
216217
globalContext,
@@ -220,6 +221,7 @@ describe("ConfigTestCases", () => {
220221
fn = vm.runInThisContext(
221222
"(function(require, module, exports, __dirname, __filename, it, beforeEach, afterEach, expect, jest) {" +
222223
"global.expect = expect; " +
224+
'function nsObj(m) { Object.defineProperty(m, Symbol.toStringTag, { value: "Module" }); return m; }' +
223225
content +
224226
"\n})",
225227
p

test/HotTestCases.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ describe("HotTestCases", () => {
151151
const fn = vm.runInThisContext(
152152
"(function(require, module, exports, __dirname, __filename, it, expect, NEXT, STATS) {" +
153153
"global.expect = expect;" +
154+
'function nsObj(m) { Object.defineProperty(m, Symbol.toStringTag, { value: "Module" }); return m; }' +
154155
fs.readFileSync(p, "utf-8") +
155156
"\n})",
156157
p

test/TestCases.template.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ const describeCases = config => {
216216
const fn = vm.runInThisContext(
217217
"(function(require, module, exports, __dirname, it, expect) {" +
218218
"global.expect = expect;" +
219+
'function nsObj(m) { Object.defineProperty(m, Symbol.toStringTag, { value: "Module" }); return m; }' +
219220
fs.readFileSync(p, "utf-8") +
220221
"\n})",
221222
p

test/WatchTestCases.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ describe("WatchTestCases", () => {
245245
) {
246246
fn = vm.runInNewContext(
247247
"(function(require, module, exports, __dirname, __filename, it, WATCH_STEP, STATS_JSON, STATE, expect, window) {" +
248+
'function nsObj(m) { Object.defineProperty(m, Symbol.toStringTag, { value: "Module" }); return m; }' +
248249
content +
249250
"\n})",
250251
globalContext,
@@ -254,6 +255,7 @@ describe("WatchTestCases", () => {
254255
fn = vm.runInThisContext(
255256
"(function(require, module, exports, __dirname, __filename, it, WATCH_STEP, STATS_JSON, STATE, expect) {" +
256257
"global.expect = expect;" +
258+
'function nsObj(m) { Object.defineProperty(m, Symbol.toStringTag, { value: "Module" }); return m; }' +
257259
content +
258260
"\n})",
259261
p

test/cases/chunks/import-context/index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@ function testCase(load, done) {
2323
it("should be able to use expressions in import", function(done) {
2424
function load(name, expected, callback) {
2525
import("./dir/" + name).then(function(result) {
26-
expect(result).toEqual({
27-
default: expected,
28-
[Symbol.toStringTag]: "Module"
29-
});
26+
expect(result).toEqual(nsObj({
27+
default: expected
28+
}));
3029
callback();
3130
}).catch(function(err) {
3231
done(err);

test/cases/chunks/import/index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
it("should be able to use import", function(done) {
22
import("./two").then(function(two) {
3-
expect(two).toEqual({
4-
default: 2,
5-
[Symbol.toStringTag]: "Module"
6-
});
3+
expect(two).toEqual(nsObj({
4+
default: 2
5+
}));
76
done();
87
}).catch(function(err) {
98
done(err);

test/cases/chunks/inline-options/index.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,17 +110,15 @@ function testChunkLoading(load, expectedSyncInitial, expectedSyncRequested) {
110110
sync = true;
111111
var p = Promise.all([
112112
load("a").then(function(a) {
113-
expect(a).toEqual({
114-
default: "a",
115-
[Symbol.toStringTag]: "Module"
116-
});
113+
expect(a).toEqual(nsObj({
114+
default: "a"
115+
}));
117116
expect(sync).toBe(true);
118117
}),
119118
load("c").then(function(c) {
120-
expect(c).toEqual({
121-
default: "c",
122-
[Symbol.toStringTag]: "Module"
123-
});
119+
expect(c).toEqual(nsObj({
120+
default: "c"
121+
}));
124122
expect(sync).toBe(expectedSyncRequested);
125123
})
126124
]);

test/cases/chunks/issue-2443/index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
it("should be able to use expressions in import (directory)", function(done) {
22
function load(name, expected, callback) {
33
import("./dir/" + name + "/file.js").then(function(result) {
4-
expect(result).toEqual({
5-
default: expected,
6-
[Symbol.toStringTag]: "Module"
7-
});
4+
expect(result).toEqual(nsObj({
5+
default: expected
6+
}));
87
callback();
98
}).catch(function(err) {
109
done(err);

0 commit comments

Comments
 (0)