forked from vitest-dev/vitest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runner.test.ts
34 lines (31 loc) · 812 Bytes
/
runner.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { resolve } from 'pathe'
import fg from 'fast-glob'
import { execa } from 'execa'
import { describe, expect, it } from 'vitest'
describe('should fails', () => {
const root = resolve(__dirname, '../fixtures')
const files = fg.sync('*.test.ts', { cwd: root })
for (const file of files) {
it(file, async() => {
let error: any
await execa('npx', ['vitest', 'run', file], {
cwd: root,
env: {
...process.env,
CI: 'true',
NO_COLOR: 'true',
},
})
.catch((e) => {
error = e
})
expect(error).toBeTruthy()
const msg = String(error)
.split(/\n/g)
.reverse()
.find(i => i.includes('Error: '))
?.trim()
expect(msg).toMatchSnapshot(file)
}, 10000)
}
})