|
| 1 | +import { |
| 2 | + killAllProcesses, |
| 3 | + waitForAnyProcessOutputToMatch, |
| 4 | + execAndWaitForOutputToMatch, |
| 5 | +} from '../../../utils/process'; |
| 6 | +import { appendToFile, expectFileToMatch } from '../../../utils/fs'; |
| 7 | +import { expectToFail } from '../../../utils/utils'; |
| 8 | +import { getGlobalVariable } from '../../../utils/env'; |
| 9 | + |
| 10 | +const validBundleRegEx = /webpack: bundle is now VALID|webpack: Compiled successfully./; |
| 11 | + |
| 12 | +export default function () { |
| 13 | + if (process.platform.startsWith('win')) { |
| 14 | + return Promise.resolve(); |
| 15 | + } |
| 16 | + // Skip this in ejected tests. |
| 17 | + if (getGlobalVariable('argv').eject) { |
| 18 | + return Promise.resolve(); |
| 19 | + } |
| 20 | + |
| 21 | + return execAndWaitForOutputToMatch('ng', ['build', '--watch'], validBundleRegEx) |
| 22 | + // Check AOT templates are up to date with current code. |
| 23 | + .then(() => expectToFail(() => |
| 24 | + expectFileToMatch('dist/main.bundle.js', '$$_E2E_GOLDEN_VALUE_1'))) |
| 25 | + .then(() => appendToFile('./src/app/app.component.html', '<p> $$_E2E_GOLDEN_VALUE_1 </p>')) |
| 26 | + .then(() => waitForAnyProcessOutputToMatch(validBundleRegEx, 10000)) |
| 27 | + .then(() => expectFileToMatch('dist/main.bundle.js', '$$_E2E_GOLDEN_VALUE_1')) |
| 28 | + .then(() => killAllProcesses(), (err: any) => { |
| 29 | + killAllProcesses(); |
| 30 | + throw err; |
| 31 | + }); |
| 32 | +} |
0 commit comments