-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
vitest.config.usvg.ts
33 lines (31 loc) · 1.12 KB
/
vitest.config.usvg.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
import {basename} from 'path';
import {readFileSync} from 'fs';
import virtual from '@rollup/plugin-virtual';
import {globSync} from 'glob';
import {mergeConfig, defineConfig} from 'vitest/config';
import baseConfig from './vitest.config.base';
import {ignores} from './test/usvg/ignores';
// base64 encoded PNG fixtures
const fixtures = globSync('./test/usvg/test-suite/*.png').reduce((acc, pngPath) => {
const name = basename(pngPath, '.png');
const base64Data = readFileSync(pngPath, 'base64');
acc[name] = base64Data;
return acc;
}, {});
export default mergeConfig(baseConfig, defineConfig({
test: {
retry: 0,
include: ['./test/usvg/*.test.ts'],
setupFiles: ['./test/usvg/setup.ts'],
reporters: process.env.CI ?
[['junit', {outputFile: './test/usvg/test-results.xml'}], ['basic']] :
['basic'],
},
plugins: [
virtual({
'virtual:usvg-fixtures': `export const fixtures = ${JSON.stringify(fixtures)}; export const ignores = ${JSON.stringify(ignores)}`
})
],
// For msw mock worker
publicDir: './test/usvg/mock-worker'
}));