forked from plotly/plotly.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsyntax_test.js
More file actions
33 lines (24 loc) · 890 Bytes
/
syntax_test.js
File metadata and controls
33 lines (24 loc) · 890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
var path = require('path');
var fs = require('fs');
var jshint = require('jshint').JSHINT;
var glob = require('glob');
var constants = require('../tasks/util/constants');
var focusGlobals = ['fdescribe', 'fit'];
var logs = [];
glob(path.join(constants.pathToJasmineTests, '**/*.js'), function(err, files) {
files.forEach(function(file) {
var code = fs.readFileSync(file, 'utf-8');
jshint(code);
var impliedGlobals = jshint.data().implieds;
impliedGlobals.forEach(function(obj) {
if(focusGlobals.indexOf(obj.name) !== -1) {
logs.push([
path.basename(file),
'[line ' + obj.line + '] :',
'contains either a *fdescribe* or a *fit* block.'
].join(' '));
}
});
});
if(logs.length) throw new Error(logs.join('\n'));
});