Skip to content

Commit 816b1a8

Browse files
test: Fix missing lazy modules resulting in test failures
1 parent 0d4e2bc commit 816b1a8

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

packages/angular/build/src/builders/application/tests/options/subresource-integrity_spec.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
126126
});
127127

128128
it(`places the importmap before any module script tag`, async () => {
129+
await harness.writeFiles(lazyModuleFiles);
130+
await harness.writeFiles(lazyModuleFnImport);
131+
129132
harness.useTarget('build', {
130133
...BASE_OPTIONS,
131134
subresourceIntegrity: true,
@@ -136,7 +139,9 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
136139

137140
const indexHtml = harness.readFile('dist/browser/index.html');
138141
const importmapIdx = indexHtml.indexOf('<script type="importmap">');
139-
const moduleScriptIdx = indexHtml.indexOf('<script src=');
142+
const moduleScriptMatch = indexHtml.match(/<script[^>]*type="module"[^>]*>/);
143+
const moduleScriptIdx = moduleScriptMatch ? moduleScriptMatch.index ?? -1 : -1;
144+
140145
expect(importmapIdx).toBeGreaterThanOrEqual(0);
141146
expect(moduleScriptIdx).toBeGreaterThanOrEqual(0);
142147
expect(importmapIdx)

0 commit comments

Comments
 (0)