This repository has been archived by the owner on Feb 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 91
/
Gruntfile.js
118 lines (108 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
const webpackDevConfig = require('./webpack.dev');
const webpackProdConfig = require('./webpack.prod');
module.exports = function (grunt) {
var config = {
pkg: grunt.file.readJSON('package.json'),
run: {
jest: {
cmd: 'jest'
}
},
eslint: {
options: {
fix: true
},
target: 'lib'
},
webpack: {
dev: webpackDevConfig,
prod: webpackProdConfig
},
karma: {
with_coverage: {
options: {
preprocessors: {
'dist/jose.js': ['coverage']
},
reporters: ['coverage', 'progress'],
coverageReporter: {
type: 'lcovonly',
dir: 'coverage/'
},
frameworks: ['qunit'],
files: [
{ pattern: 'dist/jose.js', watching: false, included: true },
{ pattern: 'test/qunit-promises.js', watching: false, included: true },
'test/jose-*.js'
],
client: {
clearContext: false,
qunit: {
showUI: true,
testTimeout: 5000
}
},
autoWatch: true,
browsers: ['Chrome', 'ChromeHeadless', 'ChromeHeadlessNoSandbox'],
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
}
},
singleRun: true,
plugins: ['karma-coverage', 'karma-qunit', 'karma-chrome-launcher']
}
},
without_coverage: {
options: {
frameworks: ['qunit'],
files: [
{ pattern: 'dist/jose.js', watching: false, included: true },
{ pattern: 'test/qunit-promises.js', watching: false, included: true },
'test/jose-*.js'
],
client: {
clearContext: false,
qunit: {
showUI: true,
testTimeout: 5000
}
},
autoWatch: true,
browsers: ['Chrome'],
browserConsoleLogOptions: {
level: 'info',
format: '%b %T: %m',
path: 'output.log',
terminal: true
},
singleRun: true,
logLevel: 'info'
}
}
},
coveralls: {
options: {
debug: true,
coverageDir: 'coverage',
force: true,
recursive: true
}
}
};
if (process.env.TRAVIS) {
config.karma.with_coverage.browsers = ['ChromeHeadlessNoSandbox'];
config.karma.without_coverage.browsers = ['ChromeHeadlessNoSandbox'];
}
grunt.initConfig(config);
grunt.loadNpmTasks('grunt-run');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-karma-coveralls');
grunt.loadNpmTasks('grunt-webpack');
grunt.registerTask('default', ['eslint', 'run:jest', 'webpack', 'karma:without_coverage']);
grunt.registerTask('with_coverage', ['eslint', 'run:jest', 'webpack', 'karma:with_coverage']);
};