diff --git a/test/config/fixtures/exec-args-fixtures/vmThreads.test.ts b/test/config/fixtures/exec-args-fixtures/vmThreads.test.ts index 04ee85f6e2fe..a46128448935 100644 --- a/test/config/fixtures/exec-args-fixtures/vmThreads.test.ts +++ b/test/config/fixtures/exec-args-fixtures/vmThreads.test.ts @@ -2,14 +2,15 @@ import { describe, expect, it } from 'vitest' describe('exec-args', async () => { it('should have the correct flags', () => { - expect(process.execArgv).toContain('--inspect-brk') + const execArgv = process.execArgv.map((arg) => arg.replace(/\\/g, '/')) + expect(execArgv).toContain('--inspect-brk') // added via vitest - expect(process.execArgv).toContain('--experimental-import-meta-resolve') - expect(process.execArgv).toContain('--experimental-vm-modules') - expect(process.execArgv).toContain('--require') - expect(process.execArgv).toContainEqual(expect.stringContaining('/packages/vitest/suppress-warnings.cjs')) - expect(process.execArgv).toContain('--conditions') - expect(process.execArgv).toContain('node') + expect(execArgv).toContain('--experimental-import-meta-resolve') + expect(execArgv).toContain('--experimental-vm-modules') + expect(execArgv).toContain('--require') + expect(execArgv).toContainEqual(expect.stringContaining('/packages/vitest/suppress-warnings.cjs')) + expect(execArgv).toContain('--conditions') + expect(execArgv).toContain('node') }) }) diff --git a/test/dts-fixture/package.json b/test/dts-fixture/package.json index 265568018441..8824f2d03661 100644 --- a/test/dts-fixture/package.json +++ b/test/dts-fixture/package.json @@ -3,7 +3,7 @@ "type": "module", "private": true, "scripts": { - "build": "rm -rf dist && tsc -p tsconfig.json", + "build": "rimraf dist && tsc -p tsconfig.json", "check": "tsc -p tsconfig.check.json", "test": "pnpm build && pnpm check" }, diff --git a/test/snapshots/generate.mjs b/test/snapshots/generate.mjs new file mode 100644 index 000000000000..71ea91c3722e --- /dev/null +++ b/test/snapshots/generate.mjs @@ -0,0 +1,10 @@ +import { cpSync, mkdirSync, rmSync } from 'node:fs' +import { dirname, resolve } from 'node:path' +import { fileURLToPath } from 'node:url' + +const snapshots = dirname(fileURLToPath(import.meta.url)) +const dest = resolve(snapshots, 'test-update') + +rmSync(dest, { recursive: true, force: true }) +mkdirSync(dest) +cpSync(resolve(snapshots, './test/fixtures/test-update'), dest, { recursive: true }) diff --git a/test/snapshots/package.json b/test/snapshots/package.json index a5b783fedc9a..0e54f05c0690 100644 --- a/test/snapshots/package.json +++ b/test/snapshots/package.json @@ -4,7 +4,7 @@ "private": true, "scripts": { "test": "pnpm run test:generate && pnpm run test:update && pnpm test:update-new && pnpm test:update-none && pnpm run test:snaps", - "test:generate": "rm -rf ./test-update && cp -r ./test/fixtures/test-update ./test-update", + "test:generate": "node ./generate.mjs", "test:snaps": "vitest run --dir test", "test:update": "vitest run -u --dir test-update", "test:update-none": "CI=true vitest run --dir test-update",