mocha-jshint
Advanced tools
Comparing version 1.1.0 to 2.0.0
30
index.js
var path = require('path'); | ||
module.exports = function (paths) { | ||
module.exports = function (opt) { | ||
describe('jshint', function () { | ||
paths = paths || ['.']; | ||
paths.forEach(function (p) { | ||
it('should pass for ' + (p === '.' ? 'working directory' : p), function () { | ||
this.timeout && this.timeout(30000); | ||
var cwd = process.cwd(); | ||
process.chdir(path.resolve(p)); | ||
it('should pass for working directory', function (done) { | ||
this.timeout && this.timeout(30000); | ||
if (opt && opt.git) { | ||
return require('./git')(opt.git, run); | ||
} | ||
return run(null, ['.']); | ||
function run(err, files) { | ||
if (err) { | ||
return done(err); | ||
} | ||
if (files.length === 0) { | ||
return done(); | ||
} | ||
var jsHintCliPath = path.resolve(path.dirname(require.resolve('jshint')), 'cli.js'); | ||
@@ -17,3 +25,3 @@ delete require.cache[jsHintCliPath]; | ||
var options = { | ||
args: ['.'], | ||
args: files, | ||
verbose: true, | ||
@@ -23,9 +31,9 @@ reporter: require('./reporter.js')(error) | ||
jsHint.run(options); | ||
process.chdir(cwd); | ||
if (error.message) { | ||
throw error; | ||
return done(error); | ||
} | ||
}); | ||
return done(); | ||
} | ||
}); | ||
}); | ||
}; |
{ | ||
"name": "mocha-jshint", | ||
"version": "1.1.0", | ||
"version": "2.0.0", | ||
"description": "run JSHint as mocha tests", | ||
@@ -19,3 +19,4 @@ "main": "index.js", | ||
"dependencies": { | ||
"jshint": "^2.5" | ||
"jshint": "^2.5", | ||
"uniq": "^1.0.1" | ||
}, | ||
@@ -22,0 +23,0 @@ "directories": { |
@@ -27,2 +27,17 @@ mocha-jshint | ||
using with git | ||
-------------- | ||
If you are using git as version control you can do the following in your test: | ||
```js | ||
require('mocha-jshint')({ | ||
git: { | ||
modified: true, | ||
commits: 2 | ||
} | ||
}); | ||
``` | ||
This means that jshint will only hint the files that are modified according to git, and the files modified in the last | ||
two git commits. | ||
configuring jshint | ||
@@ -49,4 +64,8 @@ ------------------ | ||
Version history | ||
--------------- | ||
2.0: Added git features. Removed old undocumented paths feature. | ||
License | ||
-------- | ||
MIT |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
5296
6
83
69
2
+ Addeduniq@^1.0.1
+ Addeduniq@1.0.1(transitive)