diff --git a/tests/docs-integrity.test.ts b/tests/docs-integrity.test.ts index 2236e59..ac28e0e 100644 --- a/tests/docs-integrity.test.ts +++ b/tests/docs-integrity.test.ts @@ -23,7 +23,8 @@ function markdownFiles(): string[] { } else if (name.name.endsWith('.md')) { // eval/ holds huge run logs; only its READMEs are prose worth link-checking. if (opts.onlyReadme && name.name !== 'README.md') continue; - out.push(childRel); + // Forward slashes so assertions and anchorsByFile keys match on Windows. + out.push(childRel.replace(/\\/g, '/')); } } }; diff --git a/tests/export-git-e2e.test.ts b/tests/export-git-e2e.test.ts index babd449..0edeaaf 100644 --- a/tests/export-git-e2e.test.ts +++ b/tests/export-git-e2e.test.ts @@ -10,7 +10,9 @@ import { fileURLToPath } from 'node:url'; // Runs the actual CLI via tsx against a throwaway git repo and asserts the // untracked-file filtering. Kept in its own file because it spawns a subprocess. const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..'); -const tsxBin = path.join(repoRoot, 'node_modules', '.bin', 'tsx'); +// tsx's JS entry, run via process.execPath: the .bin/tsx shim is a .cmd on +// Windows, which spawnSync can't execute without a shell. +const tsxCli = path.join(repoRoot, 'node_modules', 'tsx', 'dist', 'cli.mjs'); function git(cwd: string, args: string[]): void { const r = spawnSync('git', args, { cwd, encoding: 'utf8' }); @@ -43,8 +45,8 @@ describe('pxpipe export --git (end-to-end)', () => { it('applies --include, the size cap, and the binary sniff to untracked files', () => { const run = spawnSync( - tsxBin, - ['src/node.ts', 'export', '--git', repo, '--include', '*.ts', '--out', outDir, '--json'], + process.execPath, + [tsxCli, 'src/node.ts', 'export', '--git', repo, '--include', '*.ts', '--out', outDir, '--json'], { cwd: repoRoot, encoding: 'utf8', timeout: 120_000 }, ); expect(run.status, `stderr:\n${run.stderr}`).toBe(0); diff --git a/vitest.config.ts b/vitest.config.ts index a7b13d6..a25ed31 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -1,12 +1,11 @@ import { defineConfig } from 'vitest/config'; -const TEST_FILE_PATTERNS = ['tests/**/*.test.ts']; -const TEST_TIMEOUT_MS = 30_000; - export default defineConfig({ test: { - include: TEST_FILE_PATTERNS, + include: ['tests/**/*.test.ts'], environment: 'node', - testTimeout: TEST_TIMEOUT_MS, + // Render-heavy tests (full-page PNG encodes) can exceed the 5s default on + // slower machines; the work is CPU-bound, not hung. + testTimeout: 30_000, }, });