Skip to content

Commit d4ea0b5

Browse files
authored
chore(test): fix test:ci errors on Windows (#7251)
1 parent 345d281 commit d4ea0b5

File tree

4 files changed

+20
-9
lines changed

4 files changed

+20
-9
lines changed

test/config/fixtures/exec-args-fixtures/vmThreads.test.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ import { describe, expect, it } from 'vitest'
22

33
describe('exec-args', async () => {
44
it('should have the correct flags', () => {
5-
expect(process.execArgv).toContain('--inspect-brk')
5+
const execArgv = process.execArgv.map((arg) => arg.replace(/\\/g, '/'))
6+
expect(execArgv).toContain('--inspect-brk')
67

78
// added via vitest
8-
expect(process.execArgv).toContain('--experimental-import-meta-resolve')
9-
expect(process.execArgv).toContain('--experimental-vm-modules')
10-
expect(process.execArgv).toContain('--require')
11-
expect(process.execArgv).toContainEqual(expect.stringContaining('/packages/vitest/suppress-warnings.cjs'))
12-
expect(process.execArgv).toContain('--conditions')
13-
expect(process.execArgv).toContain('node')
9+
expect(execArgv).toContain('--experimental-import-meta-resolve')
10+
expect(execArgv).toContain('--experimental-vm-modules')
11+
expect(execArgv).toContain('--require')
12+
expect(execArgv).toContainEqual(expect.stringContaining('/packages/vitest/suppress-warnings.cjs'))
13+
expect(execArgv).toContain('--conditions')
14+
expect(execArgv).toContain('node')
1415
})
1516
})

test/dts-fixture/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "module",
44
"private": true,
55
"scripts": {
6-
"build": "rm -rf dist && tsc -p tsconfig.json",
6+
"build": "rimraf dist && tsc -p tsconfig.json",
77
"check": "tsc -p tsconfig.check.json",
88
"test": "pnpm build && pnpm check"
99
},

test/snapshots/generate.mjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { cpSync, mkdirSync, rmSync } from 'node:fs'
2+
import { dirname, resolve } from 'node:path'
3+
import { fileURLToPath } from 'node:url'
4+
5+
const snapshots = dirname(fileURLToPath(import.meta.url))
6+
const dest = resolve(snapshots, 'test-update')
7+
8+
rmSync(dest, { recursive: true, force: true })
9+
mkdirSync(dest)
10+
cpSync(resolve(snapshots, './test/fixtures/test-update'), dest, { recursive: true })

test/snapshots/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"scripts": {
66
"test": "pnpm run test:generate && pnpm run test:update && pnpm test:update-new && pnpm test:update-none && pnpm run test:snaps",
7-
"test:generate": "rm -rf ./test-update && cp -r ./test/fixtures/test-update ./test-update",
7+
"test:generate": "node ./generate.mjs",
88
"test:snaps": "vitest run --dir test",
99
"test:update": "vitest run -u --dir test-update",
1010
"test:update-none": "CI=true vitest run --dir test-update",

0 commit comments

Comments
 (0)