Skip to content

Commit

Permalink
fix test script
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklx committed Apr 15, 2024
1 parent 6030d06 commit 51cc907
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions tests/app-template/scripts/run-tests.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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(
Expand Down Expand Up @@ -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;
}
Expand Down
8 changes: 5 additions & 3 deletions tests/vite-app/scripts/run-tests.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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(
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 51cc907

Please sign in to comment.