mirror of
https://github.com/tiennm99/ccs.git
synced 2026-08-15 18:23:12 +00:00
test(ci): use runtime-relative isolated child scripts
- derive repo imports from each test file via file URLs - avoid hardcoded paths in the repo - launch child scripts with the current runtime for consistent local and runner behavior
This commit is contained in:
@@ -55,7 +55,7 @@ function runSessionTrackerScenario(
|
|||||||
const scriptPath = path.join(tempHome, `session-target-child-${Date.now()}.mjs`);
|
const scriptPath = path.join(tempHome, `session-target-child-${Date.now()}.mjs`);
|
||||||
fs.writeFileSync(scriptPath, script, 'utf8');
|
fs.writeFileSync(scriptPath, script, 'utf8');
|
||||||
|
|
||||||
const result = spawnSync('/bin/bash', ['-lc', `bun ${JSON.stringify(scriptPath)}`], {
|
const result = spawnSync(process.execPath, [scriptPath], {
|
||||||
cwd: REPO_ROOT,
|
cwd: REPO_ROOT,
|
||||||
env: {
|
env: {
|
||||||
...process.env,
|
...process.env,
|
||||||
@@ -69,7 +69,7 @@ function runSessionTrackerScenario(
|
|||||||
if (result.status !== 0) {
|
if (result.status !== 0) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`child session-tracker scenario failed: ${JSON.stringify({
|
`child session-tracker scenario failed: ${JSON.stringify({
|
||||||
command: `bun ${scriptPath}`,
|
command: `${process.execPath} ${scriptPath}`,
|
||||||
status: result.status,
|
status: result.status,
|
||||||
signal: result.signal,
|
signal: result.signal,
|
||||||
error: result.error?.message ?? null,
|
error: result.error?.message ?? null,
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ function runTokensCommandInChild(tempHome: string, args: string[]) {
|
|||||||
const scriptPath = path.join(tempHome, `tokens-child-${Date.now()}.mjs`);
|
const scriptPath = path.join(tempHome, `tokens-child-${Date.now()}.mjs`);
|
||||||
fs.writeFileSync(scriptPath, script, 'utf8');
|
fs.writeFileSync(scriptPath, script, 'utf8');
|
||||||
|
|
||||||
const result = spawnSync('/bin/bash', ['-lc', `bun ${JSON.stringify(scriptPath)}`], {
|
const result = spawnSync(process.execPath, [scriptPath], {
|
||||||
cwd: REPO_ROOT,
|
cwd: REPO_ROOT,
|
||||||
env: {
|
env: {
|
||||||
...process.env,
|
...process.env,
|
||||||
@@ -60,7 +60,7 @@ function runTokensCommandInChild(tempHome: string, args: string[]) {
|
|||||||
if (result.status !== 0) {
|
if (result.status !== 0) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`child tokens command failed: ${JSON.stringify({
|
`child tokens command failed: ${JSON.stringify({
|
||||||
command: `bun ${scriptPath}`,
|
command: `${process.execPath} ${scriptPath}`,
|
||||||
status: result.status,
|
status: result.status,
|
||||||
signal: result.signal,
|
signal: result.signal,
|
||||||
error: result.error?.message ?? null,
|
error: result.error?.message ?? null,
|
||||||
|
|||||||
Reference in New Issue
Block a user