This repository has been archived by the owner on May 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
108 lines (103 loc) · 2.76 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
107
108
/*jslint node: true, indent: 2, passfail: true */
"use strict";
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jslint: {
all: {
src: ['deferred/*'],
exclude: ['test/*', 'Gruntfile.js'],
directives: {
node: true,
browser: true,
indent: 2,
passfail: true
},
options: {
edition: 'latest'
}
}
},
mochaTest: {
test: {
options: {
reporter: 'dot'
},
src: ['test/*.spec.js']
},
},
mocha: {
test: {
src: ['test/runner.html']
}
},
browserify: {
dist: {
files: {
'build/deferred.browser.js': ['deferred/index.js']
},
options: {
bundleOptions: {
"standalone": "deferredjs"
}
},
},
tests: {
files: {
'build/deferred.tests.browser.js': [
'test/deferred.spec.js',
'test/a_plus.spec.js'
]
},
options: {}
}
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
build: {
files: {
'build/deferred.browser.min.js': ['build/deferred.browser.js'],
'build/deferred.tests.browser.min.js': ['build/deferred.tests.browser.js']
},
}
},
shell: {
prepareBrowserTests: {
command: 'test/install_libs'
},
benchmark: {
command: function (path) {
return 'node ' + path;
}
}
},
watch: {
files: [
'deferred/*.js',
'!node_modules/*'
],
tasks: ['default'],
},
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-jslint');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-mocha');
grunt.loadNpmTasks('grunt-shell');
// Browser tests fail on TravisCI but pass locally. Use the runner.html
// to test the browser functionality until this is resolved.
grunt.registerTask('default', ['jslint', 'mochaTest', 'browserify', 'uglify', 'shell:prepareBrowserTests']);
grunt.registerTask('build', ['browserify', 'uglify', 'shell:prepareBrowserTests']);
grunt.registerTask('benchmark', [
'shell:benchmark:benchmarks/comparisons/instance.js',
'shell:benchmark:benchmarks/comparisons/resolve.js',
'shell:benchmark:benchmarks/comparisons/resolveMultiple.js',
'shell:benchmark:benchmarks/comparisons/resolvePromise.js',
'shell:benchmark:benchmarks/comparisons/then.js',
'shell:benchmark:benchmarks/comparisons/thenMultiple.js'
]);
};