-
Notifications
You must be signed in to change notification settings - Fork 714
/
vitest.config.ts
49 lines (45 loc) · 2.16 KB
/
vitest.config.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { resolve } from 'node:path';
import isCI from 'is-ci';
import tsconfigPaths from 'vite-tsconfig-paths';
// @ts-ignore
import { defineConfig } from 'vitest/config';
let threads: { minThreads: number; maxThreads: number } | undefined;
if (isCI) {
// eslint-disable-next-line no-console
console.log(`Running in CI, throttling threads to 1 test at a time`);
threads = { minThreads: 1, maxThreads: 1 };
}
export default defineConfig({
plugins: [tsconfigPaths()],
esbuild: {
target: 'es2022',
keepNames: true,
},
test: {
globals: true,
coverage: {
provider: 'v8',
reporter: ['text', 'lcov', 'cobertura'],
exclude: ['**/node_modules/**', '**/dist/**', '**/test/**'],
},
restoreMocks: true,
...threads,
testTimeout: 60_000,
hookTimeout: 60_000,
alias: [
{ find: 'crawlee', replacement: resolve(__dirname, './packages/crawlee/src') },
{ find: '@crawlee/basic', replacement: resolve(__dirname, './packages/basic-crawler/src') },
{ find: '@crawlee/browser', replacement: resolve(__dirname, './packages/browser-crawler/src') },
{ find: '@crawlee/http', replacement: resolve(__dirname, './packages/http-crawler/src') },
{ find: '@crawlee/linkedom', replacement: resolve(__dirname, './packages/linkedom-crawler/src') },
{ find: '@crawlee/jsdom', replacement: resolve(__dirname, './packages/jsdom-crawler/src') },
{ find: '@crawlee/cheerio', replacement: resolve(__dirname, './packages/cheerio-crawler/src') },
{ find: '@crawlee/playwright', replacement: resolve(__dirname, './packages/playwright-crawler/src') },
{ find: '@crawlee/puppeteer', replacement: resolve(__dirname, './packages/puppeteer-crawler/src') },
{ find: /^@crawlee\/(.*)\/(.*)$/, replacement: resolve(__dirname, './packages/$1/$2') },
{ find: /^@crawlee\/(.*)$/, replacement: resolve(__dirname, './packages/$1/src') },
{ find: /^test\/(.*)$/, replacement: resolve(__dirname, './test/$1') },
],
retry: process.env.RETRY_TESTS ? 3 : 0,
},
});