This repository has been archived by the owner on Sep 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGruntfile.js
112 lines (109 loc) · 3.05 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
/* global module:true, require:true */
/* eslint-disable disable-line global-require */
/* eslint-disable object-curly-newline */
module.exports = function(grunt) {
'use strict';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
fixturesPath: 'test/fixtures',
concat: {
dist: {
src: [
'node_modules/dompurify/src/*.js',
'node_modules/acorn/dist/acorn.js',
'node_modules/acorn/dist/acorn_loose.js',
'src/sanitizer.js'
],
dest: 'dist/sanitizer.js'
}
},
htmlbuild: {
commonTests: {
src: [
'test/fixtures/*.html'
],
dest: 'tmp/samples/',
options: {
beautify: true,
relative: true,
scripts: {
bundle: [
'dist/sanitizer.js'
]
},
styles: {
bundle: [
]
}
}
}
},
connect: {
server: {
options: {
port: 9000,
hostname: '*',
keepalive: false
}
}
},
casper: {
dist: {
options: {
args: ['--web-security=no'],
test: true,
concise: true,
parallel: true,
concurrency: 2
},
files: {
'xunit/casper-results.xml': ['test/run.js'],
'xunit/casper-results-loose.xml': ['test/runLoose.js']
}
}
},
eslint: {
target: {
src: ['src/*.js', 'Gruntfile.js', 'test/**/*.js']
}
},
jsvalidate: {
options: {
globals: {},
esprimaOptions: {},
verbose: true
},
targetName: {
files: {
src: ['Gruntfile.js', 'src/*.js', 'test/**/*.js']
}
}
},
clean: ['tmp/']
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-jsvalidate');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-html-build');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-casper');
grunt.loadNpmTasks('grunt-contrib-clean');
// Building.
grunt.registerTask('build', [
'jsvalidate',
'eslint',
'concat'
]);
// Testing.
grunt.registerTask('test', [
'htmlbuild',
'connect',
'casper:dist',
'clean'
]);
// Default task.
grunt.registerTask('default', [
'build', 'test'
]);
};