forked from karma-runner/karma
/
gruntfile.js
153 lines (150 loc) · 3.33 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
pkgFile: 'package.json',
files: {
server: ['lib/**/*.js'],
client: ['client/**/*.js'],
common: ['common/**/*.js'],
context: ['context/**/*.js'],
grunt: ['grunt.js', 'tasks/*.js'],
scripts: ['scripts/init-dev-env.js']
},
browserify: {
client: {
files: {
'static/karma.js': ['client/main.js'],
'static/context.js': ['context/main.js']
}
}
},
test: {
unit: 'mochaTest:unit',
client: 'test/client/karma.conf.js',
e2e: 'cucumberjs:ci'
},
watch: {
client: {
files: '<%= files.client %>',
tasks: 'browserify:client'
}
},
mochaTest: {
options: {
require: 'babel-register',
reporter: 'dot',
ui: 'bdd',
quiet: false,
colors: true
},
unit: {
src: [
'test/unit/mocha-globals.js',
'test/unit/**/*.spec.js'
]
}
},
cucumberjs: {
options: {
steps: 'test/e2e/steps',
format: 'progress',
require: 'test/e2e/support/env.js'
},
all: 'test/e2e/*.feature',
current: {
files: {
src: 'test/e2e/*.feature'
},
options: {
tags: '@current'
}
},
ci: {
files: {
src: 'test/e2e/*.feature'
},
options: {
tags: '~@not-jenkins'
}
}
},
eslint: {
options: {
quiet: true
},
target: [
'<%= files.server %>',
'<%= files.grunt %>',
'<%= files.scripts %>',
'<%= files.client %>',
'<%= files.common %>',
'<%= files.context %>',
'static/debug.js',
'test/**/*.js',
'gruntfile.js'
]
},
'npm-publish': {
options: {
requires: ['build'],
abortIfDirty: true,
tag: 'latest'
}
},
'npm-contributors': {
options: {
commitMessage: 'chore: update contributors'
}
},
conventionalChangelog: {
release: {
options: {
changelogOpts: {
preset: 'angular'
}
},
src: 'CHANGELOG.md'
}
},
conventionalGithubReleaser: {
release: {
options: {
auth: {
type: 'oauth',
token: process.env.GH_TOKEN
},
changelogOpts: {
preset: 'angular'
}
}
}
},
bump: {
options: {
updateConfigs: ['pkg'],
commitFiles: [
'package.json',
'CHANGELOG.md'
],
commitMessage: 'chore: release v%VERSION%',
prereleaseName: 'rc'
}
}
})
grunt.loadTasks('tasks')
require('load-grunt-tasks')(grunt)
grunt.registerTask('build', ['browserify:client'])
grunt.registerTask('default', ['build', 'test', 'lint'])
grunt.registerTask('test-appveyor', ['test:unit', 'test:client'])
grunt.registerTask('release', 'Build, bump and publish to NPM.', function (type) {
grunt.task.run([
'npm-contributors',
'bump:' + (type || 'patch') + ':bump-only',
'build',
'conventionalChangelog',
'bump-commit',
'conventionalGithubReleaser',
'npm-publish'
])
})
}