forked from dsheiko/cjsc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
102 lines (96 loc) · 3.02 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
module.exports = function(grunt) {
grunt.loadNpmTasks( "grunt-contrib-jshint" );
grunt.loadNpmTasks( "grunt-mocha-cli" );
grunt.loadNpmTasks( "grunt-jscodesniffer" );
grunt.loadNpmTasks( "grunt-contrib-qunit" );
grunt.initConfig({
jshint: {
options: {
jshintrc: ".jshintrc"
},
all: [ "lib/**/*.js", "test/*.js" ]
},
qunit: {
all: ["test/integration/index.html"]
},
mochacli: {
test: {
options: {
reporter: "spec"
},
src: [ "test/unit/unit-tests.js" ]
}
},
jscs: {
app: {
options: {
standard: "Jquery"
},
files: {
src: [ "./lib" ]
}
},
test: {
options: {
standard: "Jquery",
reportFull: true
},
files: {
src: [ "./lib" ]
}
}
}
});
grunt.registerTask( "build-test", "Build all acceptance tests artifacts", function() {
var done = this.async(),
exec = require("child_process").exec,
EXE = "node cjsc.js",
SRC = "./test/integration",
runExec,
bundles = [
SRC + "/fixtures/generic/main.js " + SRC + "/build/generic.js",
SRC + "/fixtures/umd/main.js " + SRC + "/build/umd.js",
SRC + "/fixtures/non-module/main.js " + SRC + "/build/non-module.js",
SRC + "/fixtures/3rd-party/main.js " + SRC + "/build/3rd-party.js",
SRC + "/fixtures/mustache/main.js " + SRC + "/build/mustache.js",
SRC + "/fixtures/handlebars/main.js " + SRC + "/build/handlebars.js",
SRC + "/fixtures/dependency-config/reference/main.js " + SRC +
"/build/dependency-config-reference.js --config=" + SRC +
"/fixtures/dependency-config/reference/config.json",
SRC + "/fixtures/dependency-config/alias/main.js " + SRC +
"/build/dependency-config-alias.js --config=" + SRC +
"/fixtures/dependency-config/alias/config.json",
SRC + "/fixtures/dependency-config/require-a/main.js " + SRC +
"/build/dependency-config-require-a.js --config=" + SRC +
"/fixtures/dependency-config/require-a/config.json",
SRC + "/fixtures/dependency-config/require-b/main.js " + SRC +
"/build/dependency-config-require-b.js --config=" + SRC +
"/fixtures/dependency-config/require-b/config.json"
];
grunt.log.writeln( "Running test build" );
runExec = function(){
var bundle = bundles.shift(),
cmd = EXE + " " + bundle;
grunt.verbose.writeln( "Exec: " + cmd );
console.log( bundle.replace( /\s.*?$/g, "" ) );
exec( cmd, function( err, stdout ) {
if ( stdout ) {
grunt.log.write( stdout );
if ( bundles.length ) {
runExec();
} else {
done();
}
}
if ( err ) {
grunt.fatal( err );
done();
}
});
};
runExec();
});
grunt.registerTask( "test", [ "jshint", "jscs", "mochacli", "build-test", "qunit" ] );
grunt.registerTask( "integration", [ "jshint", "jscs", "build-test", "qunit" ] );
grunt.registerTask( "default", [ "test" ] );
};