From e51da94a1af9b960206504853bd3cbe415f9108a Mon Sep 17 00:00:00 2001 From: mlzzen Date: Fri, 6 Sep 2024 13:31:58 +0800 Subject: [PATCH] chore: add test coverage (#7) --- package.json | 3 ++- vitest.config.mts | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 114dbb7..d0674b0 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "scripts": { "dev": "rollup --config rollup.config.mts --configPlugin swc3 --watch", "build": "rollup --config rollup.config.mts --configPlugin swc3", - "test": "vitest" + "test": "vitest", + "coverage": "vitest run --coverage" }, "exports": { ".": { diff --git a/vitest.config.mts b/vitest.config.mts index db92ba0..f5bbce1 100644 --- a/vitest.config.mts +++ b/vitest.config.mts @@ -3,6 +3,12 @@ import { defineConfig } from 'vitest/config' export default defineConfig({ test: { watch: false, - testTimeout: 8000 - } + testTimeout: 8000, + coverage: { + include: [ + '__tests__/**/*.{test,spec}.ts' + ], + exclude: ['**/node_modules/**', '**/example/**', '**/dist/**', '**/cypress/**', '**/.{idea,git,cache,output,temp}/**', '**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*'] + } + }, })