Skip to content

Commit 452c3ba

Browse files
Fix Windows path escaping in Vitest config for fast-check alias
Use JSON.stringify to properly escape backslashes in the fast-check source path when writing the Vitest config file. On Windows, path.join produces backslashes which were interpreted as escape characters in the JS string literal, causing 'Cannot find package fast-check' errors. Co-authored-by: Nicolas DUBIEN <[email protected]>
1 parent 3688607 commit 452c3ba

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

website/docs/tutorials/detect-race-conditions/snippets.spec.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ describe('Playground', () => {
8282
await fs.writeFile(
8383
vitestConfigPath,
8484
`import { defineConfig } from 'vitest/config';\n` +
85-
`export default defineConfig({ test: { include: ['queue.spec.mjs'] }, resolve: { alias: { 'fast-check': '${fastCheckSourcePath}' } } });`,
85+
`export default defineConfig({ test: { include: ['queue.spec.mjs'] }, resolve: { alias: { 'fast-check': ${JSON.stringify(fastCheckSourcePath)} } } });`,
8686
);
8787
const specOutput = await runVitest(testDirectoryPath);
8888
if (expectedSuccess) {

0 commit comments

Comments
 (0)