Is it possible to run only one test from nodeunit test file with several tests. My tests.js
file:
module.exports = {
test2: function (test) {
console.log ("test2")
test.done();
},
test1: function (test) {
console.log ("test1")
test.done();
}
};
I can run all tests:
$ nodeunit tests.js
But I want to run only test2 like:
$ nodeunit tests.js test2
Is it possible without spliting file tests.js
into 2 separate files?
See nodeunit -h for the available options (This is for version 0.8.1):
Usage: nodeunit [options] testmodule1.js testfolder [...]
Options:
--config FILE the path to a JSON file with options
--reporter FILE optional path to a reporter file to customize the output
--list-reporters list available build-in reporters
-t name, specify a test to run
-f fullname, specify a specific test to run. fullname is built so: "outerGroup - .. - innerGroup - testName"
-h, --help display this help and exit
-v, --version output version information and exit
So from that the following should do what you want:
$ nodeunit tests.js -t test2
e.g:
$ nodeunit ./tests.js -t test2
tests.js
test2
✔ test2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With