-
Notifications
You must be signed in to change notification settings - Fork 221
/
Gruntfile.js
106 lines (89 loc) · 2.53 KB
/
Gruntfile.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*eslint-env node */
module.exports = function(grunt) {
"use strict";
// run an arbitrary yarn command through grunt, e.g. grunt exec:yarn:build:test -> yarn run build:test
var execConfig = {
yarn: {
cmd: function () {
var yarnCommandName = Array.prototype.slice.call(arguments).join(":");
return "yarn run " + yarnCommandName;
}
}
};
var jscsConfig = {
files: ["Gruntfile.js", "quicktests/**/*.js"],
options: {
config: ".jscsrc"
}
};
var eslintConfig = {
target: ["Gruntfile.js", "quicktests/**/*.js"],
options: {
configFile: ".eslintrc"
}
};
var watchConfig = {
options: {
livereload: true,
spawn: false
},
quicktests: {
tasks: ["update-quicktests"],
files: ["quicktests/overlaying/tests/**/*.js"]
}
};
var blanketMochaConfig = {
all: ["test/coverage.html"],
options: {
// disable coverage for the time being since we intend to replace grunt-blanket-mocha
threshold: 0,
reporter: "spec"
}
};
var connectConfig = {
server: {
options: {
port: 9999,
hostname: "*",
base: "",
livereload: true
}
}
};
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
jscs: jscsConfig,
eslint: eslintConfig,
exec: execConfig,
watch: watchConfig,
"blanket_mocha": blanketMochaConfig,
connect: connectConfig,
});
// Loads the tasks specified in package.json
require("load-grunt-tasks")(grunt);
grunt.registerTask("dev-compile", [
"exec:yarn:build:tsc",
"exec:yarn:build:webpack",
"update-quicktests"
]);
grunt.registerTask("default", ["exec:yarn:start"]);
grunt.registerTask("test", ["dev-compile", "test-local"]);
grunt.registerTask("test-local", ["blanket_mocha"]);
grunt.registerTask("watch-quicktests", function() {
// Surpresses the "Running 'foo' task" messages
grunt.log.header = function() {};
grunt.task.run(["watch"]);
});
grunt.registerTask("lint", ["exec:yarn:lint", "jscs", "eslint"]);
grunt.registerTask("test-ci", ["dev-compile", "lint", "test-local"]);
grunt.registerTask("update-quicktests", function() {
var qtJSON = [];
var rawtests = grunt.file.expand("quicktests/overlaying/tests/**/*.js");
rawtests.forEach(function(value) {
qtJSON.push({ path: value });
});
qtJSON = JSON.stringify(qtJSON);
qtJSON = qtJSON.split(",").join(",\n") + "\n";
grunt.file.write("quicktests/overlaying/list_of_quicktests.json", qtJSON);
});
};