From 730270c196defb86b0cf04c6fdf2ff6a65764b3a Mon Sep 17 00:00:00 2001 From: Simon Ihmig Date: Mon, 27 May 2024 20:41:06 +0200 Subject: [PATCH] Cover case when no app script is used --- packages/ember-auto-import/ts/inserter.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/ember-auto-import/ts/inserter.ts b/packages/ember-auto-import/ts/inserter.ts index c23bce19..c4aec28a 100644 --- a/packages/ember-auto-import/ts/inserter.ts +++ b/packages/ember-auto-import/ts/inserter.ts @@ -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; }