# @ngageoint/opensphere-coverage-loader

> Webpack loader to instrument code coverage

Latest version **1.0.0** (published 2021-01-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ngageoint/opensphere-coverage-loader
pnpm add @ngageoint/opensphere-coverage-loader
yarn add @ngageoint/opensphere-coverage-loader
bun add @ngageoint/opensphere-coverage-loader
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2021-01-20 |
| First published | 2021-01-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10.13.0 |
| Dependencies | 4 |
| Unpacked size | 14.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Kir Belevich |
| Maintainers | danielbarela, ngageoint-npm, gisjedi, caldwellc, rachelais, mheppner, schmidtk |
| Keywords | webpack, loader, istanbul, coverage |

## Links

- npm: https://www.npmjs.com/package/@ngageoint/opensphere-coverage-loader
- Repository: https://github.com/ngageoint/opensphere-coverage-loader
- Issues: https://github.com/ngageoint/opensphere-coverage-loader/issues
- npm.io page: https://npm.io/package/@ngageoint/opensphere-coverage-loader

## Dependencies (4)

- [loader-utils](https://npm.io/package/loader-utils.md) ^2.0.0
- [schema-utils](https://npm.io/package/schema-utils.md) ^3.0.0
- [convert-source-map](https://npm.io/package/convert-source-map.md) ^1.7.0
- [istanbul-lib-instrument](https://npm.io/package/istanbul-lib-instrument.md) ^4.0.3

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2021-01-20

## README

# OpenSphere Code Coverage Loader

Instrument JS files with [istanbul-lib-instrument](https://github.com/istanbuljs/istanbuljs/tree/master/packages/istanbul-lib-instrument) for subsequent code coverage reporting.

This project is forked from [istanbul-instrumenter-loader](https://github.com/webpack-contrib/istanbul-instrumenter-loader) to provide additional maintenance in support of [OpenSphere](https://github.com/ngageoint/opensphere).

## Install

```bash
npm i -D istanbul-instrumenter-loader
```

## Usage

Add the loader to the webpack config:

```js
module: {
  rules: [
    {
      test: /\.js$/,
      use: {
        loader: '@ngageoint/opensphere-coverage-loader',
        options: {esModules: true}
      },
      include: path.resolve('src')
    }
  ]
}
```

Then configure [karma-coverage-istanbul-reporter](https://github.com/mattlewis92/karma-coverage-istanbul-reporter) as your test coverage reporter.

## Options

The loader supports all options supported by `istanbul-lib-instrument`

|Name|Type|Default|Description|
|:--:|:--:|:-----:|:----------|
|**`debug`**|`{Boolean}`|`false`|Turn on debugging mode|
|**`compact`**|`{Boolean}`|`true`|Generate compact code|
|**`autoWrap`**|`{Boolean}`|`false`|Set to `true` to allow return statements outside of functions|
|**`esModules`**|`{Boolean}`|`false`|Set to `true` to instrument ES2015 Modules|
|**`coverageVariable`**|`{String}`|`__coverage__`|Name of global coverage variable|
|**`preserveComments`**|`{Boolean}`|`false`|Preserve comments in `output`|
|**`produceSourceMap`**|`{Boolean}`|`false`|Set to `true` to produce a source map for the instrumented code|
|**`sourceMapUrlCallback`**|`{Function}`|`null`|A callback function that is called when a source map URL is found in the original code. This function is called with the source filename and the source map URL|

---
_Source: https://npm.io/package/@ngageoint/opensphere-coverage-loader · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
