Skip to content

Commit

Permalink
Cover case when no app script is used
Browse files Browse the repository at this point in the history
  • Loading branch information
simonihmig committed May 27, 2024
1 parent c670b4d commit 730270c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/ember-auto-import/ts/inserter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -525,12 +525,13 @@ function traverse(node: parse5.ParentNode, fn: (elt: parse5.Element) => void) {

function useTestTargets(targets: Targets): Targets {
const tests = targets.scripts.find((t) => t.bundleName === 'tests');
const hasApp = targets.scripts.some((t) => t.bundleName === 'app');
return {
scripts: targets.scripts.map((target) => {
if (target.bundleName === 'app') {
return { ...target, scriptChunks: tests!.scriptChunks };
} else if (target.bundleName === 'tests') {
return { ...target, scriptChunks: [] };
return { ...target, scriptChunks: hasApp ? [] : tests!.scriptChunks };
} else {
return target;
}
Expand Down

0 comments on commit 730270c

Please sign in to comment.