Rev | Line | |
---|
[483] | 1 | define(["doh/runner", "require", "dojo/_base/config"], function(doh, require, config){ |
---|
| 2 | /*===== |
---|
| 3 | return { |
---|
| 4 | // summary: |
---|
| 5 | // Module for running DOH tests in node (as opposed to a browser). |
---|
| 6 | // Augments return value from doh/runner. |
---|
| 7 | }; |
---|
| 8 | =====*/ |
---|
| 9 | |
---|
| 10 | doh.debug= console.log; |
---|
| 11 | doh.error= console.log; |
---|
| 12 | |
---|
| 13 | // Override the doh._report method to make it quit with an |
---|
| 14 | // appropriate exit code in case of test failures. |
---|
| 15 | var oldReport = doh._report; |
---|
| 16 | doh._report = function(){ |
---|
| 17 | oldReport.apply(doh, arguments); |
---|
| 18 | if(this._failureCount > 0 || this._errorCount > 0){ |
---|
| 19 | process.exit(1); |
---|
| 20 | } |
---|
| 21 | }; |
---|
| 22 | |
---|
| 23 | console.log("\n"+doh._line); |
---|
| 24 | console.log("The Dojo Unit Test Harness, $Rev: f5832f7 $"); |
---|
| 25 | console.log("Copyright (c) 2011, The Dojo Foundation, All Rights Reserved"); |
---|
| 26 | console.log("Running with node.js"); |
---|
| 27 | for (var tests= [], args= config["commandLineArgs"], i= 0, arg; i<args.length; i++) { |
---|
| 28 | arg= args[i]; |
---|
| 29 | if (arg.length==2 && arg[0]=="test") { |
---|
| 30 | var test= arg[1]; |
---|
| 31 | console.log("loading test " + test); |
---|
| 32 | tests.push(test); |
---|
| 33 | } |
---|
| 34 | } |
---|
| 35 | console.log(doh._line, "\n"); |
---|
| 36 | |
---|
| 37 | require(tests, function() { |
---|
| 38 | doh.run(); |
---|
| 39 | }); |
---|
| 40 | }); |
---|
Note: See
TracBrowser
for help on using the repository browser.