Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

@istanbuljs/nyc-config-typescript

0.1.0 • Public • Published

nyc-config-typescript

Handy default configuration for instrumenting your babel-backed project with test coverage using nyc.

First install the dependencies:

npm i nyc source-map-support ts-node @istanbuljs/nyc-config-typescript --save-dev

Then write a tsconfig.json that looks something like this:

tsconfig.json

{
  "sourceMap": "inline",
  // OR
  "sourceMap": true
}

.nycrc

And write a .nycrc that looks like this:

{
  "extends": "@istanbuljs/nyc-config-typescript",
  // OPTIONAL if you want coverage reported on every file, including those that aren't tested:
  "all": true
}

Running Tests

If you're using mocha:

test/mocha.opts

--require ts-node/register #replace with ts-node/register/transpile-only if you have custom types
--require source-map-support/register
--recursive
<glob for your test files>

Now setup the test scripts in your package.json like so (with the equivalent for your test runner):

{
  "test": "nyc mocha"
}

License

ISC

Install

npm i @istanbuljs/[email protected]

Version

0.1.0

License

ISC

Unpacked Size

2.92 kB

Total Files

4

Last publish

Collaborators

  • avatar
  • avatar
  • avatar
  • avatar