Skip to content

Commit a2ec2d4

Browse files
Fix Windows compatibility in tier-check client conformance (#168)
* Fix Windows compatibility in tier-check client conformance Two issues prevented client conformance tests from running on Windows: 1. Single-quote quoting in execSync: The --command argument was wrapped in single quotes, which cmd.exe treats as literal characters rather than string delimiters. This caused the CLI to receive only the first word of the command. Switched to execFileSync with an args array to bypass shell quoting entirely. 2. Backslash path separators in parseOutputDir: dirname() on Windows returns auth\scenario-name but reconcileWithExpected compares against auth/scenario-name, causing auth scenarios to be double-counted. Normalize backslashes to forward slashes in parsed scenario names. * fix: use process.argv[1] for CLI path in subprocess calls Combines the npx-compatibility fix from #175 with this PR's execFileSync approach. process.argv[1] resolves to the absolute path of the running CLI regardless of working directory, so tier-check works when invoked via npx or from any cwd. --------- Co-authored-by: Paul Carleton <paulc@anthropic.com>
1 parent e702a25 commit a2ec2d4

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

src/tier-check/checks/test-conformance-results.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { execSync } from 'child_process';
1+
import { execFileSync } from 'child_process';
22
import { mkdtempSync, readFileSync, existsSync, globSync } from 'fs';
33
import { join, dirname } from 'path';
44
import { tmpdir } from 'os';
@@ -43,7 +43,7 @@ function parseOutputDir(outputDir: string): ConformanceResult {
4343
const checksFiles = globSync('**/checks.json', { cwd: outputDir });
4444

4545
for (const checksFile of checksFiles) {
46-
const scenarioName = dirname(checksFile);
46+
const scenarioName = dirname(checksFile).replace(/\\/g, '/');
4747
const checksPath = join(outputDir, checksFile);
4848

4949
try {
@@ -181,8 +181,9 @@ export async function checkConformance(options: {
181181
const outputDir = mkdtempSync(join(tmpdir(), 'tier-check-server-'));
182182

183183
try {
184-
execSync(
185-
`node "${process.argv[1]}" server --url ${options.serverUrl} -o ${outputDir}`,
184+
execFileSync(
185+
process.execPath,
186+
[process.argv[1], 'server', '--url', options.serverUrl, '-o', outputDir],
186187
{
187188
stdio: ['pipe', 'pipe', 'pipe'],
188189
timeout: 120_000
@@ -220,8 +221,18 @@ export async function checkClientConformance(options: {
220221
const outputDir = mkdtempSync(join(tmpdir(), 'tier-check-client-'));
221222

222223
try {
223-
execSync(
224-
`node "${process.argv[1]}" client --command '${options.clientCmd}' --suite all -o ${outputDir}`,
224+
execFileSync(
225+
process.execPath,
226+
[
227+
process.argv[1],
228+
'client',
229+
'--command',
230+
options.clientCmd,
231+
'--suite',
232+
'all',
233+
'-o',
234+
outputDir
235+
],
225236
{
226237
stdio: ['pipe', 'pipe', 'pipe'],
227238
timeout: 120_000

0 commit comments

Comments
 (0)