diff --git a/tests/e2e/tests/build/rebuild-deps-type-check.ts b/tests/e2e/tests/build/rebuild-deps-type-check.ts index 8e7fdaa62835..bd84850e509f 100644 --- a/tests/e2e/tests/build/rebuild-deps-type-check.ts +++ b/tests/e2e/tests/build/rebuild-deps-type-check.ts @@ -12,7 +12,6 @@ const doneRe = /webpack: bundle is now VALID|webpack: Compiled successfully.|webpack: Failed to compile./; - export default function() { if (process.platform.startsWith('win')) { return Promise.resolve(); @@ -22,7 +21,7 @@ export default function() { return Promise.resolve(); } - return silentExecAndWaitForOutputToMatch('ng', ['serve'], doneRe) + return Promise.resolve() // Create and import files. .then(() => writeFile('src/funky2.ts', ` export function funky2(value: string): string { @@ -33,24 +32,24 @@ export default function() { export * from './funky2'; `)) .then(() => prependToFile('src/main.ts', ` - import { funky } from './funky'; + import { funky2 } from './funky'; `)) .then(() => appendToFile('src/main.ts', ` - console.log(funky('town')); + console.log(funky2('town')); `)) + .then(() => wait(2000)) // Should trigger a rebuild, no error expected. - .then(() => waitForAnyProcessOutputToMatch(doneRe, 10000)) + .then(() => silentExecAndWaitForOutputToMatch('ng', ['serve'], doneRe)) // Make an invalid version of the file. - .then(() => wait(2000)) .then(() => writeFile('src/funky2.ts', ` - export function funky(value: number): number { + export function funky2(value: number): number { return value + 1; } `)) // Should trigger a rebuild, this time an error is expected. .then(() => waitForAnyProcessOutputToMatch(doneRe, 10000)) - .then(({ stdout }) => { - if (!/ERROR in .*\/src\/main\.ts \(/.test(stdout)) { + .then(({ stderr }) => { + if (!/ERROR in .*\/src\/main\.ts \(/.test(stderr)) { throw new Error('Expected an error but none happened.'); } }) @@ -61,20 +60,20 @@ export default function() { `)) // Should trigger a rebuild, this time an error is expected. .then(() => waitForAnyProcessOutputToMatch(doneRe, 10000)) - .then(({ stdout }) => { - if (!/ERROR in .*\/src\/main\.ts \(/.test(stdout)) { + .then(({ stderr }) => { + if (!/ERROR in .*\/src\/main\.ts \(/.test(stderr)) { throw new Error('Expected an error but none happened.'); } }) // Fix the error! .then(() => writeFile('src/funky2.ts', ` - export function funky(value: string): string { + export function funky2(value: string): string { return value + 'hello'; } `)) .then(() => waitForAnyProcessOutputToMatch(doneRe, 10000)) - .then(({ stdout }) => { - if (/ERROR in .*\/src\/main\.ts \(/.test(stdout)) { + .then(({ stderr }) => { + if (/ERROR in .*\/src\/main\.ts \(/.test(stderr)) { throw new Error('Expected no error but an error was shown.'); } }) diff --git a/tests/e2e/utils/process.ts b/tests/e2e/utils/process.ts index 32ff695efaac..ae5099d74a73 100644 --- a/tests/e2e/utils/process.ts +++ b/tests/e2e/utils/process.ts @@ -15,7 +15,7 @@ let _processes: child_process.ChildProcess[] = []; type ProcessOutput = { stdout: string; - stdout: string; + stderr: string; };