From 4e0f6f4b3388f57bd65d34f91444830b8152b4cd Mon Sep 17 00:00:00 2001 From: MrBBot Date: Thu, 21 Mar 2024 14:39:07 +0000 Subject: [PATCH] fix: ensure `tsc-all.mjs` can run on Windows (#5302) --- .../vitest-pool-workers-examples/tsc-all.mjs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/fixtures/vitest-pool-workers-examples/tsc-all.mjs b/fixtures/vitest-pool-workers-examples/tsc-all.mjs index b1358bbf4bbd..c6bec734e716 100644 --- a/fixtures/vitest-pool-workers-examples/tsc-all.mjs +++ b/fixtures/vitest-pool-workers-examples/tsc-all.mjs @@ -1,3 +1,4 @@ +import assert from "node:assert"; import childProcess from "node:child_process"; import fs from "node:fs/promises"; import path from "node:path"; @@ -15,12 +16,17 @@ async function* walkTsConfigs(rootPath) { } } +assert( + process.env.PATH?.includes(path.join(__dirname, "node_modules/.bin")), + "Expected `tsc-all.mjs` to be run with `pnpm check:type`" +); + for await (const tsconfigPath of walkTsConfigs(__dirname)) { console.log(`Checking ${path.relative(__dirname, tsconfigPath)}...`); - const result = childProcess.spawnSync( - "node_modules/.bin/tsc", - ["-p", tsconfigPath], - { stdio: "inherit", cwd: __dirname, shell: true } - ); + const result = childProcess.spawnSync("tsc", ["-p", tsconfigPath], { + stdio: "inherit", + cwd: __dirname, + shell: true, + }); if (result.status !== 0) process.exitCode = 1; }