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

fix: independently mock each instance's methods for mocked class #4564

Merged
merged 20 commits into from
Dec 4, 2023

Conversation

hi-ogawa
Copy link
Contributor

@hi-ogawa hi-ogawa commented Nov 21, 2023

Description

I think the relevant code on jest is around here and it looks like jest is mocking each instance method on construction:
https://github.com/jestjs/jest/blob/2c3d2409879952157433de215ae0eee5188a4384/packages/jest-mock/src/index.ts#L678-L691

I also created https://stackblitz.com/edit/jest-example-z6bfab?file=mocked-class.test.js to compare with jest's behavior.

The approach I took here might not be robust to cover some potential edge cases, but at least for common usages, this fix is a simple one and reasonably makes sense to me.
I was also wondering if such fix/feature could be moved to tinyspy, but I'm not too familiar with the whole concept, so I would like maintainers to review my current approach at this stage to gather opinions.
I left a few TODOs in the code, so I would also appreciate if you have any input for those.
Thanks for the review!

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • Ideally, include a test that fails without this PR but passes with it.
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.

Tests

  • Run the tests with pnpm test:ci.

Documentation

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

Copy link

netlify bot commented Nov 21, 2023

Deploy Preview for fastidious-cascaron-4ded94 canceled.

Name Link
🔨 Latest commit e4bad94
🔍 Latest deploy log https://app.netlify.com/sites/fastidious-cascaron-4ded94/deploys/656a94390851730008068f37

