A serverless version of the grunt-contrib-qunit task. The intent of this task is to be able to run your qunit tests without spinning up a web server.
npm install grunt-qunit-serverless --save
var cfg = {
"qunit-serverless": {
all: {
options: {
headerScript: "window.headerObj = true;",
includeFiles: [path.join("test", "res", "includes", "*.js")],
testFiles: [path.join("test", "res", "tests", "*.js")],
templateFiles: [path.join("test", "res", "templates", "*.stache")]
}
}
}
};
grunt.initConfig(cfg);
grunt.loadNpmTasks("grunt-qunit-serverless");
grunt.registerTask("default", ["qunit-serverless"]);
The path to the qunit.js file you would like to use. Otherwise, we will default to one that is included with the npm package.
The path to the qunit.css file you would like to use. Otherwise, we will default to one that is included with the npm package.
The path to the PhantomJS to QUnit bridge script file you would like to use. Otherwise, we will default to noe that is included with the npm package that is based on one from grunt-contrib-qunit.
A test filter to pass to the qunit runner; can limit the number of tests you run. Also can be passed in via command line as --qunit-filter="something"
.
The path to an underscore template file that will build the qunit test page. Defaults to one that is included with the npm package.
Raw JavaScript that you would like to include at the top of the page. Not intended to be very long. See other options for how to include files (such as libraries).
A grunt.file.expand(...)
argument array describing the files you'd like to include before qunit.
A grunt.file.expand(...)
argument array describing the test files to include.
A grunt.file.expand(...)
argument array describing template files you'd like to include after the test files.
A boolean value that when set to a truthy value indicates that only the html file should be built and its path output to the console.
As of version 0.2.0 you can build your own reporter based on a simple interface shown below, the default is a Spec based reported similar to the Mocha Spec reporter.
{
start: function(pageUrl) {
},
complete: function(state) {
},
moduleStart: function(name) {
},
moduleEnd: function(name, failed, passed, total) {
},
testStart: function(name) {
},
testDone: function(name) {
},
assertionPassed: function(message) {
},
assertionFailed: function(actual, expected, message, source) {
}
}
This library is licensed under the MIT License. Portions of this code were taken from the grunt-contrib-qunit task.