Skip to content

Commit e33d67a

Browse files
committed
Fix vitest:min
1 parent 2bfe8b0 commit e33d67a

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,10 @@
128128
"dev:hooks": "microbundle watch --raw --no-generateTypes --format cjs --cwd hooks",
129129
"dev:compat": "microbundle watch --raw --no-generateTypes --format cjs --cwd compat --globals 'preact/hooks=preactHooks'",
130130
"test": "npm-run-all build lint test:unit",
131-
"test:unit": "run-p test:mocha test:vitest test:ts",
131+
"test:unit": "run-p test:mocha test:vitest test:vitest:min test:ts",
132132
"test:vitest:watch": "vitest",
133133
"test:vitest": "cross-env COVERAGE=true vitest run",
134-
"test:vitest:min": "cross-env MINIFY=true COVERAGE=true vitest run",
134+
"test:vitest:min": "cross-env MINIFY=true vitest run",
135135
"test:ts": "run-p test:ts:*",
136136
"test:ts:core": "tsc -p test/ts/ && mocha --require \"@babel/register\" test/ts/**/*-test.js",
137137
"test:ts:compat": "tsc -p compat/test/ts/",

vitest.config.mjs

+19-9
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { readFileSync } from 'fs';
55
import path from 'path';
66

77
const MINIFY = process.env.MINIFY === 'true';
8+
const COVERAGE = process.env.COVERAGE === 'true';
89

910
const root = path.resolve(__dirname);
1011
const alias = {
@@ -194,15 +195,24 @@ export default defineConfig({
194195
},
195196
test: {
196197
coverage: {
197-
enabled: true,
198-
include: [
199-
'**/src/**/*',
200-
'**/debug/src/**/*',
201-
'**/hooks/src/**/*',
202-
'**/compeat/src/**/*',
203-
'**/jsx-runtime/src/**/*',
204-
'**/test-utils/src/**/*'
205-
],
198+
enabled: COVERAGE,
199+
include: MINIFY
200+
? [
201+
'**/dist/preact.mjs',
202+
'**/compat/dist/compat.mjs',
203+
'**/jsx-runtime/dist/jsxRuntime.mjs',
204+
'**/debug/dist/debug.mjs',
205+
'**/hooks/dist/hooks.mjs',
206+
'**/test-utils/dist/testUtils.mjs'
207+
]
208+
: [
209+
'**/src/**/*',
210+
'**/debug/src/**/*',
211+
'**/hooks/src/**/*',
212+
'**/compeat/src/**/*',
213+
'**/jsx-runtime/src/**/*',
214+
'**/test-utils/src/**/*'
215+
],
206216
extension: ['.js'],
207217
provider: 'istanbul',
208218
reporter: ['html', 'lcovonly', 'text-summary'],

0 commit comments

Comments
 (0)