JSPM

  • Created
  • Published
  • Downloads 36361836
  • Score
    100M100P100Q230085F
  • License ISC

test for inclusion or exclusion of paths using pkg-conf and globs

Package Exports

  • test-exclude

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (test-exclude) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

test-exclude

The file include/exclude logic used by nyc.

Build Status Coverage Status Standard Version Greenkeeper badge

Usage

const exclude = require('test-exclude')
if (exclude().shouldInstrument('./foo.js')) {
  // let's instrument this file for test coverage!
}

you can load configuration from a key in package.json:

package.json

{
  "name": "awesome-module",
  "test": {
    "include": ["**/index.js"]
  }
}

app.js

const exclude = require('test-exclude')
if (exclude({configKey: 'test'}).shouldInstrument('./index.js')) {
  // let's instrument this file for test coverage!
}

Including node_modules folder

by default the node_modules folder is added to all groups of exclude rules. In the rare case that you wish to instrument files stored in node_modules, a negative glob can be used:

const exclude = require('test-exclude')
const e = exclude({
  exclude: ['!**/node_modules/**']
})

License

ISC