0👍
https://github.com/istanbuljs/nyc#typescript-projects
TypeScript projects
Please start with the pre-configured
@istanbuljs/nyc-config-typescript
preset.
https://www.npmjs.com/package/@istanbuljs/nyc-config-typescript
First install the dependencies:
npm i -D nyc source-map-support ts-node @istanbuljs/nyc-config-typescript
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 }
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>
Source:stackexchange.com