-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Describe the bug
When a global coverage threshold is set in vitest configuration, an error message is shown like this
ERROR: Coverage for functions (0%) does not meet global threshold (100%)
But, when threshold for a particular file is set using the glob-pattern option, there is no such error message.
Reproduction
1.Clone this repo: https://github.com/kanteankit/vitest
2. Run npm install
3. Run npm run coverage
Expected behaviour: An error message should show up which says that the threshold for the file AsAsync.vue
is not met.
Actual behaviour: There is no error message
In vitest.config.ts, a threshold of 100 is set on components/AsAsync.vue
. But, it is not throwing any error.
/// <reference types="vitest" />
import { defineConfig } from 'vite'
import Vue from '@vitejs/plugin-vue'
export default defineConfig({
plugins: [
Vue(),
],
test: {
globals: true,
environment: 'jsdom',
coverage: {
thresholds: {
// functions: 100, // This shows an error message
'components/AsAsync.vue': {
functions: 100 // This does not show an error message
}
}
}
},
})
Note: Couldn't provide a Stackblitz because it gives an error saying @vitest/coverage-v8 does not work on Stackblitz. Report will be empty.
System Info
System:
OS: Linux 5.19 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Memory: 5.60 GB / 15.48 GB
Container: Yes
Shell: 5.1.16 - /bin/bash
Binaries:
Node: 20.9.0 - ~/.nvm/versions/node/v20.9.0/bin/node
Yarn: 1.22.19 - /usr/bin/yarn
npm: 10.2.5 - ~/.nvm/versions/node/v20.9.0/bin/npm
Browsers:
Chrome: 123.0.6312.122
npmPackages:
@vitejs/plugin-vue: latest => 5.0.4
@vitest/coverage-istanbul: ^1.5.0 => 1.5.0
@vitest/coverage-v8: ^1.5.0 => 1.5.0
vite: latest => 5.2.8
vitest: latest => 1.5.0
Used Package Manager
npm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.