Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mocha-jshint

Package Overview
Dependencies
Maintainers
6
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mocha-jshint - npm Package Compare versions

Comparing version 1.1.0 to 2.0.0

git.js

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
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc