-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Remove console-testing-library
#4603
base: master
Are you sure you want to change the base?
Remove console-testing-library
#4603
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit bb729ff:
|
✅ Deploy Preview for redux-starter-kit-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for redux-starter-kit-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for redux-starter-kit-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for redux-starter-kit-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
e787d07
to
4a5972b
Compare
8a2b7fd
to
e65a623
Compare
hmm, what's the benefit of switching away from console-testing-library? |
It seemed to be a good idea back then but I think at this point it's more tech debt. I do have a request here though, will add something. |
const noop = () => {} | ||
vi.spyOn(console, 'error').mockImplementation(noop) | ||
}) | ||
const consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation(noop) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just wanted to suggest that we do
const consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation(noop) | |
using consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation(noop) |
inside the tests that actually need this, and skip the mockClear
and mockRestore
calls, but I'm not sure if vitest
actually returns a Disposable
here. I know jest
does (because I added the functionality there) - could you check if vitest
has that now, too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure I can try it. The type tests will probably fail, so I'll probably exclude the runtime tests from the type tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like vitest
doesn't return a Disposable
, though I might try to submit a PR to add that functionality for vitest
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will definitely be a win in the long run, even if it's not applicable to this PR in the end :)
@EskiMojo14 There is multiple reasons:
|
e65a623
to
9d1ebb7
Compare
10738c3
to
bdf6dcc
Compare
6e6368f
to
c23567d
Compare
72056e5
to
967bc39
Compare
967bc39
to
34f4e24
Compare
34f4e24
to
5ceef38
Compare
…iddleware.test.ts`
- `.mockReset()` should not be called in spies since it calls `.mockClear()` and returns the implementation to its **initial** form. In this case it was silencing some of the `act` related warnings emitted by `@testing-library/react` which needed to be resolved since they were calling issues. So `.mockReset()` calls on spies need to be changed to `.mockRestore()` calls since `.mockRestore()` restores the implementation to its **original** form.
fede3e6
to
f96ba63
Compare
f96ba63
to
bb729ff
Compare
This PR:
console-testing-library
(part of Centralize tooling configs in monorepo #4138).jest-snapshot
fromresolutions
field of rootpackage.json
.