testdouble / testdouble/testdouble.js

Feature request: reset specific module(s)

Open
#520 7 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.4k
Forks
140
Avg merge
22h
Merged PRs (30d)
1

Description

It would be great if td.reset() optionally accepted a list of modules to reset, like:

td.reset(); // nuclear option → reset everything

td.reset('module-a.js');
td.reset(
  'module-a.js',
  'module-b.js',
);

The problem this solves is avoiding erroneously blowing away global mocks: a particular test may need to mock a specific module; after that test runs, only the module(s) it itself mocked should be reset.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the implementation and tests for td.reset(), then trace how a reset currently clears mocks. Add support for passing one or more module names while preserving the existing no-argument behavior; done means only the specified modules are reset and td.reset() still resets everything.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.