mirror of
https://github.com/teamchong/pxpipe.git
synced 2026-07-22 02:02:51 +02:00
fix(tests): Windows compatibility for docs-integrity, export-git e2e, and slow-machine timeouts (#52)
- docs-integrity: normalize walker paths to forward slashes so keys match on Windows - export-git-e2e: run tsx's JS entry via node instead of the .bin/.cmd shim (same pattern as #63) - vitest: 30s testTimeout for CPU-bound PNG-render tests on slower machines (build.mjs portion of the original branch dropped — superseded by #63)
This commit is contained in:
@@ -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, '/'));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
|
||||
+4
-5
@@ -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,
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user