From 96f6b09a9e17398012f271082c17571e6ae1f46f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=81=E6=A0=91=E4=BA=BA?= Date: Sat, 16 Sep 2023 16:10:36 +0100 Subject: [PATCH] chore: merge vitest config to vite config --- vite.config.ts | 47 ++++++++++++++++++++++++++++++++++++++++++++++- vitest.config.ts | 43 ------------------------------------------- 2 files changed, 46 insertions(+), 44 deletions(-) delete mode 100644 vitest.config.ts diff --git a/vite.config.ts b/vite.config.ts index f64deca..1d83f70 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -2,7 +2,7 @@ import url from 'node:url'; import path from 'node:path'; import fs from 'node:fs'; -import { defineConfig } from 'vite'; +import { defineConfig } from 'vitest/config'; import react from '@vitejs/plugin-react'; import wasm from 'vite-plugin-wasm'; import replace from '@rollup/plugin-replace'; @@ -101,4 +101,49 @@ export default defineConfig({ }, }, }, + test: { + globals: true, + mockReset: true, + environment: 'jsdom', + setupFiles: ['src/test-utils/setup-jest.ts'], + alias: [ + { + find: /^~\/(.*)/, + replacement: 'src/$1', + }, + ], + // workaround: sql.js is not ESModule friendly, yet... + deps: { + // inline: ['sql.js'], + optimizer: { + web: { + include: ['sql.js'], + }, + }, + }, + api: { + port: 5174, // vite port + 1 + }, + coverage: { + provider: 'v8', + exclude: [ + // default rules + 'coverage/**', + 'dist/**', + 'packages/*/test{,s}/**', + '**/*.d.ts', + 'cypress/**', + 'test{,s}/**', + 'test{,-*}.{js,cjs,mjs,ts,tsx,jsx}', + '**/*{.,-}test.{js,cjs,mjs,ts,tsx,jsx}', + '**/*{.,-}spec.{js,cjs,mjs,ts,tsx,jsx}', + '**/__tests__/**', + '**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*', + '**/.{eslint,mocha,prettier}rc.{js,cjs,yml}', + + // custom ones + 'src/test-utils/**', + ], + }, + }, }); diff --git a/vitest.config.ts b/vitest.config.ts deleted file mode 100644 index e7e0842..0000000 --- a/vitest.config.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { defineConfig } from 'vitest/config'; - -export default defineConfig({ - test: { - globals: true, - mockReset: true, - environment: 'jsdom', - setupFiles: ['src/test-utils/setup-jest.ts'], - alias: [ - { - find: /^~\/(.*)/, - replacement: 'src/$1', - }, - ], - // workaround: sql.js is not ESModule friendly, yet... - deps: { - inline: ['sql.js'], - }, - api: { - port: 5174, // vite port + 1 - }, - coverage: { - exclude: [ - // default rules - 'coverage/**', - 'dist/**', - 'packages/*/test{,s}/**', - '**/*.d.ts', - 'cypress/**', - 'test{,s}/**', - 'test{,-*}.{js,cjs,mjs,ts,tsx,jsx}', - '**/*{.,-}test.{js,cjs,mjs,ts,tsx,jsx}', - '**/*{.,-}spec.{js,cjs,mjs,ts,tsx,jsx}', - '**/__tests__/**', - '**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*', - '**/.{eslint,mocha,prettier}rc.{js,cjs,yml}', - - // custom ones - 'src/test-utils/**', - ], - }, - }, -});