Skip to content

Commit 4f4ff9f

Browse files
filipesilvahansl
authored andcommitted
test: fix flake on rebuild-error
1 parent ae53cb1 commit 4f4ff9f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tests/e2e/tests/build/rebuild-error.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ import {
55
} from '../../utils/process';
66
import { replaceInFile, readFile, writeFile } from '../../utils/fs';
77
import { getGlobalVariable } from '../../utils/env';
8-
import { wait } from '../../utils/utils';
8+
import { wait, expectToFail } from '../../utils/utils';
99

1010

1111
const failedRe = /webpack: Failed to compile/;
1212
const successRe = /webpack: Compiled successfully/;
13+
const errorRe = /ERROR in/;
1314
const extraErrors = [
1415
`Final loader didn't return a Buffer or String`,
1516
`doesn't contain a valid alias configuration`,
@@ -58,7 +59,7 @@ export default function () {
5859
// Add an syntax error to a non-main file.
5960
// Build should still be successfull and error reported on forked type checker.
6061
.then(() => Promise.all([
61-
waitForAnyProcessOutputToMatch(successRe, 20000),
62+
waitForAnyProcessOutputToMatch(errorRe, 20000),
6263
writeFile('src/app/app.component.ts', origContent + '\n]]]]]')
6364
]))
6465
.then((results) => {
@@ -71,8 +72,10 @@ export default function () {
7172
}
7273
})
7374
// Fix the error, should trigger a successful rebuild.
75+
// We have to wait for the type checker to run, so we expect to NOT
76+
// have an error message in 5s.
7477
.then(() => Promise.all([
75-
waitForAnyProcessOutputToMatch(successRe, 20000),
78+
expectToFail(() => waitForAnyProcessOutputToMatch(errorRe, 5000)),
7679
replaceInFile('src/app/app.component.ts', ']]]]]', '')
7780
]))
7881
.then(() => wait(2000))

0 commit comments

Comments
 (0)