Skip to content

Commit 075fcc3

Browse files
committed
migrate should to expect, part 4 (manual)
1 parent 37e002c commit 075fcc3

File tree

19 files changed

+40
-38
lines changed

19 files changed

+40
-38
lines changed

test/cases/parsing/chunks/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ it("should parse a string in require.ensure with arrow function expression", fun
3030

3131

3232
it("should parse a string in require.ensure with arrow function array expression", function(done) {
33-
require.ensure("./file", require =>expect( (require("./file")).toBe("ok"), done()));
33+
require.ensure("./file", require => (expect(require("./file")).toBe("ok"), done()));
3434
});
3535

3636

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ it("should parse classes", function() {
2626

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

3232
it("should parse arrow function", function() {
33-
(() =>expect( require("./a"))()).toBe("a");
34-
(() => {
33+
expect((() => require("./a"))()).toBe("a");
34+
(expect(() => {
3535
return require("./a");
36-
}expect()()).toBe("a");
36+
})()).toBe("a");
3737
require.ensure([], () => {
3838
require("./a");
3939
});

test/cases/parsing/harmony-this/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ import * as New from "./new";
2020

2121
it("should be possible to use new correctly", function() {
2222
x
23-
expect(new C()).toMatch({ok: true});
23+
expect(new C()).toEqual({ok: true});
2424
x
25-
expect(new C2()).toMatch({ok: true});
25+
expect(new C2()).toEqual({ok: true});
2626
x
27-
expect(new New.C()).toMatch({ok: true});
27+
expect(new New.C()).toEqual({ok: true});
2828
});

test/configCases/commons-chunk-plugin/move-to-grandparent/second.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
it("should handle indirect children with multiple parents correctly", function(done) {
22
import('./pageB').then(b => {
3-
expect( b.default).toBe("reuse");
3+
expect(b.default).toBe("reuse");
44
done()
55
}).catch(e => {
66
done();

test/configCases/dll-plugin/1-use-dll/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ it("should load a module with loader applied", function() {
3434
});
3535

3636
it("should give modules the correct ids", function() {
37-
Object.keys(__webpack_modules__).filter(m =>expect( !m.startsWith("../.."))).toEqual([
37+
expect(Object.keys(__webpack_modules__).filter(m => !m.startsWith("../.."))).toEqual([
3838
"./index.js",
3939
"dll-reference ../0-create-dll/dll.js",
4040
"dll/a.js",

test/configCases/dll-plugin/2-use-dll-without-scope/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ it("should load a module with loader applied", function() {
3434
});
3535

3636
it("should give modules the correct ids", function() {
37-
Object.keys(__webpack_modules__).filter(m =>expect( !m.startsWith("../.."))).toEqual([
37+
expect(Object.keys(__webpack_modules__).filter(m => !m.startsWith("../.."))).toEqual([
3838
"../0-create-dll/a.js",
3939
"../0-create-dll/b.js",
4040
"../0-create-dll/d.js",

test/configCases/filename-template/module-filename-template/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ it("should include test.js in SourceMap", function() {
22
var fs = require("fs");
33
var source = fs.readFileSync(__filename + ".map", "utf-8");
44
var map = JSON.parse(source);
5-
expect(map.sources).toMatch("dummy:///./test.js");
5+
expect(map.sources).toContain("dummy:///./test.js");
66
});
77

88
require.include("./test.js");

test/configCases/parsing/harmony-this-concat/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ import * as New from "./new";
2525

2626
it("should be possible to use new correctly", function() {
2727
x
28-
expect(new C()).toMatch({ok: true});
28+
expect(new C()).toEqual({ok: true});
2929
x
30-
expect(new C2()).toMatch({ok: true});
30+
expect(new C2()).toEqual({ok: true});
3131
x
32-
expect(new New.C()).toMatch({ok: true});
32+
expect(new New.C()).toEqual({ok: true});
3333
});

test/configCases/parsing/harmony-this/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ it("should have this = undefined on imported non-strict functions", function() {
3434
expect(abc.a()).toMatchObject({});
3535
x
3636
var thing = abc.a();
37-
expect(Object.keys(thing)).toBe(Object.keys(abc));
37+
expect(Object.keys(thing)).toEqual(Object.keys(abc));
3838
});
3939

4040
import C2, { C } from "./new";
@@ -43,9 +43,9 @@ import * as New from "./new";
4343

4444
it("should be possible to use new correctly", function() {
4545
x
46-
expect(new C()).toMatch({ok: true});
46+
expect(new C()).toEqual({ok: true});
4747
x
48-
expect(new C2()).toMatch({ok: true});
48+
expect(new C2()).toEqual({ok: true});
4949
x
50-
expect(new New.C()).toMatch({ok: true});
50+
expect(new New.C()).toEqual({ok: true});
5151
});

test/configCases/plugins/lib-manifest-plugin/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ it("should complete", function(done) {
1010

1111
it("should write the correct manifest", function() {
1212
var manifest = JSON.parse(fs.readFileSync(path.join(__dirname, 'bundle0-manifest.json'), "utf-8"));
13-
expect(manifest).to.have.key("content", "name");
14-
expect(manifest.content).not.toHaveProperty("./a.js");
15-
expect(manifest.content).toHaveProperty("./index.js");
13+
expect(manifest).toHaveProperty("content");
14+
expect(manifest).toHaveProperty("name");
15+
expect(manifest.content).not.toHaveProperty(["./a.js"]);
16+
expect(manifest.content).toHaveProperty(["./index.js"]);
1617
expect(manifest.content["./index.js"]).toHaveProperty("id", module.id);
1718
});
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
it("should contain the custom progres messages", function() {
22
var data = require(__dirname + "/data");
3-
expect(data).toMatch("optimizing");
4-
expect(data).toMatch("optimizing|CustomPlugin");
5-
expect(data).toMatch("optimizing|CustomPlugin|custom category|custom message");
3+
expect(data).toContain("optimizing");
4+
expect(data).toContain("optimizing|CustomPlugin");
5+
expect(data).toContain("optimizing|CustomPlugin|custom category|custom message");
66
});

test/configCases/source-map/exclude-chunks-source-map/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ it("should include test.js in SourceMap for bundle0 chunk", function() {
22
var fs = require("fs");
33
var source = fs.readFileSync(__filename + ".map", "utf-8");
44
var map = JSON.parse(source);
5-
expect(map.sources).toMatch("webpack:///./test.js");
5+
expect(map.sources).toContain("webpack:///./test.js");
66
});
77

88
it("should not produce a SourceMap for vendors chunk", function() {

test/configCases/source-map/line-to-line/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ it("should include test.js in SourceMap", function() {
22
var fs = require("fs");
33
var source = fs.readFileSync(__filename + ".map", "utf-8");
44
var map = JSON.parse(source);
5-
expect(map.sources).toMatch("webpack:///./test.js");
5+
expect(map.sources).toContain("webpack:///./test.js");
66
});
77

88
require.include("./test.js");

test/configCases/source-map/module-names/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ function getSourceMap(filename) {
77

88
it("should include test.js in SourceMap", function() {
99
var map = getSourceMap("bundle0.js");
10-
expect(map.sources).toMatch("module");
11-
expect(map.sources).toMatch("fallback");
12-
expect(map.sources).toMatch("fallback**");
10+
expect(map.sources).toContain("module");
11+
expect(map.sources).toContain("fallback");
12+
expect(map.sources).toContain("fallback**");
1313
map = getSourceMap("chunk-a.js");
14-
expect(map.sources).toMatch("fallback*");
14+
expect(map.sources).toContain("fallback*");
1515
map = getSourceMap("chunk-b.js");
16-
expect(map.sources).toMatch("fallback*");
17-
expect(map.sources).toMatch("fallback***");
16+
expect(map.sources).toContain("fallback*");
17+
expect(map.sources).toContain("fallback***");
1818
});
1919

2020
require.ensure(["./test.js"], function(require) {}, "chunk-a");

test/configCases/source-map/namespace-source-path.library/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ it("should include webpack://mylibrary/./test.js in SourceMap", function() {
22
var fs = require("fs");
33
var source = fs.readFileSync(__filename + ".map", "utf-8");
44
var map = JSON.parse(source);
5-
expect(map.sources).toMatch("webpack://mylibrary/./test.js");
5+
expect(map.sources).toContain("webpack://mylibrary/./test.js");
66
});
77

88
require.include("./test.js");

test/configCases/source-map/namespace-source-path/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ it("should include webpack://mynamespace/./test.js in SourceMap", function() {
22
var fs = require("fs");
33
var source = fs.readFileSync(__filename + ".map", "utf-8");
44
var map = JSON.parse(source);
5-
expect(map.sources).toMatch("webpack://mynamespace/./test.js");
5+
expect(map.sources).toContain("webpack://mynamespace/./test.js");
66
});
77

88
require.include("./test.js");

test/configCases/source-map/relative-source-map-path/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ it("should have a relative url to the source-map", function() {
77

88
it("should have a relative url to the source-map with prefix", function(done) {
99
require.ensure([], function(require) {
10+
global.expect = expect;
1011
require("./test.js");
1112
done();
1213
});

test/configCases/source-map/sources-array-production/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ it("should include test.js in SourceMap", function() {
22
var fs = require("fs");
33
var source = fs.readFileSync(__filename + ".map", "utf-8");
44
var map = JSON.parse(source);
5-
expect(map.sources).toMatch("webpack:///./test.js");
5+
expect(map.sources).toContain("webpack:///./test.js");
66
});
77

88
require.include("./test.js");

test/configCases/target/webworker/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ it("should provide a global Buffer constructor", function() {
66
});
77

88
it("should provide a global console shim", function () {
9-
expect(console).toBeInstanceOf(Object);
10-
expect(console.time).toBeInstanceOf(Function);
9+
expect(console).toBeTypeOf("object");
10+
expect(console.time).toBeTypeOf("function");
1111
});
1212

1313
it("should provide a global process shim", function () {

0 commit comments

Comments
 (0)