Comparing version 5.2.0 to 5.3.0
## Change Log | ||
### v5.3.0 (2016/01/05 14:07 -08:00) | ||
- [#132](https://github.com/bcoe/nyc/pull/132/files) Move config to top level nyc argument. (@jamestalmage) | ||
### v5.2.0 (2016/01/02 17:13 -08:00) | ||
@@ -4,0 +8,0 @@ |
29
index.js
@@ -18,2 +18,4 @@ /* global __coverage__ */ | ||
var findCacheDir = require('find-cache-dir') | ||
var pkgUp = require('pkg-up') | ||
var readPkg = require('read-pkg') | ||
@@ -31,9 +33,8 @@ /* istanbul ignore next */ | ||
this._tempDirectory = opts.tempDirectory || './.nyc_output' | ||
this.cwd = opts.cwd || process.env.NYC_CWD || process.cwd() | ||
var config = this._loadConfig(opts) | ||
this.cwd = config.cwd | ||
this.reporter = arrify(opts.reporter || 'text') | ||
// you can specify config in the nyc stanza of package.json. | ||
var config = require(path.resolve(this.cwd, './package.json')).config || {} | ||
config = config.nyc || {} | ||
// load exclude stanza from config. | ||
@@ -64,2 +65,20 @@ this.include = false | ||
NYC.prototype._loadConfig = function (opts) { | ||
var cwd = opts.cwd || process.env.NYC_CWD || process.cwd() | ||
var pkgPath = pkgUp.sync(cwd) | ||
// you can specify config in the nyc stanza of package.json. | ||
var config | ||
if (pkgPath) { | ||
cwd = path.dirname(pkgPath) | ||
var pkg = readPkg.sync(pkgPath, {normalize: false}) | ||
config = pkg.nyc || (pkg.config && pkg.config.nyc) | ||
} | ||
config = config || {} | ||
config.cwd = cwd | ||
return config | ||
} | ||
NYC.prototype._createTransform = function () { | ||
@@ -66,0 +85,0 @@ var _this = this |
{ | ||
"name": "nyc", | ||
"version": "5.2.0", | ||
"version": "5.3.0", | ||
"description": "a code coverage tool that works well with subprocesses.", | ||
@@ -26,16 +26,14 @@ "main": "index.js", | ||
], | ||
"config": { | ||
"nyc": { | ||
"exclude": [ | ||
"node_modules", | ||
"bin", | ||
"coverage", | ||
"test/fixtures/coverage.js", | ||
"test/build/*", | ||
"test/nyc-test.js", | ||
"test/source-map-cache.js", | ||
"index.covered.js", | ||
"test/fixtures/_generateCoverage.js" | ||
] | ||
} | ||
"nyc": { | ||
"exclude": [ | ||
"node_modules", | ||
"bin", | ||
"coverage", | ||
"test/fixtures/coverage.js", | ||
"test/build/*", | ||
"test/nyc-test.js", | ||
"test/source-map-cache.js", | ||
"index.covered.js", | ||
"test/fixtures/_generateCoverage.js" | ||
] | ||
}, | ||
@@ -72,3 +70,3 @@ "standard": { | ||
"find-cache-dir": "^0.1.1", | ||
"foreground-child": "^1.3.3", | ||
"foreground-child": "1.3.3", | ||
"glob": "^6.0.2", | ||
@@ -79,2 +77,4 @@ "istanbul": "^0.4.1", | ||
"mkdirp": "^0.5.0", | ||
"pkg-up": "^1.0.0", | ||
"read-pkg": "^1.1.0", | ||
"resolve-from": "^2.0.0", | ||
@@ -81,0 +81,0 @@ "rimraf": "^2.5.0", |
@@ -85,3 +85,3 @@ # nyc | ||
You can tell nyc to exclude specific files and directories by adding | ||
an `config.nyc.exclude` array to your `package.json`. Each element of | ||
an `nyc.exclude` array to your `package.json`. Each element of | ||
the array is a glob pattern indicating which paths should be omitted. | ||
@@ -94,3 +94,3 @@ | ||
For example, the following config will exclude all `node_modules`, | ||
For example, the following config will exclude everything in `node_modules`, | ||
any files with the extension `.spec.js`, and anything in the `build` | ||
@@ -100,5 +100,4 @@ directory: | ||
```json | ||
{"config": { | ||
"nyc": { | ||
"exclude": [ | ||
{"nyc": { | ||
"exclude": [ | ||
"**/*.spec.js", | ||
@@ -108,3 +107,3 @@ "build" | ||
} | ||
}} | ||
} | ||
``` | ||
@@ -111,0 +110,0 @@ |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
35277
619
13
20
182
+ Addedpkg-up@^1.0.0
+ Addedread-pkg@^1.1.0
+ Addedcross-spawn-async@2.2.5(transitive)
+ Addederror-ex@1.3.2(transitive)
+ Addedforeground-child@1.3.3(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedhosted-git-info@2.8.9(transitive)
+ Addedis-arrayish@0.2.1(transitive)
+ Addedis-core-module@2.16.1(transitive)
+ Addedload-json-file@1.1.0(transitive)
+ Addednormalize-package-data@2.5.0(transitive)
+ Addedparse-json@2.2.0(transitive)
+ Addedpath-parse@1.0.7(transitive)
+ Addedpath-type@1.1.0(transitive)
+ Addedpify@2.3.0(transitive)
+ Addedpkg-up@1.0.0(transitive)
+ Addedread-pkg@1.1.0(transitive)
+ Addedresolve@1.22.10(transitive)
+ Addedsemver@5.7.2(transitive)
+ Addedspdx-correct@3.2.0(transitive)
+ Addedspdx-exceptions@2.5.0(transitive)
+ Addedspdx-expression-parse@3.0.1(transitive)
+ Addedspdx-license-ids@3.0.21(transitive)
+ Addedsupports-preserve-symlinks-flag@1.0.0(transitive)
+ Addedvalidate-npm-package-license@3.0.4(transitive)
Updatedforeground-child@1.3.3