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 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
|
/*jshint node:true */
module.exports = function( grunt ) {
require( "load-grunt-tasks" )( grunt );
function process( code, filepath ) {
// Make coverage ignore external files
if ( filepath.match( /^external\// ) ) {
code = "/*istanbul ignore next */\n" + code;
}
return code
// Embed version
.replace( /@VERSION/g, grunt.config( "pkg" ).version )
// Embed date (yyyy-mm-ddThh:mmZ)
.replace( /@DATE/g, ( new Date() ).toISOString().replace( /:\d+\.\d+Z$/, "Z" ) );
}
// Prevents CRLF EOL on Windows environments
// grunt-contrib-concat defaults to CRLF on Windows if this is unset
grunt.util.linefeed = "\u000A";
grunt.initConfig( {
pkg: grunt.file.readJSON( "package.json" ),
concat: {
options: { process: process },
"src-js": {
src: [
"src/intro.js",
"src/core/initialize.js",
"src/core/utilities.js",
"src/core/stacktrace.js",
"src/core/config.js",
"src/core/logging.js",
"src/core/onerror.js",
"src/core.js",
"src/test.js",
"src/assert.js",
"src/equiv.js",
"src/dump.js",
"src/export.js",
"src/outro.js",
"reporter/intro.js",
"reporter/urlparams.js",
"reporter/html.js",
"reporter/diff.js",
"reporter/outro.js"
],
dest: "dist/qunit.js"
},
"src-css": {
src: "src/qunit.css",
dest: "dist/qunit.css"
}
},
jshint: {
options: {
jshintrc: true
},
all: [
"*.js",
"{test,dist}/**/*.js",
"build/*.js",
"build/tasks/**/*.js"
]
},
jscs: {
options: {
config: ".jscsrc"
},
all: [
"<%= jshint.all %>",
"!test/main/deepEqual.js"
]
},
search: {
options: {
// Ensure that the only HTML entities used are those with a special status in XHTML
// and that any common singleton/empty HTML elements end with the XHTML-compliant
// "/>"rather than ">"
searchString: /(&(?!gt|lt|amp|quot)[A-Za-z0-9]+;|<(?:hr|HR|br|BR|input|INPUT)(?![^>]*\/>)(?:\s+[^>]*)?>)/g,
logFormat: "console",
failOnMatch: true
},
xhtml: [
"src/**/*.js",
"reporter/**/*.js"
]
},
qunit: {
options: {
timeout: 30000,
"--web-security": "no",
coverage: {
src: "dist/qunit.js",
instrumentedFiles: "temp/",
htmlReport: "build/report/coverage",
lcovReport: "build/report/lcov",
linesThresholdPct: 70
}
},
qunit: [
"test/index.html",
"test/autostart.html",
"test/startError.html",
"test/reorderError1.html",
"test/reorderError2.html",
"test/logs.html",
"test/setTimeout.html",
"test/amd.html",
"test/reporter-html/index.html",
"test/reporter-html/legacy-markup.html",
"test/reporter-html/no-qunit-element.html",
"test/reporter-html/single-testid.html",
"test/reporter-urlparams.html",
"test/moduleId.html",
"test/only.html",
"test/random.html",
"test/regex-filter.html",
"test/regex-exclude-filter.html",
"test/string-filter.html"
]
},
coveralls: {
options: {
force: true
},
all: {
// LCOV coverage file relevant to every target
src: "build/report/lcov/lcov.info"
}
},
"test-on-node": {
files: [
"test/logs",
"test/main/test",
"test/main/assert",
"test/main/async",
"test/main/promise",
"test/main/modules",
"test/main/deepEqual",
"test/main/stack",
"test/globals-node",
"test/only",
"test/setTimeout",
"test/main/dump"
]
},
concurrent: {
build: [
"concat:src-js",
"concat:src-css"
],
test: [
"jshint",
"jscs",
"search",
"qunit",
"test-on-node"
]
},
watch: {
options: {
atBegin: true,
spawn: false,
interrupt: true
},
files: [
".jshintrc",
"*.js",
"build/*.js",
"{src,test,reporter}/**/*.js",
"src/qunit.css",
"test/**/*.html"
],
tasks: "default"
}
} );
grunt.loadTasks( "build/tasks" );
grunt.registerTask( "build", [ "concat" ] );
grunt.registerTask( "default", [ "concurrent:build", "concurrent:test" ] );
};
|