|
| 1 | +import * as fs from 'fs'; |
1 | 2 | import { ng } from '../../utils/process';
|
2 | 3 | import {
|
3 | 4 | expectFileToMatch,
|
4 | 5 | expectFileToExist,
|
| 6 | + expectFileMatchToExist, |
5 | 7 | writeMultipleFiles
|
6 | 8 | } from '../../utils/fs';
|
7 | 9 | import { expectToFail } from '../../utils/utils';
|
@@ -33,24 +35,27 @@ export default function () {
|
33 | 35 | .then(() => ng('build', '--extract-css', '--aot'))
|
34 | 36 | // Check paths are correctly generated.
|
35 | 37 | .then(() => expectFileToMatch('dist/styles.bundle.css',
|
36 |
| - `url\('\/assets\/global-img-absolute\.svg'\)`)) |
37 |
| - .then(() => expectFileToMatch('dist/styles.bundle.css', 'url\(global-img-relative.svg\)')) |
| 38 | + /url\('\/assets\/global-img-absolute\.svg'\)/)) |
| 39 | + .then(() => expectFileToMatch('dist/styles.bundle.css', |
| 40 | + /url\(global-img-relative\.[0-9a-f]{20}\.svg\)/)) |
| 41 | + .then(() => expectFileToMatch('dist/main.bundle.js', |
| 42 | + /url\(\\'\/assets\/component-img-absolute\.svg\\'\)/)) |
38 | 43 | .then(() => expectFileToMatch('dist/main.bundle.js',
|
39 |
| - `url\(\\'\/assets\/component-img-absolute\.svg\\'\)`)) |
40 |
| - .then(() => expectFileToMatch('dist/main.bundle.js', 'url\(component-img-relative\.svg\)')) |
| 44 | + /url\(component-img-relative\.[0-9a-f]{20}\.svg\)/)) |
41 | 45 | // Check files are correctly created.
|
42 | 46 | .then(() => expectToFail(() => expectFileToExist('dist/global-img-absolute.svg')))
|
43 |
| - .then(() => expectFileToExist('dist/global-img-relative.svg')) |
44 | 47 | .then(() => expectToFail(() => expectFileToExist('dist/component-img-absolute.svg')))
|
45 |
| - .then(() => expectFileToExist('dist/component-img-relative.svg')) |
| 48 | + .then(() => expectFileMatchToExist('./dist', /global-img-relative\.[0-9a-f]{20}\.svg/)) |
| 49 | + .then(() => expectFileMatchToExist('./dist', /component-img-relative\.[0-9a-f]{20}\.svg/)) |
46 | 50 | // Also check with base-href and deploy-url flags.
|
47 | 51 | .then(() => ng('build', '--base-href=/base/', '--deploy-url=deploy/',
|
48 | 52 | '--extract-css', '--aot'))
|
49 | 53 | .then(() => expectFileToMatch('dist/styles.bundle.css',
|
50 |
| - `url\('\/base\/deploy\/assets\/global-img-absolute\.svg'\)`)) |
51 |
| - .then(() => expectFileToMatch('dist/styles.bundle.css', 'url\(global-img-relative.svg\)')) |
| 54 | + /url\('\/base\/deploy\/assets\/global-img-absolute\.svg'\)/)) |
| 55 | + .then(() => expectFileToMatch('dist/styles.bundle.css', |
| 56 | + /url\(global-img-relative\.[0-9a-f]{20}\.svg\)/)) |
52 | 57 | .then(() => expectFileToMatch('dist/main.bundle.js',
|
53 |
| - `url\(\\'\/base\/deploy\/assets\/component-img-absolute\.svg\\'\)`)) |
| 58 | + /url\(\\'\/base\/deploy\/assets\/component-img-absolute\.svg\\'\)/)) |
54 | 59 | .then(() => expectFileToMatch('dist/main.bundle.js',
|
55 |
| - 'url\(deploy/component-img-relative\.svg\)')); |
| 60 | + /url\(deploy\/component-img-relative\.[0-9a-f]{20}\.svg\)/)); |
56 | 61 | }
|
0 commit comments