Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@istanbuljs/nyc-config-typescript

istanbuljs1.1mISC1.0.2

nyc configuration that works with typescript

typescript, config, nyc, test, coverage

readme

nyc-config-typescript

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

First install the dependencies:

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

Your tsconfig.json must be configured to produce source maps, either inline or as sibling files.

.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
}

This package specifies the cache, exclude, and extension options for you - only override those if you absolutely must. If you are going to modify include or exclude and you have specified a separate outDir in tsconfig.json, make sure that it remains included so that source mapping is possible.

Running Tests

If you're using mocha

In 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": "tsc && nyc mocha"
}

If you're using Jasmine

In package.json:

{
    "test": "tsc && nyc --require ts-node/register jasmine"
}

License

ISC

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

1.0.2 (2021-12-01)

Bug Fixes

  • remove unnecessary peer dependencies (8a18fa1)

1.0.1 (2019-12-30)

Bug Fixes

1.0.0 (2019-12-20)

Note: Version bump only for package @istanbuljs/nyc-config-typescript

1.0.0-alpha.2 (2019-12-07)

Bug Fixes

1.0.0-alpha.1 (2019-10-06)

Note: Version bump only for package @istanbuljs/nyc-config-typescript

1.0.0-alpha.0 (2019-06-19)

Features

  • Update dependencies, require Node.js 8 (#401) (bf3a539)

BREAKING CHANGES

  • Node.js 8 is now required

0.1.3 (2019-05-02)

Note: Version bump only for package @istanbuljs/nyc-config-typescript

0.1.2 (2019-04-24)

Note: Version bump only for package @istanbuljs/nyc-config-typescript

0.1.1 (2019-03-12)

Note: Version bump only for package @istanbuljs/nyc-config-typescript