Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finish jest.clearAllMocks() implementation #9217

Merged
merged 1 commit into from
Mar 3, 2024

Conversation

Jarred-Sumner
Copy link
Collaborator

What does this PR do?

#9081 added support for jest.clearAllMocks() when the mock was created via spyOn, but not when the mock was created via jest.fn or mock(() => {}).

This adds support for those cases as well by having a separate WeakSet for all mocked functions (instead of only spies).

How did you verify your code works?

There is a test

@Jarred-Sumner
Copy link
Collaborator Author

@dylan-conway i'm going to merge but please take a look when you get a chance

Copy link
Contributor

github-actions bot commented Mar 3, 2024

Copy link
Contributor

github-actions bot commented Mar 3, 2024

Copy link
Contributor

github-actions bot commented Mar 3, 2024

Copy link
Contributor

github-actions bot commented Mar 3, 2024

@Jarred-Sumner Jarred-Sumner merged commit 49ccad9 into main Mar 3, 2024
26 of 31 checks passed
@Jarred-Sumner Jarred-Sumner deleted the jarred/fix-jest-clearAllMocks branch March 3, 2024 11:48
Copy link
Contributor

github-actions bot commented Mar 3, 2024

❌🪟 @Jarred-Sumner, there are 12 test regressions on Windows x86_64

  • test\cli\run\as-node.test.ts
  • test\cli\run\transpiler-cache.test.ts
  • test\js\bun\dns\resolve-dns.test.ts
  • test\js\bun\http\fetch-file-upload.test.ts
  • test\js\bun\http\bun-server.test.ts
  • test\js\bun\shell\shelloutput.test.ts
  • test\js\bun\shell\throw.test.ts
  • test\js\node\dns\node-dns.test.js
  • test\js\node\process\process-args.test.js
  • test\js\web\fetch\body-stream-excess.test.ts
  • test\js\web\fetch\body-stream.test.ts
  • test\js\web\websocket\websocket.test.js

Full Test Output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant