aboutsummaryrefslogtreecommitdiff
path: root/vitest.config.ts
blob: 24a9cda3c6f6eb15fd68b137366eb8e068f5162b (plain)
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 { defineConfig } from 'vitest/config';
import { CI_PREFLIGHT } from './scripts/env';

const VITEST_SEQUENCE_SEED = Date.now();

console.log('VITEST_SEQUENCE_SEED', VITEST_SEQUENCE_SEED);

// https://vitejs.dev/config/
export default defineConfig({
  test: {
    setupFiles: ['test/setup.ts'],
    include: ['test/**/*.spec.ts'],
    exclude: ['test/integration/**/*.spec.ts'],
    coverage: {
      all: true,
      provider: 'v8',
      reporter: ['clover', 'cobertura', 'lcov', 'text'],
      include: ['src'],
    },
    reporters: CI_PREFLIGHT ? ['basic', 'github-actions'] : ['basic'],
    sequence: {
      seed: VITEST_SEQUENCE_SEED,
      shuffle: true,
    },
    onStackTrace(_, { file }) {
      if (
        file.includes('/src/internal/locale-proxy') ||
        file.includes('/test/support/')
      ) {
        return false;
      }

      return true;
    },
    typecheck: {
      enabled: true,
      include: ['test/**/*.spec-d.ts'],
    },
    onConsoleLog(log, type) {
      if (
        type === 'stderr' &&
        log.includes('[@faker-js/faker]:') &&
        log.includes('deprecated')
      ) {
        return false;
      }
    },
  },
});