Run object instead of runFiles?
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in nodeunit.js around lines 61–81 and inspect how the default reporter's run method handles its input array and requires test files. Compare the requested file-based and in-memory module cases, then verify that both forms execute correctly and that the existing behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- backend, testing-qa
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100