Releases: vitest-dev/vitest
Releases · vitest-dev/vitest
v1.0.0-beta.5
🚨 Breaking Changes
- coverage: glob based coverage thresholds by @AriPerkkio in #4442 (18300)
- Refactors coverage thresholds API into new shape and adds support for specifying thresholds for specific files using glob patterns. Moves thresholds related coverage options to
coverage.thresholds
. See #4442 for detailed list of breaking changes
- Refactors coverage thresholds API into new shape and adds support for specifying thresholds for specific files using glob patterns. Moves thresholds related coverage options to
🚀 Features
- Improve expectTypeOf error messages - by @mmkal, Misha Kaletsky and @sheremet-va in #4206 (18300)
- Add test.sequential() api - by @dsyddall in #4512 (c3619)
- Allow custom pools - by @sheremet-va in #4417 (a3fd5)
- expect: ToContain can handle classList and Node.contains - by @sheremet-va in #4239 (ce84f)
🐞 Bug Fixes
- Handle errors thrown in fixtures - by @dsyddall (f6844)
- Default --open to !process.env.CI - by @collinstevens in #4477 (088a0)
- Disable ESBuild when user config disables it - by @Namchee in #4492 (9abde)
- Inherit concurrent/sequential in nested suites - by @dsyddall in #4482 (ca168)
- Provide customTesters to asymmetric matchers - by @sheremet-va (ac665)
- Apply
retry
andbail
from test config file - by @hi-ogawa in #4530 (94f9a) - browser:
- Add vitest/ imports to entries - by @sheremet-va in #4514 (648bc)
- Wait until vite finishes prebundling of vitest dependencies - by @sheremet-va in #4518 (56ee7)
- example:
- expect:
- Print full error if promise is rejected - by @sheremet-va in #4467 (cadb9)
- Don't fail when using jest expect - by @sheremet-va in #4517 (60d6d)
- vitest:
- Throw an error if vitest is imported using require() - by @sheremet-va in #4466 (e5cf1)
- Use correct type for defineProject to allow usage in mergeConfig - by @sheremet-va in #4498 (7dee8)
- Throw an error if Vite wasn't able to resolve aliased path - by @sheremet-va in #4503 (50333)
View changes on GitHub
v1.0.0-beta.4
🚨 Breaking Changes
- Remove EnhancedSpy type, deprecate SpyInstance, improve mocks and vi documentation - by @sheremet-va and @dammy001 in #4400 (d40b3)
🚀 Features
- Implement provide/inject API to transfer data from the main thread - by @sheremet-va in #4422 (a7522)
- browser: Support "none" provider and update lit example to use it - by @sheremet-va in #4427 (d03a2)
- vitest: Expose execArgv to the different pools - by @adriencaccia in #4383 (9021e)
🐞 Bug Fixes
- Don't bundle import from rollup - by @sheremet-va in #4392 (3b584)
- Support accessing fixture at same index of dependency fixture - by @dsyddall in #4387 (4cd1d)
- Make asynchronous fixtures work concurrently - by @dsyddall in #4403 (3c9f9)
- Coverage.100 crash when using as an cli argument - by @marcelobotega in #4346 (0db38)
- Support typechecking with Yarn PnP - by @sheremet-va in #4412 (1ecbe)
- Support accessing task from test context without accessing fixtures - by @dsyddall in #4419 (3397f)
- Copy custom asymmetric matchers to local
expect
- by @hi-ogawa in #4405 (9fe38) - Apply serializer to
Error
instance for thrown snapshot - by @hi-ogawa and @sheremet-va in #4396 (ac309) - Throw an error when running "vitest typecheck" - by @sheremet-va in #4439 (7f502)
- Don't expand snapshot diff by default - by @sheremet-va in #4430 (8983c)
- browser: Disable hijacking ES modules until vi.mock is implemented - by @sheremet-va in #4414 (ab556)
- coverage: Exclude files and directories starting with dot by default - by @AriPerkkio in #4428 (b3327)
- vitest: Pass correct mode in vitest config function - by @adriencaccia in #4399 (b8ca3)
🏎 Performance
- Update
log-update
v9 - by @AriPerkkio in #4390 (ba1df)
View changes on GitHub
v1.0.0-beta.3
🚨 Breaking Changes
- Set
vitest
peer dependency range for sub packages - by @AriPerkkio in #4299 (cd03c) - Bump minimum node version to 18 and match Vite 5 requirement - by @ghiscoding in #4296 (263b7)
- Remove deprecated node loader - by @sheremet-va in #4371 (29299)
- Move browser providers to @vitest/browser package - by @sheremet-va in #4364 (5cdeb)
- coverage:
- Use
transformMode
and workspace project based source maps - by @AriPerkkio in #4309 (28109cc)
- Use
🚀 Features
🐞 Bug Fixes
- Export VitestUtils interface - by @fbritoferreira in #4301 (b1439)
- Assertion diff message handle non-writable sub-properties - by @bfamchon in #4278 (7e1a0)
- cli:
- Do not capture
stdin
when in run mode - by @AriPerkkio in #4310 (fc51a)
- Do not capture
- config:
- Type issue of
pool
andpoolMatchGlobs
in defineConfig - by @InfiniteXyy in #4282 (9112c)
- Type issue of
- coverage:
thresholdAutoUpdate
to detect zero limits - by @AriPerkkio in #4287 (a29fe)
- expect:
- runner:
- vitest:
- Run globalSetup from the root config even if it's not in a workspace - by @sheremet-va in #4325 (4293e)
View changes on GitHub
v1.0.0-beta.2
🚨 Breaking Changes
- Enable
coverage.all
by default - by @AriPerkkio in #4265 (5a741)
🚀 Features
- Add Marko example and include code coverage for Marko files - by @DylanPiercey in #4263 (eac77)
- expect: Support
expect.closeTo
api - by @Dunqing and golebiowskib in #4260 (7f91c)
🐞 Bug Fixes
- browser:
- Improve error handling and don't rely on Node.js builtin modules in browser mode - by @sheremet-va in #4244 (e7e8c)
- runner:
- vitest:
- Deduplicate vitest when running globally or in a workspace - by @sheremet-va in #4238 (93504)
- Print file path instead of "unknown test" when logging - by @Dunqing in #4146 (ec2e8)
- Failed to load custom environment from js/ts file - by @Dunqing and @sheremet-va in #4255 (da8d0)
- Support assets in new URL in Vite 5 - by @sheremet-va in #4258 (d280f)
- Correctly hoist
vi.hoisted
if assigned to a variable - by @sheremet-va in #4285 (ff93a)
View changes on GitHub
v1.0.0-beta.1
v1.0.0-beta.0
This is a beta release for upcoming 1.0.0 version. Use beta
dist-tag when installing Vitest: npm install --save-dev vitest@beta
.
🚨 Breaking Changes
- Support multiple parallel
child_process
- by @AriPerkkio in #3925 (8b4a4)- If you have to disable threads (if you use
canvas
package, for example), this should improve your speed tremendously. useFakeTimers()
no longer automatically mocksprocess.nextTick
. Users can still mock it by explicitly specifyinguseFakeTimers({ toFake: ['nextTick'] })
- If you have to disable threads (if you use
- Add support for
pool
andpoolOptions
, remove old flags - by @AriPerkkio in #4172 (114a9)- This removes a lot of configuration options to make it easier to configure the runner to your needs. Please, have a look at migration examples if you rely on
--threads
or other related flags.--threads
is now--pool=threads
--no-threads
is now--pool=forks
--single-thread
is now--poolOptions.threads.singleThread
--experimental-vm-threads
is now--pool=vmThreads
--experimental-vm-worker-memory-limit
is now--poolOptions.vmThreads.memoryLimit
--isolate
is now--poolOptions.<pool-name>.isolate
andbrowser.isolate
test.maxThreads
is nowtest.poolOptions.<pool-name>.maxThreads
test.minThreads
is nowtest.poolOptions.<pool-name>.minThreads
test.useAtomics
is nowtest.poolOptions.<pool-name>.useAtomics
test.poolMatchGlobs.child_process
is nowtest.poolMatchGlobs.forks
test.poolMatchGlobs.experimentalVmThreads
is nowtest.poolMatchGlobs.vmThreads
- This removes a lot of configuration options to make it easier to configure the runner to your needs. Please, have a look at migration examples if you rely on
- Make snapshots more visually pleasing by @sheremet-va in #3961
- This will probably cause a lot of test mismatches. Quotes in snapshots are no longer escaped, and all snapshots use backtick quotes (`) even if the string is just a single line. Please, read the PR description for a way to use the previous behavior if you have problems upgrading.
- runner: Correctly process custom tasks, update runner hooks naming by @sheremet-va in #4076
- This PR updates the names for most of the methods on a custom runner (Test -> Task).
- It also improves the flow for creating your custom tasks like benchmarks using
createTaskCollector
utility. This is primarily an advanced API for library authors. - If you use
@vitest/snapshot
separately, you will also need to update its usage. You no longer need to extendSnapshotClient
to overrideequalityCheck
method - just pass it down as anisEqual
option. Also some of the public API methods were renamed for clarity. - If you have any questions, please, read the PR description first.
🚀 Features
- Include "vitest" in the process name - by @sheremet-va in #4191 (404c1)
- runner: Improve text.extend types - by @Dunqing in #4176 (bbb43)
- vitest: Expose getBenchFn, getBenchOptions - by @sheremet-va in #4208 (8e5e4)
🐞 Bug Fixes
- Don't optimize vue when using optimizer - by @sheremet-va (4e941)
- Overwrite global URL with environment's - by @sheremet-va in #4164 (6a66b)
- Correctly resolve external dependencies loaded by custom environments - by @sheremet-va in #4196 (39647)
- Add multiple globals in VM+JSDOM - by @nstepien in #4199 and #4202 (fc947)
- Ignore "plugins" field in snapshotFormat option - by @sheremet-va in #4204 (db1ff)
nextTick
mocking error message to mention correct config option - by @AriPerkkio in #4215 (98fe3)- happy-dom:
- Don't crash when calling useFakeTimers with empty config - by @sheremet-va in #4214 (2e1a1)
- runner:
- vitest:
- Make @types/node optional - by @sheremet-va in #4210 (a5383)
- Inline chai types instead of using @types/chai - by @sheremet-va in #4209 (5f477)
- Don't initialize globalSetup if workspace doesn't run tests - by @sheremet-va in #4213 (06461)
View changes on GitHub
v0.34.6
🐞 Bug Fixes
- Overwrite global URL with environment's - by @sheremet-va in #4164 (cbe13)
- Correctly resolve external dependencies loaded by custom environments - by @sheremet-va in #4196 (e3408)
- runner: The fixture of
test.extend
should be init once time in all test - by @Dunqing in #4168 (730b2)
View changes on GitHub
v0.34.5
🚀 Features
- config:
- Add
diff
option - by @fenghan34 and @sheremet-va in #4063 (b50cf)
- Add
- coverage:
- Add
coverage['100']
to istanbul provider - by @marcelobotega in #4109 (a7e09)
- Add
- vitest:
- Support
vi.waitFor
method - by @Dunqing and @sheremet-va in #4113 (d79cb) - Allow using unprocessed environment files - by @sheremet-va in #4098 (1aee1)
- Support
vi.waitUntil
method - by @Dunqing and @sheremet-va in #4129 (e0ac9)
- Support
🐞 Bug Fixes
- Update HappyDOMOptions to be compatible with v12 - by @anthonyblond in #4135 (e8797)
- Print value shape when .resolves and .rejects fails - by @sheremet-va in #4137 (e649d)
- docs:
- Fix lint errors on onConsoleLog example - by @marcelobotega in #4116 (ba1e7)
- expect:
- happy-dom:
- Catch errors in happy-dom - by @capricorn86 in #4140 (c21c0)
- runner:
- snapshot:
- Support mix of normal/with placeholders snapshots - by @RobertPechaCZ in #4118 (01e01)
- ui:
- Correctly render ansi diff - by @so1ve and @sheremet-va in #3810 (8c315)
- vite-node:
- Export
SourceMapInput
to fix CYCLIC_CROSS_CHUNK_REEXPORT - by @Dunqing in #4128 (ca70a) - Align vite dependency version with vitest - by @sheremet-va (90ff8)
- Export
- vitest:
- Rerun tests if a file loaded with query changes - by @sheremet-va in #4130 (a084c)
- Inject "define" in workspaces - by @sheremet-va in #4096 (b4d5a)
🏎 Performance
- Use lazy require in vm pool - by @sheremet-va in #4136 (21ba4)
View changes on GitHub
v0.34.4
🐞 Bug Fixes
- Resolving dep optimizer issues with workspace - by @thebanjomatic in #4036 (0c13c)
- Don't process config file twice - by @sheremet-va in #4077 (a84a8)
- coverage:
- Log info only when terminal reporter is used - by @AriPerkkio in #4027 (9f043)
- happy-dom:
- Use the nodejs console in happy-dom v11 - by @capricorn86 in #4090 (59434)
- runner:
- vite-node:
- Check more precisely for root/base paths - by @danielroe in #4049 (80741)
- vitest:
- "vi" doesn't rely on context - by @sheremet-va in #4031 (0d0f3)
- Only override ssr.optimizer instead of the whole ssr object - by @sheremet-va in #4080 (410bc)
- Don't start the server when optimizer is enabled - by @sheremet-va in #4095 (00e81)
- Set SSR env only when transformMode is ssr - by @sheremet-va in #4083 (f8ea7)
- Show error when calling API on files that user has no access to - by @sheremet-va in #4085 (8b39c)
- web-worker:
- Don't rely on browser API when it's not provided - by @sheremet-va in #4014 (e78a4)
View changes on GitHub
v0.34.3
🚀 Features
- coverage: Add
allowExternal
option - by @vojvodics and @AriPerkkio in #3894 (c03fa) - vitest: Export all reporters in
vitest/reporters
- by @Dunqing and @sheremet-va in #3980 (5704b)
🐞 Bug Fixes
- Should remove mockPath from callstack whether success or failed - by @miserylee and lijifei in #3971 (5eb85)
- Add workspace config files to default coverage excludes - by @FelixGraf and @AriPerkkio in #3973 (20263)
- Report file error as a on JUnit - by @3c1u in #3997 (00c43)
- jsdom: Correctly resolve buffer on typed arrays - by @sheremet-va in #3998 (b42cf)
- ui: Use web hash history in ui - by @segevfiner and @sheremet-va in #3481 and #3487 (8caab)
- vite-node: Inline HMR types - by @sheremet-va in #3993 (dff60)
- vitest: Correctly resolve optimizer status - by @sheremet-va in #3992 (74dc5)