Security News
vlt Debuts New JavaScript Package Manager and Serverless Registry at NodeConf EU
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
vite-plugin-istanbul
Advanced tools
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.
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
vite-plugin-istanbul ========================== [![Codacy grade](https://img.shields.io/codacy/grade/a0c628b128c044269faefc1da74382f7?style=for-the-badge&logo=codacy)](https://www.codacy.com/gh/iFaxity/vite-plugin-istanbul/dashboard) [![npm (scoped)](http
The npm package vite-plugin-istanbul receives a total of 286,294 weekly downloads. As such, vite-plugin-istanbul popularity was classified as popular.
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
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
Security News
Research
The Socket Research Team uncovered a malicious Python package typosquatting the popular 'fabric' SSH library, silently exfiltrating AWS credentials from unsuspecting developers.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.