Security News
pnpm 9.5 Introduces Catalogs: Shareable Dependency Version Specifiers
pnpm 9.5 introduces a Catalogs feature, enabling shareable dependency version specifiers, reducing merge conflicts and improving support for monorepos.
vite-plugin-istanbul
Advanced tools
Package description
vite-plugin-istanbul is a Vite plugin that integrates Istanbul for code coverage reporting. It allows you to instrument your code with Istanbul, which is useful for generating code coverage reports during testing.
Code Instrumentation
This feature allows you to instrument your code for coverage reporting. You can specify which files to include or exclude, the file extensions to consider, and whether to require an environment variable to enable instrumentation.
import { defineConfig } from 'vite';
import istanbul from 'vite-plugin-istanbul';
export default defineConfig({
plugins: [
istanbul({
include: 'src/*',
exclude: ['node_modules', 'test/'],
extension: ['.js', '.ts', '.vue'],
requireEnv: true,
}),
],
});
Custom Reporting
This feature allows you to customize the reporting options for Istanbul. You can specify the reporters to use and the directory where the reports should be saved.
import { defineConfig } from 'vite';
import istanbul from 'vite-plugin-istanbul';
export default defineConfig({
plugins: [
istanbul({
include: 'src/*',
exclude: ['node_modules', 'test/'],
extension: ['.js', '.ts', '.vue'],
requireEnv: true,
cypress: true,
nyc: {
reporter: ['html', 'text-summary'],
reportDir: './coverage',
},
}),
],
});
babel-plugin-istanbul is a Babel plugin for code coverage using Istanbul. It is similar to vite-plugin-istanbul but is used in Babel-based projects. It provides similar functionality for instrumenting code and generating coverage reports.
karma-coverage is a Karma plugin that uses Istanbul to generate code coverage reports. It is used in projects that use the Karma test runner and provides similar functionality for code instrumentation and reporting.
Jest is a JavaScript testing framework that has built-in support for code coverage using Istanbul. It provides a comprehensive testing solution with integrated code coverage reporting, making it a more all-in-one solution compared to vite-plugin-istanbul.
Readme
A Vite plugin to instrument your code for nyc/istanbul code coverage. In similar way as the Webpack Loader istanbul-instrumenter-loader. Only intended for use in development.
$ npm i -D vite-plugin-istanbul
or if you use yarn
$ yarn add -D vite-plugin-istanbul
import IstanbulPlugin from 'vite-plugin-istanbul';
Creates the vite plugin from a set of optional plugin options.
Returns: Vite Plugin
opts {IstanbulPluginOptions}
- Object of optional options to pass to the pluginopts.include {string|string[]}
- Optional string or array of strings of glob patterns to includeopts.exclude {string|string[]}
- Optional string or array of strings of glob patterns to excludeopts.extension {string|string[]}
- Optional string or array of strings of extensions to include (dot prefixed like .js or .ts)To use this plugin define it using vite.config.js
// vite.config.js
const istanbul = require('vite-plugin-istanbul');
module.exports = {
open: true,
port: 3000,
plugins: [
istanbul({
include: 'src/*',
exclude: [/node_modules/, 'test/'],
extension: [ '.js', '.ts' ],
}),
],
};
$ npm run test
FAQs
Unknown package
We found that vite-plugin-istanbul demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 9.5 introduces a Catalogs feature, enabling shareable dependency version specifiers, reducing merge conflicts and improving support for monorepos.
Security News
A threat actor on BreachForums is selling an unverified npm vulnerability for account takeover, but npm has not officially confirmed the existence of this security concern.
Security News
Cyber insurance rates are dropping as the market matures, according to a new report projecting global premiums to reach $43 billion by 2030, driven by international market uptake and growth in the SME sector.