Skip to content

Commit fa8debc

Browse files
committed
fix(test-utils): Use npx to run Spotlight in test apps
Test apps are copied to a temp directory during CI, so they don't have access to the root's node_modules where @spotlightjs/spotlight is installed. Using npx will use the installed version if available or download it if needed, working regardless of the package manager.
1 parent 51262cf commit fa8debc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

dev-packages/test-utils/src/spotlight.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ export async function startSpotlight(options: SpotlightOptions = {}): Promise<Sp
4848
const { port = 0, cwd = process.cwd(), debug = false } = options;
4949

5050
return new Promise((resolve, reject) => {
51-
const args = ['spotlight', 'run', '-f', 'json'];
51+
// Use npx to run Spotlight - works regardless of package manager
52+
// and will use the installed version or download if needed
53+
const args = ['--yes', '@spotlightjs/spotlight', 'run', '-f', 'json'];
5254

5355
if (port !== 0) {
5456
args.push('-p', String(port));
@@ -58,7 +60,7 @@ export async function startSpotlight(options: SpotlightOptions = {}): Promise<Sp
5860
args.push('-d');
5961
}
6062

61-
const spotlightProcess = spawn('yarn', args, {
63+
const spotlightProcess = spawn('npx', args, {
6264
cwd,
6365
stdio: ['ignore', 'pipe', 'pipe'],
6466
});

0 commit comments

Comments
 (0)