|
1 |
| -import { expectFileToMatch } from '../../utils/fs'; |
2 |
| -import { ng } from '../../utils/process'; |
3 | 1 | import { oneLineTrim } from 'common-tags';
|
| 2 | +import { |
| 3 | + expectFileSizeToBeUnder, |
| 4 | + expectFileToExist, |
| 5 | + expectFileToMatch, |
| 6 | + getFileSize, |
| 7 | +} from '../../utils/fs'; |
| 8 | +import { ng } from '../../utils/process'; |
| 9 | +import { expectToFail } from '../../utils/utils'; |
4 | 10 |
|
5 |
| -export default function () { |
6 |
| - // TODO(architect): Delete this test. It is now in devkit/build-angular. |
| 11 | +export default async function () { |
| 12 | + await ng('build'); |
| 13 | + // files were created successfully |
| 14 | + await expectFileToMatch('dist/test-project/polyfills.js', 'core-js/es7/reflect'); |
| 15 | + await expectFileToMatch('dist/test-project/polyfills.js', 'zone.js'); |
| 16 | + expectFileToMatch('dist/test-project/index.html', oneLineTrim` |
| 17 | + <script type="text/javascript" src="runtime.js"></script> |
| 18 | + <script type="text/javascript" src="polyfills.js"></script> |
| 19 | + `); |
| 20 | + const jitPolyfillSize = await getFileSize('dist/test-project/polyfills.js'); |
7 | 21 |
|
8 |
| - return Promise.resolve() |
9 |
| - .then(() => ng('build')) |
| 22 | + await ng('build', '--aot'); |
10 | 23 | // files were created successfully
|
11 |
| - .then(() => expectFileToMatch('dist/test-project/polyfills.js', 'core-js')) |
12 |
| - .then(() => expectFileToMatch('dist/test-project/polyfills.js', 'zone.js')) |
13 |
| - // index.html lists the right bundles |
14 |
| - .then(() => expectFileToMatch('dist/test-project/index.html', oneLineTrim` |
| 24 | + await expectFileToExist('dist/test-project/polyfills.js'); |
| 25 | + await expectFileSizeToBeUnder('dist/test-project/polyfills.js', jitPolyfillSize); |
| 26 | + await expectToFail(() => expectFileToMatch('dist/test-project/polyfills.js', 'core-js/es7/reflect')); |
| 27 | + await expectFileToMatch('dist/test-project/polyfills.js', 'zone.js'); |
| 28 | + expectFileToMatch('dist/test-project/index.html', oneLineTrim` |
15 | 29 | <script type="text/javascript" src="runtime.js"></script>
|
16 | 30 | <script type="text/javascript" src="polyfills.js"></script>
|
17 |
| - `)); |
| 31 | + `); |
18 | 32 | }
|
0 commit comments