forked from marmelab/ng-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
94 lines (88 loc) · 3.07 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
/*global module*/
module.exports = function (grunt) {
'use strict';
// Define the configuration for all the tasks
grunt.initConfig({
copy: {
test_build: {
src: 'build/*',
dest: 'src/javascripts/test/fixtures/examples/blog/'
},
test_sample_app: {
src: 'examples/blog/*',
dest: 'src/javascripts/test/fixtures/',
options: {
process: function(content) {
return content.replace(/http\:\/\/localhost\:8080\//g, '/');
}
}
}
},
connect: {
dev: {
options: {
port: 8000,
base: 'examples/blog/',
keepalive: false,
livereload: false
}
},
test: {
options: {
port: 8000,
base: 'src/javascripts/test/fixtures/examples/blog/',
keepalive: false,
livereload: false
}
}
},
json_server: {
stub: {
options: {
port: 3000,
db: 'examples/blog/stub-server.json',
keepalive: false,
logger: false
}
}
},
karma: {
unit: {
configFile: 'src/javascripts/test/karma.conf.js',
singleRun: process.env.KARMA_SINGLE_RUN !== 'false'
}
},
protractor: {
e2e: {
configFile: 'src/javascripts/test/protractor.conf.js',
keepAlive: true,
debug: true
}
},
mochaTest: {
test: {
options: {
require: 'mocha-traceur'
},
src: ['src/javascripts/ng-admin/es6/tests/**/*.js']
}
},
exec: {
webpack: './node_modules/webpack/bin/webpack.js',
webpack_watch: './node_modules/webpack-dev-server/bin/webpack-dev-server.js --colors'
}
});
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-exec');
grunt.loadNpmTasks('grunt-protractor-runner');
grunt.loadNpmTasks('grunt-json-server');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.registerTask('test', ['mochaTest', 'karma', 'test:e2e']);
grunt.registerTask('test:e2e', ['test:e2e:prepare', 'json_server', 'connect:test', 'protractor']);
grunt.registerTask('test:e2e:prepare', ['exec:webpack', 'copy:test_sample_app', 'copy:test_build']);
grunt.registerTask('test:local', ['mochaTest', 'karma', 'test:local:e2e']);
grunt.registerTask('test:local:e2e', ['test:e2e:prepare', 'json_server', 'connect:test', 'protractor']);
grunt.registerTask('default', ['json_server', 'connect:dev', 'exec:webpack_watch']);
};