Skip to content

Commit

Permalink
chore: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
evenstensberg committed Feb 4, 2019
1 parent 186f683 commit 3c567be
Show file tree
Hide file tree
Showing 7 changed files with 366 additions and 370 deletions.
667 changes: 337 additions & 330 deletions junit.xml

Large diffs are not rendered by default.

Expand Up @@ -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
Expand Down
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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;
}

});
});
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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");
});
});

9 changes: 2 additions & 7 deletions test/binCases/watch/multi-config/multi-config.test.js
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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");
});
});
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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");
});
});

8 changes: 2 additions & 6 deletions test/binCases/watch/single-config/single-config.test.js
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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");
});
});

0 comments on commit 3c567be

Please sign in to comment.