Skip to content

Commit

Permalink
fix debuglog test to work on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
mceachen committed Jan 9, 2025
1 parent edd5539 commit a08cf0a
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions src/debuglog.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { spawnSync } from "node:child_process";
import { execFileSync } from "node:child_process";
import { join } from "node:path";
import { env } from "node:process";
import { _dirname } from "./dirname";
Expand All @@ -11,21 +11,15 @@ describe("debuglog integration tests", () => {
if (nodeDebug != null) {
childEnv["NODE_DEBUG"] = nodeDebug;
}
const result = spawnSync(
"npx",
["tsx", join(_dirname(), "test-utils", "debuglog-child.ts")],
{
env: childEnv,
encoding: "utf8",
},
);

if (result.error) throw result.error;
if (result.status !== 0) {
throw new Error(`Child process failed: ${result.stderr}`);
}
const script = join(_dirname(), "test-utils", "debuglog-child.ts");

const result = execFileSync(process.execPath, ["--import=tsx", script], {
env: childEnv,
encoding: "utf8",
});

return JSON.parse(result.stdout);
return JSON.parse(result);
}

test("uses fs-metadata when NODE_DEBUG=fs-metadata", () => {
Expand Down

0 comments on commit a08cf0a

Please sign in to comment.