UNPKG

812 BJavaScriptView Raw
1var path = require('path');
2module.exports = function (paths) {
3 describe('jshint', function () {
4 paths = paths || ['.'];
5 paths.forEach(function (p) {
6 it('should pass for ' + (p === '.' ? 'working directory' : p), function () {
7 this.timeout(30000);
8 var cwd = process.cwd();
9 process.chdir(path.resolve(p));
10 var jsHintCliPath = path.resolve(path.dirname(require.resolve('jshint')), 'cli.js');
11 delete require.cache[jsHintCliPath];
12 var jsHint = require(jsHintCliPath);
13 var error = new Error('');
14 error.message = '';
15 error.stack = '';
16 var options = {
17 args: ['.'],
18 reporter: require('./reporter.js')(error)
19 };
20 jsHint.run(options);
21 process.chdir(cwd);
22 if (error.message) {
23 throw error;
24 }
25 });
26 });
27 });
28};