diff --git a/tests/bug-3668-workflow-runtime-resolution.test.cjs b/tests/bug-3668-workflow-runtime-resolution.test.cjs index c709fabfd..db4202fac 100644 --- a/tests/bug-3668-workflow-runtime-resolution.test.cjs +++ b/tests/bug-3668-workflow-runtime-resolution.test.cjs @@ -18,7 +18,7 @@ const WORKFLOW_PATH = path.join(__dirname, '..', 'get-shit-done', 'workflows', ' function extractResolverSnippet() { const content = fs.readFileSync(WORKFLOW_PATH, 'utf8'); - const lines = content.split('\n'); + const lines = content.split(/\r?\n/); const start = lines.findIndex((line) => line.includes('SDK resolution: prefer local gsd-tools.cjs')); assert.notEqual(start, -1, 'next.md must contain the SDK resolution snippet'); @@ -39,7 +39,7 @@ function runResolver({ cwd, runtimeDir, pathDir }) { '$GSD_SDK query state.json', ].join('\n'); - return execFileSync('bash', ['-lc', script], { + return execFileSync('bash', ['-c', script], { cwd, env: { ...process.env, @@ -65,7 +65,10 @@ describe('bug-3668: workflow SDK resolver supports installed user projects', () const output = runResolver({ cwd: project, pathDir: bin }); - assert.match(output, new RegExp(`GSD_TOOLS=${path.join(bin, 'gsd-tools').replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}`)); + // Normalize separators so the assertion works on Windows (Git bash emits POSIX paths) + const norm = output.replace(/\\/g, '/'); + // subtest 1: the resolved bin is the PATH-fallback gsd-tools (suffix /bin/gsd-tools, no .cjs) + assert.match(norm, /GSD_TOOLS=\S*\/bin\/gsd-tools(?:\s|$)/m); assert.match(output, /installed:query state\.json/); }); @@ -83,7 +86,10 @@ describe('bug-3668: workflow SDK resolver supports installed user projects', () const output = runResolver({ cwd: project, runtimeDir: runtime, pathDir: pathBin }); - assert.match(output, new RegExp(`GSD_TOOLS=${path.join(runtime, 'get-shit-done', 'bin', 'gsd-tools.cjs').replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}`)); + // Normalize separators so the assertion works on Windows (Git bash emits POSIX paths) + const norm = output.replace(/\\/g, '/'); + // subtest 2: the resolved bin is the RUNTIME_DIR local runtime (suffix /get-shit-done/bin/gsd-tools.cjs) + assert.match(norm, /GSD_TOOLS=\S*\/get-shit-done\/bin\/gsd-tools\.cjs(?:\s|$)/m); assert.match(output, /runtime:query state\.json/); assert.doesNotMatch(output, /installed:query state\.json/); });