testdouble / testdouble/testdouble.js
Add a warning when trying to replace and already replaced function
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.4k
- Forks
- 140
- Avg merge
- 22h
- Merged PRs (30d)
- 1
Description
We just ran into a strange issue where our tests accidentally replaced the same function twice where the second replace then replaced the testdouble function with yet another one. The td.reset() that is then run after each test only undid the second replace which left us still with with a replaced testdouble function for the next test.
I think it would be great if testdouble could help prevent/fix this situation somehow as - to us - it was very non-obvious what was going on and took some time to debug.
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
The issue names no files, tests, or specific entry points. Start by locating the function-replacement API and the td.reset() cleanup path, then clarify whether repeated replacement should warn, prevent the operation, or restore the original double. Done criteria should cover the second replacement and cleanup between tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100