diff --git a/tests/app-template/scripts/run-tests.mjs b/tests/app-template/scripts/run-tests.mjs index e5bcc82173..6f90732cc9 100644 --- a/tests/app-template/scripts/run-tests.mjs +++ b/tests/app-template/scripts/run-tests.mjs @@ -66,11 +66,14 @@ async function run() { "@babel+runtime", ".css", "@embroider/macros", - "ember-source/ember/index.js" + "ember-source/ember/index.js", ]; function importerAllowedUnoptimized(importer) { // virtual modules can contain the rewritten-app location + if (allow.some((a) => url.includes(a))) { + return true; + } return !!( importer.includes("node_modules") && !importer.includes("rewritten-app") @@ -82,7 +85,6 @@ async function run() { !url.includes("rewritten-app") && !url.includes(".vite/deps") && !url.includes("embroider_virtual") && - !allow.some((a) => url.includes(a)) && !importerAllowedUnoptimized(interceptedRequest.initiator().url) ) { console.error( @@ -120,7 +122,7 @@ async function run() { await browser.close(); if (unOptimizedDeps.length) { - console.error('unoptimized deps detected'); + console.error("unoptimized deps detected"); process.exit(1); return; } diff --git a/tests/vite-app/scripts/run-tests.mjs b/tests/vite-app/scripts/run-tests.mjs index e5bcc82173..6f90732cc9 100644 --- a/tests/vite-app/scripts/run-tests.mjs +++ b/tests/vite-app/scripts/run-tests.mjs @@ -66,11 +66,14 @@ async function run() { "@babel+runtime", ".css", "@embroider/macros", - "ember-source/ember/index.js" + "ember-source/ember/index.js", ]; function importerAllowedUnoptimized(importer) { // virtual modules can contain the rewritten-app location + if (allow.some((a) => url.includes(a))) { + return true; + } return !!( importer.includes("node_modules") && !importer.includes("rewritten-app") @@ -82,7 +85,6 @@ async function run() { !url.includes("rewritten-app") && !url.includes(".vite/deps") && !url.includes("embroider_virtual") && - !allow.some((a) => url.includes(a)) && !importerAllowedUnoptimized(interceptedRequest.initiator().url) ) { console.error( @@ -120,7 +122,7 @@ async function run() { await browser.close(); if (unOptimizedDeps.length) { - console.error('unoptimized deps detected'); + console.error("unoptimized deps detected"); process.exit(1); return; }