Skip to content

Commit

Permalink
feat: add nyc-config-typescript (#282)
Browse files Browse the repository at this point in the history
* chore: add licenses

* start at v0.1
  • Loading branch information
JaKXz committed Jan 29, 2019
1 parent c9e32e4 commit f1fb688
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 0 deletions.
6 changes: 6 additions & 0 deletions 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.

6 changes: 6 additions & 0 deletions 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.

57 changes: 57 additions & 0 deletions 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
<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
@@ -0,0 +1,17 @@
{
"cache": false,
"extension": [
".ts",
".tsx"
],
"exclude": [
"**/*.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
@@ -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": "*"
}
}

0 comments on commit f1fb688

Please sign in to comment.