Run object instead of runFiles?
- Dominant language
- JavaScript
- Stars
- 1.9k
- Forks
- 359
- PR merge metrics
- No merged PRs in 30d
Description
In nodeunit, whenever you call
nodeunit.reporters["default"].run(["a","b"]);
it will always, eventually, require("a") as a test and run it, then require("b") and then run it.
What if you want to load files on your own, or even define tests in memory, never saving to a file? As an example, I could see loading a file, doing some manipulation, and only then passing it through to nodeunit.
In this scenario, the two run() calls below would be equivalent:
var a = require("a");
nodeunit.reporters["default"].run(["a"]);
nodeunit.reporters["default"].runModule(a);
But the second option gives me the ability to do:
var a = require("a");
a.doSomeMod();
nodeunit.reporters["default"].runModule(a);
Even better, you don't need runModule. All you need is for run() to check each option in the array; if it is a string, require() it as a file, else just use it as is.
Whole change set could probably be done in nodeunit.js ll 61-81.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.