|
| 1 | +import { oneLineTrim } from 'common-tags'; |
| 2 | +import { expectFileNotToExist, expectFileToMatch } from '../../utils/fs'; |
| 3 | +import { ng } from '../../utils/process'; |
| 4 | +import { updateJsonFile } from '../../utils/project'; |
| 5 | + |
| 6 | +export default async function () { |
| 7 | + await updateJsonFile('angular.json', workspaceJson => { |
| 8 | + const appArchitect = workspaceJson.projects['test-project'].architect; |
| 9 | + appArchitect.build.options.es5BrowserSupport = false; |
| 10 | + }); |
| 11 | + |
| 12 | + await ng('build'); |
| 13 | + await expectFileNotToExist('dist/test-project/es2015-polyfills.js'); |
| 14 | + await expectFileToMatch('dist/test-project/index.html', oneLineTrim` |
| 15 | + <script type="text/javascript" src="runtime.js"></script> |
| 16 | + <script type="text/javascript" src="polyfills.js"></script> |
| 17 | + <script type="text/javascript" src="styles.js"></script> |
| 18 | + <script type="text/javascript" src="vendor.js"></script> |
| 19 | + <script type="text/javascript" src="main.js"></script> |
| 20 | + `); |
| 21 | + |
| 22 | + await ng('build', `--es5BrowserSupport`); |
| 23 | + await expectFileToMatch('dist/test-project/es2015-polyfills.js', 'core-js'); |
| 24 | + await expectFileToMatch('dist/test-project/index.html', oneLineTrim` |
| 25 | + <script type="text/javascript" src="runtime.js"></script> |
| 26 | + <script type="text/javascript" src="es2015-polyfills.js" nomodule></script> |
| 27 | + <script type="text/javascript" src="polyfills.js"></script> |
| 28 | + <script type="text/javascript" src="styles.js"></script> |
| 29 | + <script type="text/javascript" src="vendor.js"></script> |
| 30 | + <script type="text/javascript" src="main.js"></script> |
| 31 | + `); |
| 32 | +} |
0 commit comments