From 3c567bee8e6a985f5291db9d5f32df42e04a18ba Mon Sep 17 00:00:00 2001 From: ev1stensberg Date: Tue, 5 Feb 2019 00:29:57 +0100 Subject: [PATCH] chore: update tests --- junit.xml | 667 +++++++++--------- .../info-verbosity-off.test.js | 1 - .../info-verbosity-verbose.test.js | 35 +- .../multi-config-watch-opt.test.js | 8 +- .../watch/multi-config/multi-config.test.js | 9 +- .../single-config-watch-opt.test.js | 8 +- .../watch/single-config/single-config.test.js | 8 +- 7 files changed, 366 insertions(+), 370 deletions(-) diff --git a/junit.xml b/junit.xml index 0bb4c13c72c..e35f142857f 100644 --- a/junit.xml +++ b/junit.xml @@ -1,545 +1,552 @@ - - - + + + - - - - - + + + - + + + - + + + - + + + - + + + - - + + - + + + - + + + - + + + - + + + - - + + - + + + - + + + - - + + - + + + - + + + - + + + - + + + - + + + - - + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + - + - - - + - + - + - + - + - + - + + + + - + + + + - + + + - + + + - + + + - + + + - + - + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + - - - + - + - + - + - + - + - + - - + + - + + + - + - + - - - + - + - + - + - + + + - + - - + + - + - + - - + + - + - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - + - + - + - - + + - - - + - - + + - - - + - - - + - - - + - - - - Error: expect(received).toBe(expected) // Object.is equality - -Expected: 0 -Received: 255 - at Object.toBe (/Users/evenstensberg/Documents/Github/webpack-cli/test/binCases/plugins/uglifyjsplugin-empty-args/uglifyjsplugin-empty-args.test.js:21:15) - at Object.asyncJestTest (/Users/evenstensberg/Documents/Github/webpack-cli/node_modules/jest-jasmine2/build/jasmine_async.js:108:37) - at resolve (/Users/evenstensberg/Documents/Github/webpack-cli/node_modules/jest-jasmine2/build/queue_runner.js:56:12) - at new Promise (<anonymous>) - at mapper (/Users/evenstensberg/Documents/Github/webpack-cli/node_modules/jest-jasmine2/build/queue_runner.js:43:19) - at promise.then (/Users/evenstensberg/Documents/Github/webpack-cli/node_modules/jest-jasmine2/build/queue_runner.js:87:41) - at process.internalTickCallback (internal/process/next_tick.js:77:7) + - - - + - - - + - - - + - - - + - - - + - - - + - - + + - - - + - + - + - + - + - + - + - - - + - - - + - - - + - - - + - + - + - + - + - - - + - - - + - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - + - - - + - - + + - - - + - - - + - - - + - + - + + + - + - + - - + + - - - + - - - + - - - + - - - + - + - + - + - - + + - - - + - + - + - - + + - - - + - - - + - + - + - - + + - + - - - + - - + + - + - - + + - - - + + + + + - - + + - - + + - + - + - - + + - - - + + + - - + + - + - + - - + + - - + + + + + + + + + + + + - - + + + + + + + + \ No newline at end of file diff --git a/test/binCases/watch/info-verbosity-off/info-verbosity-off.test.js b/test/binCases/watch/info-verbosity-off/info-verbosity-off.test.js index e9e22f2a29b..66515ebda23 100644 --- a/test/binCases/watch/info-verbosity-off/info-verbosity-off.test.js +++ b/test/binCases/watch/info-verbosity-off/info-verbosity-off.test.js @@ -67,7 +67,6 @@ test("info-verbosity-off", async done => { hash1 = extractHash(data); summary = extractSummary(data); - expect(summary).not.toContain("webpack is watching the files…"); expect(summary).toMatchSnapshot(); // change file diff --git a/test/binCases/watch/info-verbosity-verbose/info-verbosity-verbose.test.js b/test/binCases/watch/info-verbosity-verbose/info-verbosity-verbose.test.js index d6bd1d865bb..996bfcae7bb 100644 --- a/test/binCases/watch/info-verbosity-verbose/info-verbosity-verbose.test.js +++ b/test/binCases/watch/info-verbosity-verbose/info-verbosity-verbose.test.js @@ -55,25 +55,14 @@ test("info-verbosity-verbose", async done => { // 6. Compilation finished // 7. Hash and other info var chunkNumber = 0; + var stderrNumber = 0; var hash1, hash2; webpackProc.stdout.on("data", data => { data = data.toString(); chunkNumber++; - switch (chunkNumber) { case 1: - case 5: - expect(data).toContain("Compilation starting"); - break; - case 2: - expect(data).toContain("webpack is watching the files"); - break; - case 3: - case 6: - expect(data).toContain("Compilation finished"); - break; - case 4: expect(extractSummary(data)).toMatchSnapshot(); hash1 = extractHash(data); @@ -85,7 +74,7 @@ test("info-verbosity-verbose", async done => { appendDataIfFileExists(__dirname, fileToChange, "//junk-comment"); break; - case 7: + case 2: hash2 = extractHash(data); expect(hash2.hash).not.toBe(hash1.hash); @@ -100,6 +89,24 @@ test("info-verbosity-verbose", async done => { webpackProc.stderr.on("data", error => { // fail test case if there is any error - done(error.toString()); + stderrNumber++; + + switch (stderrNumber) { + case 1: + case 4: + expect(error.toString()).toContain("Compilation starting"); + break; + case 3: + case 5: + case 7: + expect(error.toString()).toContain("Compilation finished"); + break; + case 2: + expect(error.toString()).toContain("webpack is watching the files"); + break; + default: + break; + } + }); }); diff --git a/test/binCases/watch/multi-config-watch-opt/multi-config-watch-opt.test.js b/test/binCases/watch/multi-config-watch-opt/multi-config-watch-opt.test.js index b4ffc2acb8f..4b53b6cd7c6 100644 --- a/test/binCases/watch/multi-config-watch-opt/multi-config-watch-opt.test.js +++ b/test/binCases/watch/multi-config-watch-opt/multi-config-watch-opt.test.js @@ -58,9 +58,6 @@ test("multi-config-watch-opt", async done => { switch (chunkNumber) { case 1: - expect(data).toContain("webpack is watching the files"); - break; - case 2: expect(extractSummary(data)).toMatchSnapshot(); hash1 = extractHash(data); @@ -72,7 +69,7 @@ test("multi-config-watch-opt", async done => { appendDataIfFileExists(__dirname, fileToChange, "//junk-comment"); break; - case 3: + case 2: hash2 = extractHash(data); expect(hash2.hash).not.toBe(hash1.hash); @@ -86,8 +83,7 @@ test("multi-config-watch-opt", async done => { }); webpackProc.stderr.on("data", error => { - // fail test case if there is any error - done(error.toString()); + expect(error.toString()).toContain("webpack is watching the files"); }); }); diff --git a/test/binCases/watch/multi-config/multi-config.test.js b/test/binCases/watch/multi-config/multi-config.test.js index 03261f08fcd..81b13d555b6 100644 --- a/test/binCases/watch/multi-config/multi-config.test.js +++ b/test/binCases/watch/multi-config/multi-config.test.js @@ -43,12 +43,8 @@ test("multi-config", async done => { webpackProc.stdout.on("data", data => { data = data.toString(); chunkNumber++; - switch (chunkNumber) { case 1: - expect(data).toContain("webpack is watching the files"); - break; - case 2: expect(extractSummary(data)).toMatchSnapshot(); hash1 = extractHash(data); @@ -60,7 +56,7 @@ test("multi-config", async done => { appendDataIfFileExists(__dirname, fileToChange, "//junk-comment"); break; - case 3: + case 2: hash2 = extractHash(data); expect(hash2.hash).not.toBe(hash1.hash); @@ -74,7 +70,6 @@ test("multi-config", async done => { }); webpackProc.stderr.on("data", error => { - // fail test case if there is any error - done(error.toString()); + expect(error.toString()).toContain("webpack is watching the files"); }); }); diff --git a/test/binCases/watch/single-config-watch-opt/single-config-watch-opt.test.js b/test/binCases/watch/single-config-watch-opt/single-config-watch-opt.test.js index e52fca6a73c..7af61cf12c9 100644 --- a/test/binCases/watch/single-config-watch-opt/single-config-watch-opt.test.js +++ b/test/binCases/watch/single-config-watch-opt/single-config-watch-opt.test.js @@ -58,9 +58,6 @@ test("single-config-watch-opt", async done => { switch (chunkNumber) { case 1: - expect(data).toContain("webpack is watching the files"); - break; - case 2: expect(extractSummary(data)).toMatchSnapshot(); hash1 = extractHash(data); @@ -72,7 +69,7 @@ test("single-config-watch-opt", async done => { appendDataIfFileExists(__dirname, fileToChange, "//junk-comment"); break; - case 3: + case 2: hash2 = extractHash(data); expect(hash2.hash).not.toBe(hash1.hash); @@ -86,8 +83,7 @@ test("single-config-watch-opt", async done => { }); webpackProc.stderr.on("data", error => { - // fail test case if there is any error - done(error.toString()); + expect(error.toString()).toContain("webpack is watching the files"); }); }); diff --git a/test/binCases/watch/single-config/single-config.test.js b/test/binCases/watch/single-config/single-config.test.js index 0f5b5b2ae15..2105fc8980f 100644 --- a/test/binCases/watch/single-config/single-config.test.js +++ b/test/binCases/watch/single-config/single-config.test.js @@ -58,9 +58,6 @@ test("single-config", async(done) => { switch (chunkNumber) { case 1: - expect(data).toContain("webpack is watching the files"); - break; - case 2: expect(extractSummary(data)).toMatchSnapshot(); hash1 = extractHash(data); @@ -72,7 +69,7 @@ test("single-config", async(done) => { appendDataIfFileExists(__dirname, fileToChange, "//junk-comment"); break; - case 3: + case 2: hash2 = extractHash(data); expect(hash2.hash).not.toBe(hash1.hash); @@ -86,7 +83,6 @@ test("single-config", async(done) => { }); webpackProc.stderr.on("data", error => { - // fail test case if there is any error - done(error.toString()); + expect(error.toString()).toContain("webpack is watching the files"); }); });