From ccc722985d7d2df08d738b45f7c790efa088d6f7 Mon Sep 17 00:00:00 2001 From: Noah Schatz Date: Sat, 28 Nov 2026 22:58:44 -0500 Subject: [PATCH 1/2] build(deps): take @cosyte/script-utils 0.1.17 --- package.json | 2 +- pnpm-lock.yaml | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index c71124a..b8fe626 100644 --- a/package.json +++ b/package.json @@ -148,7 +148,7 @@ "@cosyte/eslint-config": "^0.1.4", "@cosyte/prettier-config": "^0.1.2", "@cosyte/process": "^0.1.10", - "@cosyte/script-utils": "^0.1.16", + "@cosyte/script-utils": "^0.1.17", "@cosyte/synth": "^0.1.5", "@cosyte/test-utils": "^0.1.4", "@cosyte/tsconfig": "^0.1.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 09679bf..30c3597 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -41,8 +41,8 @@ importers: specifier: ^0.1.10 version: 0.1.10(@types/node@22.20.1)(postcss@8.5.32)(tsx@4.23.15)(vite@8.3.6(@types/node@22.20.1)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1))(yaml@2.9.1) '@cosyte/script-utils': - specifier: ^0.1.16 - version: 0.1.16 + specifier: ^0.1.17 + version: 0.1.17 '@cosyte/synth': specifier: ^0.1.5 version: 0.1.5(@cosyte/astm@0.1.7)(@cosyte/ccda@0.1.6)(@cosyte/deid@0.2.4(@cosyte/ccda@0.1.6)(@cosyte/dicom@0.1.13)(@cosyte/fhir@0.1.11(fast-check@4.10.2))(@cosyte/hl7@0.1.10(fast-check@4.10.2))(@cosyte/ncpdp@0.1.7)(@cosyte/x12@0.1.12(fast-check@4.10.2)))(@cosyte/fhir@0.1.11(fast-check@4.10.2))(@cosyte/hl7@0.1.10(fast-check@4.10.2))(@cosyte/ncpdp@0.1.7)(@cosyte/x12@0.1.12(fast-check@4.10.2)) @@ -57,7 +57,7 @@ importers: version: 0.1.3(tsup@9.0.0(postcss@8.5.32)(tsx@4.23.15)(typescript@5.9.3)(yaml@2.9.1)) '@cosyte/vitest-config': specifier: ^0.1.8 - version: 0.1.8(@cosyte/script-utils@0.1.16)(@stryker-mutator/core@10.1.1(@types/node@22.20.1))(@stryker-mutator/vitest-runner@10.1.1(@stryker-mutator/core@10.1.1(@types/node@22.20.1))(vitest@5.1.0))(@vitest/coverage-v8@5.1.0)(typescript@5.9.3)(vite@8.3.6(@types/node@22.20.1)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1))(vitest@5.1.0) + version: 0.1.8(@cosyte/script-utils@0.1.17)(@stryker-mutator/core@10.1.1(@types/node@22.20.1))(@stryker-mutator/vitest-runner@10.1.1(@stryker-mutator/core@10.1.1(@types/node@22.20.1))(vitest@5.1.0))(@vitest/coverage-v8@5.1.0)(typescript@5.9.3)(vite@8.3.6(@types/node@22.20.1)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1))(vitest@5.1.0) '@stryker-mutator/core': specifier: 10.1.1 version: 10.1.1(@types/node@22.20.1) @@ -512,8 +512,8 @@ packages: engines: {node: '>=22.22.2'} hasBin: true - '@cosyte/script-utils@0.1.16': - resolution: {integrity: sha512-ixZ5a1b1PBdAuc7M5J7F5CJ8rPjBu3gr/SRp25Jc7Hyxd/0Ztf57X27042JEfa14V273mVOl4/NzR7RpmyAqeQ==} + '@cosyte/script-utils@0.1.17': + resolution: {integrity: sha512-Jc4N2Z8/Q2M97M2AK9+bdgOUln8ST4xPZWM1wprQ7eekw4Tlq6zE8W+qV6WQreVRkL+DbUnh+ELvOJgcUAjz9A==} engines: {node: '>=22.14'} hasBin: true @@ -3716,7 +3716,7 @@ snapshots: - vite - yaml - '@cosyte/script-utils@0.1.16': {} + '@cosyte/script-utils@0.1.17': {} '@cosyte/synth@0.1.5(@cosyte/astm@0.1.7)(@cosyte/ccda@0.1.6)(@cosyte/deid@0.2.4(@cosyte/ccda@0.1.6)(@cosyte/dicom@0.1.13)(@cosyte/fhir@0.1.11(fast-check@4.10.2))(@cosyte/hl7@0.1.10(fast-check@4.10.2))(@cosyte/ncpdp@0.1.7)(@cosyte/x12@0.1.12(fast-check@4.10.2)))(@cosyte/fhir@0.1.11(fast-check@4.10.2))(@cosyte/hl7@0.1.10(fast-check@4.10.2))(@cosyte/ncpdp@0.1.7)(@cosyte/x12@0.1.12(fast-check@4.10.2))': optionalDependencies: @@ -3746,13 +3746,13 @@ snapshots: dependencies: tsup: 9.0.0(postcss@8.5.32)(tsx@4.23.15)(typescript@5.9.3)(yaml@2.9.1) - '@cosyte/vitest-config@0.1.8(@cosyte/script-utils@0.1.16)(@stryker-mutator/core@10.1.1(@types/node@22.20.1))(@stryker-mutator/vitest-runner@10.1.1(@stryker-mutator/core@10.1.1(@types/node@22.20.1))(vitest@5.1.0))(@vitest/coverage-v8@5.1.0)(typescript@5.9.3)(vite@8.3.6(@types/node@22.20.1)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1))(vitest@5.1.0)': + '@cosyte/vitest-config@0.1.8(@cosyte/script-utils@0.1.17)(@stryker-mutator/core@10.1.1(@types/node@22.20.1))(@stryker-mutator/vitest-runner@10.1.1(@stryker-mutator/core@10.1.1(@types/node@22.20.1))(vitest@5.1.0))(@vitest/coverage-v8@5.1.0)(typescript@5.9.3)(vite@8.3.6(@types/node@22.20.1)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1))(vitest@5.1.0)': dependencies: '@vitest/coverage-v8': 5.1.0(vitest@5.1.0) vite: 8.3.6(@types/node@22.20.1)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1) vitest: 5.1.0(@types/node@22.20.1)(@vitest/coverage-v8@5.1.0)(vite@8.3.6(@types/node@22.20.1)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1)) optionalDependencies: - '@cosyte/script-utils': 0.1.16 + '@cosyte/script-utils': 0.1.17 '@stryker-mutator/core': 10.1.1(@types/node@22.20.1) '@stryker-mutator/vitest-runner': 10.1.1(@stryker-mutator/core@10.1.1(@types/node@22.20.1))(vitest@5.1.0) typescript: 5.9.3 From 152c58363a5a66aea7b01219ab30e34dc5478292 Mon Sep 17 00:00:00 2001 From: Noah Schatz Date: Sat, 28 Nov 2026 22:58:44 -0500 Subject: [PATCH 2/2] test: start pnpm and tsx in a way Windows can run --- test/docs-content.test.ts | 8 +++++++- test/pipe-close.test.ts | 17 +++++++++++++---- vitest.config.ts | 5 +---- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/test/docs-content.test.ts b/test/docs-content.test.ts index c504a7e..14b2ec6 100644 --- a/test/docs-content.test.ts +++ b/test/docs-content.test.ts @@ -62,7 +62,13 @@ const ENTRY_POINTS: Readonly> = { const resolve = (specifier: string): string | undefined => ENTRY_POINTS[specifier]; beforeAll(() => { - execFileSync("pnpm", ["build"], { cwd: root, stdio: "inherit" }); + // Windows starts `pnpm` only through its `.cmd` launcher, so a shell runs it there. The command + // and its argument are fixed strings. + execFileSync("pnpm", ["build"], { + cwd: root, + stdio: "inherit", + shell: process.platform === "win32", + }); }, 120_000); /** The hand-written pages: every `.md` file at the top of `docs-content/`, not the generated `api/`. */ diff --git a/test/pipe-close.test.ts b/test/pipe-close.test.ts index a4989fb..20c775d 100644 --- a/test/pipe-close.test.ts +++ b/test/pipe-close.test.ts @@ -1,7 +1,8 @@ import { spawn } from "node:child_process"; -import { mkdtempSync, rmSync, writeFileSync } from "node:fs"; +import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs"; +import { createRequire } from "node:module"; import { tmpdir } from "node:os"; -import { join } from "node:path"; +import { dirname, join } from "node:path"; import { afterAll, beforeAll, describe, expect, it } from "vitest"; @@ -58,7 +59,15 @@ import { EXIT } from "../src/core/exit-codes.js"; const SLOW_MS = 60_000; const REPO_ROOT = process.cwd(); -const TSX_BIN = join(REPO_ROOT, "node_modules", ".bin", "tsx"); +/** + * The entry `tsx` declares in its own `package.json`, run with this Node. Starting + * `node_modules/.bin/tsx` instead needs a shell on Windows, where that name is a `.cmd` launcher. + */ +const TSX_MANIFEST = createRequire(import.meta.url).resolve("tsx/package.json"); +const TSX_CLI = join( + dirname(TSX_MANIFEST), + (JSON.parse(readFileSync(TSX_MANIFEST, "utf8")) as { bin: string }).bin, +); const COSYTE = join(REPO_ROOT, "src", "bin", "cosyte.ts"); const COSYTE_MCP = join(REPO_ROOT, "src", "bin", "cosyte-mcp.ts"); @@ -138,7 +147,7 @@ function spawnBin(argv: readonly string[], options: Options = {}): Promise((resolve) => { // Every stream is a pipe so this helper owns all three ends. Nothing reads the child's stdin // unless a case supplies bytes for it, and it is released once the process is gone. - const child = spawn(TSX_BIN, [...argv], { + const child = spawn(process.execPath, [TSX_CLI, ...argv], { cwd: REPO_ROOT, shell: false, stdio: ["pipe", "pipe", "pipe"], diff --git a/vitest.config.ts b/vitest.config.ts index e3f8195..655260b 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -54,15 +54,12 @@ const DENO_EXCLUDES: readonly string[] = [ * (`.cmd` launchers). What they test runs on Linux and macOS in CI, and the library API and both * bins' code paths run on Windows in every other file. * - * - `test/pipe-close.test.ts`: it starts each bin through `node_modules/.bin/tsx` and closes its - * stdout, to prove how the Node process exits. * - `test/release-install-gate.test.ts`: it runs the release install gate, which packs with pnpm * and installs with npm, a step that runs on Linux in the release workflow. - * - `test/docs-content.test.ts`: it runs a bare `pnpm build`, and its shell samples run under bash. + * - `test/docs-content.test.ts`: its shell samples run under bash. * - `test/docs-standard.test.ts`: it starts `node_modules/.bin/cosyte-docs-content` directly. */ const WINDOWS_EXCLUDES: readonly string[] = [ - "test/pipe-close.test.ts", "test/release-install-gate.test.ts", "test/docs-content.test.ts", "test/docs-standard.test.ts",