Skip to content

Commit 3442865

Browse files
tests(binTestCases): refactor to make tests pass (#472)
1 parent c2398a2 commit 3442865

File tree

18 files changed

+34
-34
lines changed

18 files changed

+34
-34
lines changed

.eslintignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
**/__testfixtures__/*
22
coverage
33
test
4-
docs
4+
docs
5+
node_modules

test/BinTestCases.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ describe("BinTestCases", function() {
167167
try {
168168
testAssertions(env.code, stdout, stderr);
169169
} catch(e) {
170-
console.log(`### stderr ###\n${env.stderr.join("")}`);
171-
console.log(`### stdout ###\n${env.stdout.join("")}`);
170+
// console.log(`### stderr ###\n${env.stderr.join("")}`);
171+
// console.log(`### stdout ###\n${env.stdout.join("")}`);
172172
throw e;
173173
}
174174
});

test/binCases/config-name/found-many/stdin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module.exports = function testAssertions(code, stdout, stderr) {
44
expect(code).toBe(0);
55
expect(stdout).toEqual(expect.anything());
6-
expect(stdout[9]).toContain("./index2.js");
7-
expect(stdout[17]).toContain("./index3.js");
6+
expect(stdout[8]).toContain("./index2.js");
7+
expect(stdout[15]).toContain("./index3.js");
88
expect(stderr).toHaveLength(0);
99
};

test/binCases/config-name/found-one/stdin.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
module.exports = function testAssertions(code, stdout, stderr) {
44
expect(code).toBe(0);
55
expect(stdout).toEqual(expect.anything());
6-
7-
expect(stdout[7]).toContain("./index2.js");
6+
expect(stdout[6]).toContain("./index2.js");
87
expect(stderr).toHaveLength(0);
98
};

test/binCases/config-type/array/stdin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module.exports = function testAssertions(code, stdout, stderr) {
77
expect(stdout[1]).toContain("Version: ");
88
expect(stdout[2]).toContain("Child");
99
expect(stdout[7]).toContain("entry-a.bundle.js");
10-
expect(stdout[10]).toContain("Child");
11-
expect(stdout[15]).toContain("entry-b.bundle.js");
10+
expect(stdout[9]).toContain("Child");
11+
expect(stdout[14]).toContain("entry-b.bundle.js");
1212
expect(stderr).toHaveLength(0);
1313
};

test/binCases/configFile/plugins-precedence/stdin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
module.exports = function testAssertions(code, stdout, stderr) {
44
expect(code).toBe(0);
55
expect(stdout).toEqual(expect.anything());
6-
expect(stdout[7]).toContain("ok.js");
6+
expect(stdout[6]).toContain("ok.js");
77
expect(stderr).toHaveLength(0);
88
};

test/binCases/configFile/profile/stdin.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ module.exports = function testAssertions(code, stdout, stderr) {
44
expect(code).toBe(0);
55
expect(stdout).toEqual(expect.anything());
66

7-
expect(stdout[8]).toContain("factory:");
8-
expect(stdout[10]).toContain("factory:");
9-
expect(stdout[12]).toContain("factory:");
7+
expect(stdout[7]).toContain("factory:");
8+
expect(stdout[9]).toContain("factory:");
9+
expect(stdout[11]).toContain("factory:");
1010
expect(stderr).toHaveLength(0);
1111
};

test/binCases/entry/cli-override/stdin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ module.exports = function testAssertions(code, stdout, stderr) {
44
expect(code).toBe(0);
55
expect(stdout).toEqual(expect.anything());
66
expect(stdout[5]).toContain("cliEntry.js");
7-
expect(stdout[7]).toContain("index.js");
7+
expect(stdout[6]).toContain("index.js");
88
expect(stderr).toHaveLength(0);
99
};

test/binCases/entry/multi-file/stdin.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ module.exports = function testAssertions(code, stdout, stderr) {
44
expect(code).toBe(0);
55
expect(stdout).toEqual(expect.anything());
66
expect(stdout[5]).toContain("null.js");
7-
expect(stdout[7]).toMatch(/a\.js.*\{0\}/);
8-
expect(stdout[8]).toMatch(/index\.js.*\{0\}/);
9-
expect(stdout[9]).toMatch(/multi.*index\.js.*a\.js/); // should have multi-file entry
7+
expect(stdout[6]).toMatch(/a\.js.*\{0\}/);
8+
expect(stdout[7]).toMatch(/index\.js.*\{0\}/);
9+
expect(stdout[8]).toMatch(/multi.*index\.js.*a\.js/); // should have multi-file entry
1010
expect(stderr).toHaveLength(0);
1111
};

test/binCases/entry/named-entry/stdin.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ module.exports = function testAssertions(code, stdout, stderr) {
44
expect(code).toBe(0);
55
expect(stdout).toEqual(expect.anything());
66
expect(stdout[5]).toContain("null.js");
7-
expect(stdout[7]).toContain("foo.js"); // named entry from --entry foo=./a.js
8-
expect(stdout[9]).toMatch(/index\.js.*\{0\}/);
9-
expect(stdout[10]).toMatch(/a\.js.*\{1\}/);
7+
expect(stdout[6]).toContain("foo.js"); // named entry from --entry foo=./a.js
8+
expect(stdout[7]).toMatch(/index\.js.*\{0\}/);
9+
expect(stdout[8]).toMatch(/a\.js.*\{1\}/);
1010
expect(stderr).toHaveLength(0);
1111
};

0 commit comments

Comments
 (0)