@hi-ogawa hi-ogawa changed the title fix: mock each class instance's method separately fix: mock each class instance method Nov 21, 2023
@hi-ogawa hi-ogawa changed the title fix: mock each class instance method fix: mock each class instance method on construction Nov 21, 2023
@hi-ogawa hi-ogawa changed the title fix: mock each class instance method on construction fix: mock each class instance method on construction of mocked class Nov 21, 2023
@hi-ogawa hi-ogawa changed the title fix: mock each class instance method on construction of mocked class fix: mock each instance's method independently for mocked class Nov 21, 2023
@hi-ogawa hi-ogawa changed the title fix: mock each instance's method independently for mocked class fix: independently mock each instance's method for mocked class Nov 21, 2023
@hi-ogawa hi-ogawa changed the title fix: independently mock each instance's method for mocked class fix: independently mock each instance's methods for mocked class Nov 22, 2023
@hi-ogawa hi-ogawa marked this pull request as ready for review November 22, 2023 05:47
const type = getType(value)
const isFunction = type.includes('Function') && typeof value === 'function'
if (isFunction) {
// TODO: ability to restore?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to restore it in jest?

Copy link
Contributor Author

@hi-ogawa hi-ogawa Nov 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the behavior on Jest here https://stackblitz.com/edit/jest-example-z6bfab?file=mocked-class-restore.test.js
I might be using mockRestore incorrectly, but Jest doesn't seem to support such use case.
I added a similar test case for Vitest 5b60bbc and mockRestore is currently not working either but in a different way.
Would you wish to align this behavior? (or maybe make it better?)
Personally I think supporting this use case could be done separately as a nice-to-have feature.


Actually, I haven't checked what current Vitest's behavior is. I'll compare with that too later.
(EDIT: here it is https://stackblitz.com/edit/vitest-dev-vitest-hao9hx?file=test%2Fmocked-class-restore.test.ts)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I missed one important context #3438 and the rational of this mockRestore override:

mock.mockRestore = () => {
mock.mockReset()
mock.mockImplementation(() => undefined)
return mock
}

I don't think my current implementation considers global mock restore use case. I think I understand what's the expected behavior, so let me deal with this and I'll add an appropriate test case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I update the code so that constructor mocking is preserved after vi.restoreAllMocks, which I think is a desired behavior aligning with #3438.

I made separate test cases mocked-class-restore-explicit.test.ts (to test mockFn.mockRestore) and mocked-class-restore-all.test.ts (to test vi.restoreAllMocks). The "explicit" scenario is still not aligned with Jest's behavior but I feel this use case is unusual and might be difficult to support.
I'd like to know what you think about this scenario. Thanks!

packages/vitest/src/runtime/mocker.ts Outdated Show resolved Hide resolved
renovate bot added a commit to JoshuaKGoldberg/sinon-timers-repeatable that referenced this pull request Dec 7, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [vitest](https://togithub.com/vitest-dev/vitest)
([source](https://togithub.com/vitest-dev/vitest/tree/HEAD/packages/vitest))
| [`^0.34.6` ->
`^1.0.0`](https://renovatebot.com/diffs/npm/vitest/0.34.6/1.0.0) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/vitest/1.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/vitest/1.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/vitest/0.34.6/1.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/vitest/0.34.6/1.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>vitest-dev/vitest (vitest)</summary>

###
[`v1.0.0`](https://togithub.com/vitest-dev/vitest/releases/tag/v1.0.0)

[Compare
Source](https://togithub.com/vitest-dev/vitest/compare/v0.34.6...v1.0.0)

#####    🚨 Breaking Changes

- Add support for `pool` and `poolOptions`, remove old flags  -  by
[@&#8203;AriPerkkio](https://togithub.com/AriPerkkio) in
[vitest-dev/vitest#4172
[<samp>(114a9)</samp>](https://togithub.com/vitest-dev/vitest/commit/114a993c)
- Enable `coverage.all` by default  -  by
[@&#8203;AriPerkkio](https://togithub.com/AriPerkkio) in
[vitest-dev/vitest#4265
[<samp>(5a741)</samp>](https://togithub.com/vitest-dev/vitest/commit/5a741ca2)
- Set `vitest` peer dependency range for sub packages  -  by
[@&#8203;AriPerkkio](https://togithub.com/AriPerkkio) in
[vitest-dev/vitest#4299
[<samp>(cd03c)</samp>](https://togithub.com/vitest-dev/vitest/commit/cd03cb51)
- Bump minimum node version to 18 and match Vite 5 requirement  -  by
[@&#8203;ghiscoding](https://togithub.com/ghiscoding) in
[vitest-dev/vitest#4296
[<samp>(263b7)</samp>](https://togithub.com/vitest-dev/vitest/commit/263b7167)
- Remove deprecated node loader  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4371
[<samp>(29299)</samp>](https://togithub.com/vitest-dev/vitest/commit/29299f3c)
- Move browser providers to
[@&#8203;vitest/browser](https://togithub.com/vitest/browser) package
 -  by [@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4364
[<samp>(5cdeb)</samp>](https://togithub.com/vitest-dev/vitest/commit/5cdeb558)
- Remove EnhancedSpy type, deprecate SpyInstance, improve mocks and vi
documentation  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) and
[@&#8203;dammy001](https://togithub.com/dammy001) in
[vitest-dev/vitest#4400
[<samp>(d40b3)</samp>](https://togithub.com/vitest-dev/vitest/commit/d40b3a58)

#####    🚀 Features

- Add Marko example and include code coverage for Marko files  -  by
[@&#8203;DylanPiercey](https://togithub.com/DylanPiercey) in
[vitest-dev/vitest#4263
[<samp>(eac77)</samp>](https://togithub.com/vitest-dev/vitest/commit/eac77765)
- Update magic-string  -  by [@&#8203;bluwy](https://togithub.com/bluwy)
in
[vitest-dev/vitest#4345
[<samp>(fde18)</samp>](https://togithub.com/vitest-dev/vitest/commit/fde1843e)
- Implement provide/inject API to transfer data from the main thread  - 
by [@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4422
[<samp>(a7522)</samp>](https://togithub.com/vitest-dev/vitest/commit/a75228f1)
- Improve expectTypeOf error messages  -  by
[@&#8203;mmkal](https://togithub.com/mmkal), **Misha Kaletsky** and
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4206
[<samp>(18300)</samp>](https://togithub.com/vitest-dev/vitest/commit/183005e9)
- Add test.sequential() api  -  by
[@&#8203;dsyddall](https://togithub.com/dsyddall) in
[vitest-dev/vitest#4512
[<samp>(c3619)</samp>](https://togithub.com/vitest-dev/vitest/commit/c3619c78)
- Allow custom pools  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4417
[<samp>(a3fd5)</samp>](https://togithub.com/vitest-dev/vitest/commit/a3fd5f85)
- Add --project option to limit what projects are running  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va),
[@&#8203;dammy001](https://togithub.com/dammy001) and
[@&#8203;AriPerkkio](https://togithub.com/AriPerkkio) in
[vitest-dev/vitest#4561
[<samp>(58ef5)</samp>](https://togithub.com/vitest-dev/vitest/commit/58ef51a9)
-   **benchmark**:
- Move importTinybench to runner  -  by
[@&#8203;Dunqing](https://togithub.com/Dunqing) in
[vitest-dev/vitest#4376
[<samp>(c36d2)</samp>](https://togithub.com/vitest-dev/vitest/commit/c36d2b97)
-   **browser**:
- Support "none" provider and update lit example to use it  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4427
[<samp>(d03a2)</samp>](https://togithub.com/vitest-dev/vitest/commit/d03a2a21)
-   **coverage**:
- Support `/* v8 ignore...` ignore hints  -  by
[@&#8203;AriPerkkio](https://togithub.com/AriPerkkio) in
[vitest-dev/vitest#4573
[<samp>(f9e4a)</samp>](https://togithub.com/vitest-dev/vitest/commit/f9e4ad83)
-   **expect**:
- Support `expect.closeTo` api  -  by
[@&#8203;Dunqing](https://togithub.com/Dunqing) and **golebiowskib** in
[vitest-dev/vitest#4260
[<samp>(7f91c)</samp>](https://togithub.com/vitest-dev/vitest/commit/7f91c6f6)
- ToContain can handle classList and Node.contains  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4239
[<samp>(ce84f)</samp>](https://togithub.com/vitest-dev/vitest/commit/ce84f069)
- Compare URL objects by href  -  by
[@&#8203;kleinfreund](https://togithub.com/kleinfreund) and
[@&#8203;AriPerkkio](https://togithub.com/AriPerkkio) in
[vitest-dev/vitest#4615
[<samp>(f7a73)</samp>](https://togithub.com/vitest-dev/vitest/commit/f7a73338)
-   **snapshot**:
- Add option to configure snapshot directory  -  by
[@&#8203;d3lm](https://togithub.com/d3lm) in
[vitest-dev/vitest#4651
[<samp>(20b2a)</samp>](https://togithub.com/vitest-dev/vitest/commit/20b2a857)
-   **vite-node**:
- Support import.meta.hot.off for vite 5  -  by
[@&#8203;bluwy](https://togithub.com/bluwy) in
[vitest-dev/vitest#4315
[<samp>(01b1c)</samp>](https://togithub.com/vitest-dev/vitest/commit/01b1c55c)
-   **vitest**:
- Expose getBenchFn, getBenchOptions  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4208
[<samp>(8e5e4)</samp>](https://togithub.com/vitest-dev/vitest/commit/8e5e42dc)
- Run typecheck during tests  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4324
[<samp>(a1aad)</samp>](https://togithub.com/vitest-dev/vitest/commit/a1aadd71)
- Filter stacktraces  -  by
[@&#8203;clarkf](https://togithub.com/clarkf) in
[vitest-dev/vitest#1999
and
[vitest-dev/vitest#4338
[<samp>(6b734)</samp>](https://togithub.com/vitest-dev/vitest/commit/6b73473f)
- Expose execArgv to the different pools  -  by
[@&#8203;adriencaccia](https://togithub.com/adriencaccia) in
[vitest-dev/vitest#4383
[<samp>(9021e)</samp>](https://togithub.com/vitest-dev/vitest/commit/9021e8b8)

#####    🐞 Bug Fixes

- Add multiple globals in VM+JSDOM  -  by
[@&#8203;nstepien](https://togithub.com/nstepien) in
[vitest-dev/vitest#4199
and
[vitest-dev/vitest#4202
[<samp>(fc947)</samp>](https://togithub.com/vitest-dev/vitest/commit/fc947ce6)
- Ignore "plugins" field in snapshotFormat option  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4204
[<samp>(db1ff)</samp>](https://togithub.com/vitest-dev/vitest/commit/db1ff438)
- `nextTick` mocking error message to mention correct config option  - 
by [@&#8203;AriPerkkio](https://togithub.com/AriPerkkio) in
[vitest-dev/vitest#4215
[<samp>(98fe3)</samp>](https://togithub.com/vitest-dev/vitest/commit/98fe3d55)
- Export VitestUtils interface  -  by
[@&#8203;fbritoferreira](https://togithub.com/fbritoferreira) in
[vitest-dev/vitest#4301
[<samp>(b1439)</samp>](https://togithub.com/vitest-dev/vitest/commit/b1439852)
- Assertion diff message handle non-writable sub-properties  -  by
[@&#8203;bfamchon](https://togithub.com/bfamchon) in
[vitest-dev/vitest#4278
[<samp>(7e1a0)</samp>](https://togithub.com/vitest-dev/vitest/commit/7e1a0f83)
- Don't bundle import from rollup  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4392
[<samp>(3b584)</samp>](https://togithub.com/vitest-dev/vitest/commit/3b58487b)
- Support accessing fixture at same index of dependency fixture  -  by
[@&#8203;dsyddall](https://togithub.com/dsyddall) in
[vitest-dev/vitest#4387
[<samp>(4cd1d)</samp>](https://togithub.com/vitest-dev/vitest/commit/4cd1d3ce)
- Make asynchronous fixtures work concurrently  -  by
[@&#8203;dsyddall](https://togithub.com/dsyddall) in
[vitest-dev/vitest#4403
[<samp>(3c9f9)</samp>](https://togithub.com/vitest-dev/vitest/commit/3c9f920a)
- Coverage.100 crash when using as an cli argument  -  by
[@&#8203;marcelobotega](https://togithub.com/marcelobotega) in
[vitest-dev/vitest#4346
[<samp>(0db38)</samp>](https://togithub.com/vitest-dev/vitest/commit/0db386dc)
- Support typechecking with Yarn PnP  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4412
[<samp>(1ecbe)</samp>](https://togithub.com/vitest-dev/vitest/commit/1ecbe74d)
- Support accessing task from test context without accessing fixtures
 -  by [@&#8203;dsyddall](https://togithub.com/dsyddall) in
[vitest-dev/vitest#4419
[<samp>(3397f)</samp>](https://togithub.com/vitest-dev/vitest/commit/3397fdc4)
- Copy custom asymmetric matchers to local `expect`  -  by
[@&#8203;hi-ogawa](https://togithub.com/hi-ogawa) in
[vitest-dev/vitest#4405
[<samp>(9fe38)</samp>](https://togithub.com/vitest-dev/vitest/commit/9fe38737)
- Apply serializer to `Error` instance for thrown snapshot  -  by
[@&#8203;hi-ogawa](https://togithub.com/hi-ogawa) and
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4396
[<samp>(ac309)</samp>](https://togithub.com/vitest-dev/vitest/commit/ac309726)
- Throw an error when running "vitest typecheck"  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4439
[<samp>(7f502)</samp>](https://togithub.com/vitest-dev/vitest/commit/7f502299)
- Don't expand snapshot diff by default  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4430
[<samp>(8983c)</samp>](https://togithub.com/vitest-dev/vitest/commit/8983cd48)
- Handle errors thrown in fixtures  -  by
[@&#8203;dsyddall](https://togithub.com/dsyddall)
[<samp>(f6844)</samp>](https://togithub.com/vitest-dev/vitest/commit/f6844ad6)
- Default --open to !process.env.CI  -  by
[@&#8203;collinstevens](https://togithub.com/collinstevens) in
[vitest-dev/vitest#4477
[<samp>(088a0)</samp>](https://togithub.com/vitest-dev/vitest/commit/088a047d)
- Disable ESBuild when user config disables it  -  by
[@&#8203;Namchee](https://togithub.com/Namchee) in
[vitest-dev/vitest#4492
[<samp>(9abde)</samp>](https://togithub.com/vitest-dev/vitest/commit/9abde204)
- Inherit concurrent/sequential in nested suites  -  by
[@&#8203;dsyddall](https://togithub.com/dsyddall) in
[vitest-dev/vitest#4482
[<samp>(ca168)</samp>](https://togithub.com/vitest-dev/vitest/commit/ca168a14)
- Provide customTesters to asymmetric matchers  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va)
[<samp>(ac665)</samp>](https://togithub.com/vitest-dev/vitest/commit/ac665c96)
- Apply `retry` and `bail` from test config file  -  by
[@&#8203;hi-ogawa](https://togithub.com/hi-ogawa) in
[vitest-dev/vitest#4530
[<samp>(94f9a)</samp>](https://togithub.com/vitest-dev/vitest/commit/94f9a3ca)
- Respect trailing slash when filtering by file path  -  by
[@&#8203;ibuibu](https://togithub.com/ibuibu) in
[vitest-dev/vitest#4538
[<samp>(f377a)</samp>](https://togithub.com/vitest-dev/vitest/commit/f377a3bf)
- Date prototype when using setSystemTime  -  by
[@&#8203;spiroka](https://togithub.com/spiroka) in
[vitest-dev/vitest#4584
[<samp>(3f8c3)</samp>](https://togithub.com/vitest-dev/vitest/commit/3f8c3fb1)
- BrowserTestRunner called incorrect super methods  -  by
[@&#8203;samthor](https://togithub.com/samthor) in
[vitest-dev/vitest#4632
[<samp>(8385c)</samp>](https://togithub.com/vitest-dev/vitest/commit/8385c981)
- Set process name for idle workers  -  by
[@&#8203;AriPerkkio](https://togithub.com/AriPerkkio) in
[vitest-dev/vitest#4641
[<samp>(eca25)</samp>](https://togithub.com/vitest-dev/vitest/commit/eca25dc9)
-   **bench**:
- Extract ChainableBenchmarkAPI type  -  by
[@&#8203;dsyddall](https://togithub.com/dsyddall) in
[vitest-dev/vitest#4537
[<samp>(79e9b)</samp>](https://togithub.com/vitest-dev/vitest/commit/79e9bfaa)
-   **browser**:
- Improve error handling and don't rely on Node.js builtin modules in
browser mode  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4244
[<samp>(e7e8c)</samp>](https://togithub.com/vitest-dev/vitest/commit/e7e8c3cc)
- Disable hijacking ES modules until vi.mock is implemented  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4414
[<samp>(ab556)</samp>](https://togithub.com/vitest-dev/vitest/commit/ab556376)
- Add vitest/ imports to entries  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4514
[<samp>(648bc)</samp>](https://togithub.com/vitest-dev/vitest/commit/648bccb9)
- Wait until vite finishes prebundling of vitest dependencies  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4518
[<samp>(56ee7)</samp>](https://togithub.com/vitest-dev/vitest/commit/56ee7026)
- Allow for `pretty-format` as a sibling dependency  -  by
[@&#8203;nicojs](https://togithub.com/nicojs) in
[vitest-dev/vitest#4590
[<samp>(ed50a)</samp>](https://togithub.com/vitest-dev/vitest/commit/ed50a944)
- Don't go into an infinite reload loop, don't fail if "error" event is
caught  -  by [@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4618
[<samp>(ec3d6)</samp>](https://togithub.com/vitest-dev/vitest/commit/ec3d6949)
- Respect "server" option in vite config  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4627
[<samp>(723f6)</samp>](https://togithub.com/vitest-dev/vitest/commit/723f65b9)
-   **cli**:
- Do not capture `stdin` when in run mode  -  by
[@&#8203;AriPerkkio](https://togithub.com/AriPerkkio) in
[vitest-dev/vitest#4310
[<samp>(fc51a)</samp>](https://togithub.com/vitest-dev/vitest/commit/fc51ad04)
-   **config**:
- Type issue of `pool` and `poolMatchGlobs` in defineConfig  -  by
[@&#8203;InfiniteXyy](https://togithub.com/InfiniteXyy) in
[vitest-dev/vitest#4282
[<samp>(9112c)</samp>](https://togithub.com/vitest-dev/vitest/commit/9112cc96)
-   **coverage**:
- `thresholdAutoUpdate` to detect zero limits  -  by
[@&#8203;AriPerkkio](https://togithub.com/AriPerkkio) in
[vitest-dev/vitest#4287
[<samp>(a29fe)</samp>](https://togithub.com/vitest-dev/vitest/commit/a29fecee)
- Exclude files and directories starting with dot by default  -  by
[@&#8203;AriPerkkio](https://togithub.com/AriPerkkio) in
[vitest-dev/vitest#4428
[<samp>(b3327)</samp>](https://togithub.com/vitest-dev/vitest/commit/b3327a64)
- Improve memory usage by writing temporary files on file system  -  by
[@&#8203;AriPerkkio](https://togithub.com/AriPerkkio) in
[vitest-dev/vitest#4603
[<samp>(4166c)</samp>](https://togithub.com/vitest-dev/vitest/commit/4166c413)
-   **deps**:
- Update dependency v8-to-istanbul to ^9.2.0  -  by
[@&#8203;renovate](https://togithub.com/renovate)\[bot]
in[vitest-dev/vitest#4583
[<samp>(a70f2)</samp>](https://togithub.com/vitest-dev/vitest/commit/a70f216d)
- Update dependency std-env to ^3.5.0  -  by
[@&#8203;renovate](https://togithub.com/renovate)\[bot]
in[vitest-dev/vitest#4582
[<samp>(1fdd6)</samp>](https://togithub.com/vitest-dev/vitest/commit/1fdd6fe2)
-   **example**:
- Resolve type error  -  by [@&#8203;jqkk](https://togithub.com/jqkk) in
[vitest-dev/vitest#4515
[<samp>(2d1b4)</samp>](https://togithub.com/vitest-dev/vitest/commit/2d1b4785)
-   **expect**:
- Publish types file  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va)
[<samp>(5996c)</samp>](https://togithub.com/vitest-dev/vitest/commit/5996c8c0)
- `Object.freeze` breaks `toEqual`  -  by
[@&#8203;Dunqing](https://togithub.com/Dunqing) in
[vitest-dev/vitest#4303
[<samp>(a4501)</samp>](https://togithub.com/vitest-dev/vitest/commit/a4501d6b)
- Publish semantically correct chai types  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4322
[<samp>(80a70)</samp>](https://togithub.com/vitest-dev/vitest/commit/80a706a1)
- Print full error if promise is rejected  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4467
[<samp>(cadb9)</samp>](https://togithub.com/vitest-dev/vitest/commit/cadb9cd3)
- Don't fail when using jest expect  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4517
[<samp>(60d6d)</samp>](https://togithub.com/vitest-dev/vitest/commit/60d6d173)
-   **happy-dom**:
- Don't crash when calling useFakeTimers with empty config  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4214
[<samp>(2e1a1)</samp>](https://togithub.com/vitest-dev/vitest/commit/2e1a1bd4)
-   **jsdom**:
- Don't go into an infinite recusion when calling atob  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va)
[<samp>(da794)</samp>](https://togithub.com/vitest-dev/vitest/commit/da7949dc)
-   **runner**:
- Fixture needs to be initialized for each test  -  by
[@&#8203;Dunqing](https://togithub.com/Dunqing) in
[vitest-dev/vitest#4250
[<samp>(76a93)</samp>](https://togithub.com/vitest-dev/vitest/commit/76a93298)
- Nested tests should throw errors  -  by
[@&#8203;Dunqing](https://togithub.com/Dunqing) in
[vitest-dev/vitest#4262
[<samp>(8ac9f)</samp>](https://togithub.com/vitest-dev/vitest/commit/8ac9f8b1)
- Removes deprecated `error` option from TaskResult  -  by
[@&#8203;Dunqing](https://togithub.com/Dunqing) in
[vitest-dev/vitest#4313
[<samp>(4cee6)</samp>](https://togithub.com/vitest-dev/vitest/commit/4cee6711)
- Preserve fixtures when calling runif and skipif  -  by
[@&#8203;dsyddall](https://togithub.com/dsyddall) in
[vitest-dev/vitest#4585
and
[vitest-dev/vitest#4591
[<samp>(515ea)</samp>](https://togithub.com/vitest-dev/vitest/commit/515eadf9)
- PassWithNoTests option not work  -  by
[@&#8203;Dunqing](https://togithub.com/Dunqing) in
[vitest-dev/vitest#4553
[<samp>(8d183)</samp>](https://togithub.com/vitest-dev/vitest/commit/8d183da4)
-   **vite-node**:
- Have a separate cache for web/ssr transforms  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4221
[<samp>(ca5db)</samp>](https://togithub.com/vitest-dev/vitest/commit/ca5dbef4)
- Mjs files watch not work  -  by
[@&#8203;Dunqing](https://togithub.com/Dunqing) in
[vitest-dev/vitest#3982
[<samp>(77ea9)</samp>](https://togithub.com/vitest-dev/vitest/commit/77ea9326)
-   **vitest**:
- Make [@&#8203;types/node](https://togithub.com/types/node) optional
 -  by [@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4210
[<samp>(a5383)</samp>](https://togithub.com/vitest-dev/vitest/commit/a5383c2d)
- Inline chai types instead of using
[@&#8203;types/chai](https://togithub.com/types/chai)  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4209
[<samp>(5f477)</samp>](https://togithub.com/vitest-dev/vitest/commit/5f4774fc)
- Don't initialize globalSetup if workspace doesn't run tests  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4213
[<samp>(06461)</samp>](https://togithub.com/vitest-dev/vitest/commit/0646197e)
- Deduplicate vitest when running globally or in a workspace  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4238
[<samp>(93504)</samp>](https://togithub.com/vitest-dev/vitest/commit/93504619)
- Print file path instead of "unknown test" when logging  -  by
[@&#8203;Dunqing](https://togithub.com/Dunqing) in
[vitest-dev/vitest#4146
[<samp>(ec2e8)</samp>](https://togithub.com/vitest-dev/vitest/commit/ec2e8040)
- Failed to load custom environment from js/ts file  -  by
[@&#8203;Dunqing](https://togithub.com/Dunqing) and
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4255
[<samp>(da8d0)</samp>](https://togithub.com/vitest-dev/vitest/commit/da8d0570)
- Support assets in new URL in Vite 5  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4258
[<samp>(d280f)</samp>](https://togithub.com/vitest-dev/vitest/commit/d280f489)
- Correctly hoist `vi.hoisted` if assigned  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4285
[<samp>(ff93a)</samp>](https://togithub.com/vitest-dev/vitest/commit/ff93a573)
- Run globalSetup from the root config even if it's not in a workspace
 -  by [@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4325
[<samp>(4293e)</samp>](https://togithub.com/vitest-dev/vitest/commit/4293e1b1)
- Pass correct mode in vitest config function  -  by
[@&#8203;adriencaccia](https://togithub.com/adriencaccia) in
[vitest-dev/vitest#4399
[<samp>(b8ca3)</samp>](https://togithub.com/vitest-dev/vitest/commit/b8ca3873)
- Throw an error if vitest is imported using require()  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4466
[<samp>(e5cf1)</samp>](https://togithub.com/vitest-dev/vitest/commit/e5cf1418)
- Use correct type for defineProject to allow usage in mergeConfig  - 
by [@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4498
[<samp>(7dee8)</samp>](https://togithub.com/vitest-dev/vitest/commit/7dee832d)
- Throw an error if Vite wasn't able to resolve aliased path  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4503
[<samp>(50333)</samp>](https://togithub.com/vitest-dev/vitest/commit/503331d8)
- Improve vi.waitUntil type to excude falsy types  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4572
[<samp>(23652)</samp>](https://togithub.com/vitest-dev/vitest/commit/23652300)
- Add import-meta.d.ts  -  by
[@&#8203;macdaddyaz](https://togithub.com/macdaddyaz) in
[vitest-dev/vitest#4571
[<samp>(dd802)</samp>](https://togithub.com/vitest-dev/vitest/commit/dd80288f)
- Correctly support CSS variable when using happy-dom  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#4601
[<samp>(9fbf3)</samp>](https://togithub.com/vitest-dev/vitest/commit/9fbf39af)
- Pass correct server options in workspace  -  by
[@&#8203;hironytic](https://togithub.com/hironytic) in
[vitest-dev/vitest#4539
and
[vitest-dev/vitest#4540
[<samp>(241a8)</samp>](https://togithub.com/vitest-dev/vitest/commit/241a8c13)
- Independently mock each instance's methods for mocked class  -  by
[@&#8203;hi-ogawa](https://togithub.com/hi-ogawa) in
[vitest-dev/vitest#4564
[<samp>(05b05)</samp>](https://togithub.com/vitest-dev/vitest/commit/05b0521c)
-   **vm**:
- Remove sequencer usage from createVmThreadsPool function  -  by
[@&#8203;mhogeveen](https://togithub.com/mhogeveen) in
[vitest-dev/vitest#4638
[<samp>(54d52)</samp>](https://togithub.com/vitest-dev/vitest/commit/54d52d44)

#####    🏎 Performance

- Update `log-update` v9  -  by
[@&#8203;AriPerkkio](https://togithub.com/AriPerkkio) in
[vitest-dev/vitest#4390
[<samp>(ba1df)</samp>](https://togithub.com/vitest-dev/vitest/commit/ba1df849)
- Close pool early in run-mode  -  by
[@&#8203;AriPerkkio](https://togithub.com/AriPerkkio) in
[vitest-dev/vitest#4623
[<samp>(e0e20)</samp>](https://togithub.com/vitest-dev/vitest/commit/e0e20176)
- **coverage-istanbul**: `all: true` instruments already instrumented
files  -  by [@&#8203;AriPerkkio](https://togithub.com/AriPerkkio) in
[vitest-dev/vitest#4552
[<samp>(d1e1b)</samp>](https://togithub.com/vitest-dev/vitest/commit/d1e1bc90)

#####     [View changes on
GitHub](https://togithub.com/vitest-dev/vitest/compare/v0.34.7...v1.0.0)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/JoshuaKGoldberg/sinon-timers-repeatable).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy44Ny4yIiwidXBkYXRlZEluVmVyIjoiMzcuODcuMiIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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.

Mocking a module that is a class will have all of its instances to share the same 'mock'
2 participants