testdouble / testdouble/testdouble.js
td.reset(thingsBlewUpSoPleaseLogWarnings=true)
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.4k
- Forks
- 140
- Avg merge
- 22h
- Merged PRs (30d)
- 1
Description
Proposal: a new top-level method designed to be run in an afterEach block of the user's tests, and passed a boolean as to whether or not the test failed.
When td.reset(true) is called, td.js will log a warning to the console that contains a summary of the state of all the test doubles known to it since the last reset, including what they were all invoked with.
Like #161, this would be organized stubbying-by-stubbing ("this stubbing was never satisfied (red flag!)", and "this stubbing was satisfied by these three calls: [list]"`
Not all tests allow for this, but many do. And for those that don't, the user could set the var themselves to manually introspect like so: afterEach(() => td.whatWentWrong(process.env.UGH))
I think this could be a solution to all the issues where people want to sprinkle in td.verify() calls for better messages alone like #148 & #138
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 by reviewing the proposed td.reset(true) and td.whatWentWrong entry points, then read the related issues #161, #148, and #138 for context. Done should include a warning summarizing known test doubles and their calls after a failed test, with unsatisfied stubbings distinguished from satisfied ones.
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