Skip to content

A Bun 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 while running tests.

License

Notifications You must be signed in to change notification settings

hedaukartik/bun-plugin-istanbul

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bun-plugin-istanbul

A Bun 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 while running tests.

Installation

bun i -D bun-plugin-istanbul

API

import bunPluginIstanbul from "bun-plugin-istanbul";

Usage

import bunPluginIstanbul from "bun-plugin-istanbul";

const jsPlugin = bunPluginIstanbul({
	filter: /\.[cm]?js$/,
	loader: "js",
	name: "istanbul-loader-js",
});

const jsxPlugin = bunPluginIstanbul({
	filter: /\.jsx$/,
	loader: "jsx",
	name: "istanbul-loader-jsx",
});

const tsPlugin = bunPluginIstanbul({
	filter: /\.[cm]?ts$/,
	loader: "ts",
	name: "istanbul-loader-ts",
});

const tsxPlugin = bunPluginIstanbul({
	filter: /\.tsx$/,
	loader: "tsx",
	name: "istanbul-loader-tsx",
});

await bun.build({
	plugins: [jsPlugin, jsxPlugin, tsPlugin, tsxPlugin],
});

Example Repository

To better understand how to use bun-plugin-istanbul in a real-world scenario, refer to the example repository: bun-react-playwright-coverage.

The repository demonstrates how to:

  1. Integrate bun-plugin-istanbul with a Bun project to enable code instrumentation for coverage reports.
  2. Combine it with Playwright for end-to-end testing.
  3. Generate coverage reports to track test coverage metrics for React components.

License

MIT

About

A Bun 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 while running tests.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published