aboutsummaryrefslogtreecommitdiff
path: root/vitest.config.ts
diff options
context:
space:
mode:
authorShinigami <[email protected]>2024-01-24 18:20:52 +0100
committerGitHub <[email protected]>2024-01-24 18:20:52 +0100
commit7fce907c859a0738a534377fe98d8a7843eeebb5 (patch)
tree02c45e58886928f425bf166e569536c1523f4673 /vitest.config.ts
parentca50f824919a199fd9c6148d5521e5bf991da156 (diff)
downloadfaker-7fce907c859a0738a534377fe98d8a7843eeebb5.tar.xz
faker-7fce907c859a0738a534377fe98d8a7843eeebb5.zip
infra: use vitest config (#2612)
Diffstat (limited to 'vitest.config.ts')
-rw-r--r--vitest.config.ts53
1 files changed, 53 insertions, 0 deletions
diff --git a/vitest.config.ts b/vitest.config.ts
new file mode 100644
index 00000000..16fa5aed
--- /dev/null
+++ b/vitest.config.ts
@@ -0,0 +1,53 @@
+import { defineConfig } from 'vitest/config';
+
+const VITEST_SEQUENCE_SEED = Date.now();
+
+console.log('VITEST_SEQUENCE_SEED', VITEST_SEQUENCE_SEED);
+
+// TODO @Shinigami92 2023-12-28: remove when we drop support for Node 14
+const [nodeVersionMajor] = process.versions.node.split('.').map(Number);
+const excludedTests: string[] = [];
+if (nodeVersionMajor < 16) {
+ excludedTests.push(
+ 'test/scripts/apidoc/module.spec.ts',
+ 'test/scripts/apidoc/signature.spec.ts',
+ 'test/scripts/apidoc/verify-jsdoc-tags.spec.ts'
+ );
+}
+
+// https://vitejs.dev/config/
+export default defineConfig({
+ test: {
+ setupFiles: ['test/setup.ts'],
+ coverage: {
+ all: true,
+ provider: 'v8',
+ reporter: ['clover', 'cobertura', 'lcov', 'text'],
+ include: ['src'],
+ },
+ reporters: 'basic',
+ sequence: {
+ seed: VITEST_SEQUENCE_SEED,
+ shuffle: true,
+ },
+ // TODO @Shinigami92 2023-12-28: remove the whole `exclude` when we drop support for Node 14
+ exclude: [
+ // should be originally `...configDefaults.exclude` from `'vitest/config'`, but esm...
+ 'node_modules',
+ 'dist',
+ '.idea',
+ '.git',
+ '.cache',
+ ...excludedTests,
+ ],
+ onConsoleLog(log, type) {
+ if (
+ type === 'stderr' &&
+ log.includes('[@faker-js/faker]:') &&
+ log.includes('deprecated')
+ ) {
+ return false;
+ }
+ },
+ },
+});