-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathJakefile.js
69 lines (61 loc) · 1.42 KB
/
Jakefile.js
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Copyright (c) 2014 Titanium I.T. LLC. All rights reserved. For license, see "README" or "LICENSE" file.
/*global desc, task, jake, fail, complete, directory*/
"use strict";
var jshint = require("simplebuild-jshint");
var Mocha = require("mocha");
desc("Validate code (lint and test)");
task("default", ["lint", "test"], function() {
console.log("\n\nBUILD OK");
});
desc("Lint everything");
task("lint", function() {
process.stdout.write("Linting JavaScript: ");
jshint.checkFiles({
files: [ "*.js", "src/**/*.js" ],
options: lintOptions(),
globals: lintGlobals()
}, complete, fail);
}, { async: true });
desc("Run tests");
task("test", function() {
console.log("Testing JavaScript: ");
var mocha = new Mocha({ ui: "bdd", reporter: "dot" });
testFiles().forEach(mocha.addFile.bind(mocha));
mocha.run(function(failures) {
if (failures) fail("Tests failed");
else complete();
});
}, {async: true});
function testFiles() {
var files = new jake.FileList();
files.include("src/**/_*_test.js");
return files.toArray();
}
function lintOptions() {
return {
esversion: 8,
bitwise: true,
curly: false,
eqeqeq: true,
forin: true,
immed: true,
latedef: false,
newcap: true,
noarg: true,
noempty: true,
nonew: true,
regexp: true,
undef: true,
strict: true,
trailing: true,
node: true
};
}
function lintGlobals() {
return {
beforeEach: false,
afterEach: false,
describe: false,
it: false
};
}