diff --git a/packages/nyc-config-babel/LICENSE b/packages/nyc-config-babel/LICENSE new file mode 100644 index 00000000..2c12b67c --- /dev/null +++ b/packages/nyc-config-babel/LICENSE @@ -0,0 +1,6 @@ +Copyright 2018 Contributors + +Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + diff --git a/packages/nyc-config-typescript/LICENSE b/packages/nyc-config-typescript/LICENSE new file mode 100644 index 00000000..50b947a9 --- /dev/null +++ b/packages/nyc-config-typescript/LICENSE @@ -0,0 +1,6 @@ +Copyright 2019 Contributors + +Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + diff --git a/packages/nyc-config-typescript/README.md b/packages/nyc-config-typescript/README.md new file mode 100644 index 00000000..b5327526 --- /dev/null +++ b/packages/nyc-config-typescript/README.md @@ -0,0 +1,57 @@ +# nyc-config-typescript + +Handy default configuration for instrumenting your babel-backed +project with test coverage using [nyc](https://github.com/istanbuljs/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 + +```json +{ + "sourceMap": "inline", + // OR + "sourceMap": true +} +``` + +## .nycrc + +And write a `.nycrc` that looks like this: + +```json +{ + "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 + +``` + +Now setup the test scripts in your package.json like so (with the equivalent for your test runner): + +```json +{ + "test": "nyc mocha" +} +``` + +## License + +ISC diff --git a/packages/nyc-config-typescript/index.json b/packages/nyc-config-typescript/index.json new file mode 100644 index 00000000..1341e4a2 --- /dev/null +++ b/packages/nyc-config-typescript/index.json @@ -0,0 +1,17 @@ +{ + "cache": false, + "extension": [ + ".ts", + ".tsx" + ], + "exclude": [ + "**/*.d.ts", + "coverage/**", + "packages/*/test/**", + "test/**", + "test{,-*}.ts", + "**/*{.,-}{test,spec}.ts", + "**/__tests__/**", + "**/node_modules/**" + ] +} diff --git a/packages/nyc-config-typescript/package.json b/packages/nyc-config-typescript/package.json new file mode 100644 index 00000000..aa805487 --- /dev/null +++ b/packages/nyc-config-typescript/package.json @@ -0,0 +1,39 @@ +{ + "name": "@istanbuljs/nyc-config-typescript", + "version": "0.1.0", + "description": "nyc configuration that works with typescript", + "main": "index.json", + "files": [ + "index.json" + ], + "scripts": { + "test": "exit 0" + }, + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/istanbuljs/istanbuljs.git" + }, + "keywords": [ + "typescript", + "config", + "nyc", + "test", + "coverage" + ], + "author": "Jason Kurian ", + "license": "ISC", + "bugs": { + "url": "https://github.com/istanbuljs/istanbuljs/issues" + }, + "homepage": "https://github.com/istanbuljs/istanbuljs#readme", + "publishConfig": { + "access": "public" + }, + "engines": { + "node": ">=6" + }, + "peerDependencies": { + "source-map-support": "*", + "ts-node": "*" + } +}