Socket
Socket
Sign inDemoInstall

@istanbuljs/nyc-config-typescript

Package Overview
Dependencies
146
Maintainers
5
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @istanbuljs/nyc-config-typescript

nyc configuration that works with typescript


Version published
Weekly downloads
314K
increased by3.87%
Maintainers
5
Install size
24.7 kB
Created
Weekly downloads
 

Readme

Source

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

Keywords

FAQs

Last updated on 01 Dec 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc