Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add nyc-config-typescript #282

Merged
merged 5 commits into from
Jan 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/nyc-config-babel/LICENSE
Original file line number Diff line number Diff line change
@@ -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.

6 changes: 6 additions & 0 deletions packages/nyc-config-typescript/LICENSE
Original file line number Diff line number Diff line change
@@ -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.

57 changes: 57 additions & 0 deletions packages/nyc-config-typescript/README.md
Original file line number Diff line number Diff line change
@@ -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
<glob for your test files>
```

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

```json
{
"test": "nyc mocha"
}
```

## License

ISC
17 changes: 17 additions & 0 deletions packages/nyc-config-typescript/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"cache": false,
coreyfarrell marked this conversation as resolved.
Show resolved Hide resolved
"extension": [
".ts",
".tsx"
],
"exclude": [
JaKXz marked this conversation as resolved.
Show resolved Hide resolved
"**/*.d.ts",
"coverage/**",
"packages/*/test/**",
"test/**",
"test{,-*}.ts",
"**/*{.,-}{test,spec}.ts",
"**/__tests__/**",
"**/node_modules/**"
]
}
39 changes: 39 additions & 0 deletions packages/nyc-config-typescript/package.json
Original file line number Diff line number Diff line change
@@ -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 <jgkurian@me.com>",
"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": "*"
}
}