How to export function from module without nodeunit testing it?
- Dominant language
- JavaScript
- Stars
- 1.9k
- Forks
- 359
- PR merge metrics
- No merged PRs in 30d
Description
I've got a few tests scattered throughout multiple files.
Currently I just run `nodeunit .`, nodeunit then tests them all successfully. Great!
But I want to export a function from one of my files so that another can call it. The problem is that when I run `nodeunit .` that function now gets called.
How can I run tests on all files? I'm used to python's `nose` library, which only tests functions that have `test` in the function name.
Do I need to move all tests into a seperate file to the functionality? I don't want to do that. I like putting tests adjacent to the code they're testing.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading nodeunit's test discovery and module-loading behavior around the `nodeunit .` command; the issue names no source files or tests. Compare how exported functions are treated with the desired adjacent-test layout. Done means all intended tests still run without invoking helper functions exported for reuse.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- testing-qa
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100