UNPKG

1.66 kBMarkdownView Raw
1mocha-jshint
2------------
3
4Run jshint as Mocha tests.
5
6To install in your node.js project as devDependency, run this command, in the root of your project
7```
8npm install mocha-jshint --save-dev
9```
10
11usage
12-----
13Mocha defaults to looking for your test specs in the `test` folder of your project.
14Add this file as `test/jshint.spec.js` in your project, with the following content:
15
16```js
17require('mocha-jshint')();
18```
19
20That is it you are done.
21
22To grep only the jshint test, just do
23```
24mocha --grep jshint
25```
26
27configuring jshint
28------------------
29In the root of your project you can add a `.jshintignore` file, where each line is a file or directory for jshint to ignore
30and not check for errors. (see this project for an example)
31
32At the root of your project you can add a `.jshintrc` file, that specifies what options you want jshint to run with
33(see this project for an example)
34
35You can also add a `.jshintrc` file to any subdirectory of your project, to override the .jshintrc settings in the root.
36For example in this project I allow some global variables in the `test` folder. Global variables that are set when I
37run mocha tests. Global variables that are only allowed to be used, in the .js files in the test folder
38
39Why?
40---
41This module was created to:
42
43- Make adding jshint testing to a project using Mocha as easy as possible
44- Make it easy to piggyback on all the different Mocha reporters (dot, spec, teamcity etc) for jshint output
45- Make sure that you get a click-able link directly to the problem in WebStorm, when jshint fails
46- Make sure that there is no unnecessary noise in the test output
\No newline at end of file