包详细信息

@istanbuljs/esm-loader-hook

istanbuljs16.4kISC0.3.0

Loader hook for ESM instrumentation (experimental!!)

自述文件

@istanbuljs/esm-loader-hook

Tests NPM Version NPM Downloads ISC

This loader hook makes it relatively easy to use NYC to check coverage of ESM running in node.js 16.12.0. Note this makes use of experimental node.js features and thus may stop working upon release of new versions of node.js. Until the node.js feature is stabilized breakage should not be unexpected.

For more stable options to test coverage you can:

  • Use c8
  • Pre-instrument your code (run nyc instrument then test the output)

Adding to processes

To install this hook into a process the module must be provided through the --experimental-loader flag.

The following can be used for your npm test script to enable live instrumentation of ES modules being tested with mocha:

cross-env 'NODE_OPTIONS=--experimental-loader @istanbuljs/esm-loader-hook' nyc mocha

Configuration

This module executes babel-plugin-istanbul in a loader hook. No options are provided to the babel plugin and babel configuration files are not honored. Normally configuration will be provided by the currently running instance of nyc. If this module is run outside nyc then it will use @istanbuljs/load-nyc-config to load options, defaults from @istanbuljs/schema will apply to missing options or if no configuration is found.

更新日志

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

0.3.0 (2024-12-27)

Features

  • add @babel/plugin-syntax-decorators and @babel/preset-typescript presets (4c18cf8)

0.2.0 (2022-07-15)

⚠ BREAKING CHANGES

  • Node.js 16.12.0 is required

Bug Fixes

  • Work with Node.js >=16.12.0 (4ea4529), closes #6

0.1.2 (2020-05-31)

Bug Fixes

  • Prepare for ESM loader hooks moving to worker threads. (#3) (8105a8f)

0.1.1 (2020-05-20)

Features

Bug Fixes

  • Do not attempt to recursively load configuration (#2) (bc4d4e1)