|
1 | 1 | import { statSync } from 'fs';
|
2 | 2 | import { join } from 'path';
|
| 3 | +import { getGlobalVariable } from '../../utils/env'; |
3 | 4 | import { expectFileToExist, expectFileToMatch, readFile } from '../../utils/fs';
|
4 | 5 | import { noSilentNg } from '../../utils/process';
|
5 | 6 |
|
@@ -32,12 +33,15 @@ export default async function () {
|
32 | 33 | await noSilentNg('build');
|
33 | 34 | await expectFileToExist(join(process.cwd(), 'dist'));
|
34 | 35 | // Check for cache busting hash script src
|
35 |
| - await expectFileToMatch('dist/test-project/index.html', /main\.[0-9a-f]{16}\.js/); |
36 |
| - await expectFileToMatch('dist/test-project/index.html', /styles\.[0-9a-f]{16}\.css/); |
37 |
| - await expectFileToMatch('dist/test-project/3rdpartylicenses.txt', /MIT/); |
| 36 | + await expectFileToMatch('dist/test-project/index.html', /main\.[0-9a-zA-Z]{8,16}\.js/); |
| 37 | + await expectFileToMatch('dist/test-project/index.html', /styles\.[0-9a-zA-Z]{8,16}\.css/); |
| 38 | + if (!getGlobalVariable('argv')['esbuild']) { |
| 39 | + // EXPERIMENTAL_ESBUILD: esbuild does not yet extract license text |
| 40 | + await expectFileToMatch('dist/test-project/3rdpartylicenses.txt', /MIT/); |
| 41 | + } |
38 | 42 |
|
39 | 43 | const indexContent = await readFile('dist/test-project/index.html');
|
40 |
| - const mainPath = indexContent.match(/src="(main\.[a-z0-9]{0,32}\.js)"/)[1]; |
| 44 | + const mainPath = indexContent.match(/src="(main\.[0-9a-zA-Z]{0,32}\.js)"/)[1]; |
41 | 45 |
|
42 | 46 | // Content checks
|
43 | 47 | await expectFileToMatch(`dist/test-project/${mainPath}`, bootstrapRegExp);
|
|
0 commit comments