Run End-to-End Tests from Your Terminal with Kane CLI
Author and Run Tests Right from the Terminal in Natural Language, with an Evidence-Backed Pass or Fail from a Real Browser.
npm install -g @testmuai/kane-cli
What Is Vitest? A Vitest 5 Tutorial With Examples
Vitest is the Vite-powered test runner for JavaScript and TypeScript. Install Vitest 5, write tests, mock with vi, add coverage and shard runs in CI.
Vitest is an open-source test runner for JS/TS built on top of Vite with a Jest-compatible API. You can use it to write your unit and component tests, and it will re-use your app's Vite config, plugins and aliases.
It's designed to work in Vite-based stacks (React, Vue, Svelte, Nuxt, etc.) and plain Node.js projects. New Angular CLI projects now come with Vitest and jsdom by default.
TL;DR
Vitest is a Vite-powered test runner for JavaScript and TypeScript with a Jest-compatible API (describe, test, expect, vi). Install it with npm install -D vitest, run npx vitest, and it reuses your Vite config. Vitest 5 needs Node.js 22.12+ and Vite 6.4+, and TestMu AI's Kane CLI runs the end-to-end user flows Vitest leaves out.
- Latest stable version: 5.1.2, published November 25, 2026
- Runtime requirements: Node.js 22.12+, 24 or 26+ (odd-numbered 23 and 25 fall outside Vitest 5's engines range), and Vite 6.4 or newer
- Maintained by: VoidZero Inc. and Vitest contributors
- License: MIT
- GitHub stars: 17.6k (December 2, 2026)
- npm downloads: About 178 million in the week of Nov 24-30, 2026 (weekly totals swung between about 110 million and 193 million since October; counts include CI and mirror installs)
- Default test environment: node (switch to jsdom or happy-dom for DOM code)
What Is Vitest Used For?
Vitest is used to run unit tests, component tests and in-source tests for JS and TS code.
The official docs describe it as "a solid alternative even for projects not using Vite".
The runner includes watch mode, Jest-style mocking via the vi object, snapshots, v8 or istanbul coverage, sharding and an optional browser mode.
The Angular testing guide says "New projects include vitest and jsdom by default", so Angular teams will be encountering Vitest from day one.
Vitest covers the bottom of the testing pyramid (functions, modules, hooks, components tested in isolation in milliseconds). The full user journey across real browsers and real devices is the preserve of end-to-end tools such as Playwright or the Kane CLI end-to-end testing agent.
| Tool | What it tests | Where it runs | Speed | Best for |
|---|---|---|---|---|
| Vitest | Functions, modules, components | Node.js workers (forks by default), jsdom/happy-dom, or a real browser in browser mode | Milliseconds per test | Unit and component tests in Vite, Angular and Node projects |
| Jest | Functions, modules, components | Node.js (jsdom optional) | Milliseconds per test | Existing Jest codebases, CommonJS-heavy projects, React Native |
| Playwright Test | Full pages and user flows | Chromium, Firefox and WebKit builds | Seconds per test | Scripted end-to-end regression suites |
| Kane CLI (TestMu AI) | Full user flows from a plain-English objective | Real Chrome locally; Android/iOS emulators and simulators (macOS on Apple Silicon); real devices on TestMu AI cloud (paid plan) | Seconds to minutes per flow | End-to-end checks run by developers, SDETs and coding agents |
For the big picture of where unit tests fit into a test strategy, have a look at TestMu AI's unit testing guide.
For a quick visual walkthrough of this concept, watch the video below from TestMu AI.
Subscribe to the TestMu AI YouTube channel for more tutorials on testing and automation.
How Is Vitest Different From Jest?
Vitest and Jest are pretty much the same in terms of their API (describe, test, expect, mocks, snapshots), so the vast majority of Jest suites will just migrate to Vitest by doing a simple swap of jest.fn() for vi.fn() and jest.mock() for vi.mock(). Vitest reuses your Vite config and will run ESM and TypeScript without the need for Babel or ts-jest. Jest will remain the default if your codebase is one that relies on CommonJS require() mocking.
For the benchmarks, the gaps and a step-by-step migration guide, see our full Vitest vs Jest comparison.
How to Install Vitest
Vitest is installed as a single dev dependency. The official npm, pnpm and Bun commands list only Vitest and Vite is brought in as a peer dependency. Vitest 5 requires Node.js 22.12+ and Vite 6.4+, so make sure your node --version is up to date first.
npm install -D vitest
# pnpm add -D vitest
# bun add -D vitest
# yarn add -D vitest vite # Yarn needs vite listed explicitlyYarn users will have to add vite manually as Vitest 5 has moved vite from a direct dependency to a peer dependency.
In our test install on 2nd December 2026, npm install -D vitest installed Vite 8.4.1 into node_modules with no further action required.
Add the test scripts to package.json:
{
"type": "module",
"scripts": {
"test": "vitest",
"coverage": "vitest run --coverage"
}
}How to Write and Run Your First Vitest Test
A Vitest test file is any file whose name contains .test or .spec (e.g. sum.test.ts). Vitest runs TypeScript and JSX natively, so no transpilation setup is required.
// src/sum.ts
export function sum(a: number, b: number): number {
return a + b
}
// src/sum.test.ts
import { describe, expect, test } from 'vitest'
import { sum } from './sum'
describe('sum', () => {
test('adds 1 + 2 to equal 3', () => {
expect(sum(1, 2)).toBe(3)
})
test('handles negative numbers', () => {
expect(sum(-4, 2)).toBe(-2)
})
})Run it with npx vitest run src/sum.test.ts. The output from our run on Vitest 5.1.2:
RUN v5.1.2 /projects/vitest-demo
✓ src/sum.test.ts (2 tests) 3ms
Test Files 1 passed (1)
Tests 2 passed (2)Vitest 5 also prints an isolation hint following the summary. On a 6-file demo suite it reported "6 workers spawned · ~92ms startup each ... at least ~460ms faster with isolate: false" (the numbers will of course vary depending on the machine and the size of the suite).
Turning off isolate will reuse the workers across files, which is only safe if your tests don't have any global state.
Common Vitest Expect Matchers
Vitest's expect ships the Jest-compatible matchers plus Chai. These six cover most unit tests (all run in our demo):
| Matcher | What it checks | Example |
|---|---|---|
toBe | Primitive equality or the same object reference | expect(2 + 2).toBe(4) |
toEqual | Deep equality of objects and arrays | expect(user).toEqual({ id: 1, tags: ['a'] }) |
toStrictEqual | Deep equality that also compares undefined keys and class types | expect({ id: 1, name: undefined }).not.toStrictEqual({ id: 1 }) |
toThrow | That a function throws, optionally a given error type or message | expect(() => JSON.parse('{')).toThrow(SyntaxError) |
toHaveBeenCalledWith | The arguments a mock received | expect(onSave).toHaveBeenCalledWith('draft', 2) |
toMatchSnapshot / toMatchInlineSnapshot | Output against a stored snapshot | expect(result).toMatchInlineSnapshot() |
Vitest Watch Mode vs Run Mode
The vitest command kicks off watch mode in a local terminal and will only re-run the tests that are impacted by a file change. In CI or any non-interactive shell scenario, the same command will just do a single run. Use vitest run if you want exactly one pass in all cases (e.g. in pre-commit hooks or lint-staged).
| Command | What it does |
|---|---|
vitest | Watch mode locally, single run in CI |
vitest run | Always a single run, then exit |
vitest watch (alias vitest dev) | Watch mode, falls back to run mode when stdin is not a TTY |
vitest related src/sum.ts | Runs only tests that import the given source files |
Note: Unit tests passing? Examine the flow the user actually touches. Vitest checks that sum() returns 3. Kane CLI checks that the cart total on your staging checkout page is the correct amount in a real Chrome browser, run from your terminal or from the Kane CLI (via Claude Code, Cursor, Codex or Gemini CLI). npm install -g @testmuai/kane-cli - Start free with Kane CLI.
How to Configure Vitest (vitest.config.ts)
Vitest will read your existing vite.config.* by default, so your Vite plugins, aliases and define values will all be available to your tests with no extra work on your part. Create a vitest.config.ts if your tests require their own config.
If both files are present then vitest.config.ts wins and Vitest will simply ignore vite.config.*.
// vitest.config.ts
import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
environment: 'node',
include: ['src/**/*.{test,spec}.{ts,tsx}'],
setupFiles: ['./vitest.setup.ts'],
includeSource: ['src/**/*.ts'],
coverage: {
provider: 'v8',
include: ['src/**/*.ts'],
reporter: ['text', 'html', 'lcov'],
thresholds: { lines: 80, functions: 80, branches: 70, statements: 80 },
},
},
define: {
'import.meta.vitest': 'undefined',
},
})Vitest options live under the 'test' key. Vite options such as resolve.alias and define are at the top level. To get it all in one file you'd add the test block to your vite.config.ts and put /// <reference types="vitest/config" /> on the very first line so TS knows about the 'test' key.
If you want to re-use a Vite config from a separate file, then you'd wrap both in mergeConfig(viteConfig, defineConfig({ test: { ... } })), both being imported from vitest/config.
Vitest Setup Files (setupFiles)
Vitest runs every file listed in test.setupFiles before each test file, all in the same process as the tests.
Setup files are where you'd put your global hooks, your @testing-library/jest-dom matchers and your MSW server.
// vitest.setup.ts
import { afterEach, vi } from 'vitest'
// runs before every test file, so every file gets this hook
afterEach(() => {
vi.restoreAllMocks()
vi.unstubAllGlobals()
})Editing a setup file will cause all the tests in watch mode to be re-run. For one-off work in the main process (e.g. starting up a DB container) use globalSetup instead.
Vitest In-Source Testing
Vitest can run tests written straight in the source file (i.e. alongside the function that they're testing). The includeSource and define lines in the config above do that.
includeSource tells Vitest which files to scan, and define causes import.meta.vitest to be replaced with undefined in production builds so the bundler strips out the test block.
// src/slug.ts
export function slugify(title: string): string {
return title.trim().toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '')
}
if (import.meta.vitest) {
const { test, expect } = import.meta.vitest
test('slugify', () => {
expect(slugify(' Hello, Vitest 5! ')).toBe('hello-vitest-5')
})
}Add "types": ["vitest/importMeta"] to tsconfig.json so TypeScript knows about import.meta.vitest. In-source tests are perfect for small pure helpers. Anything that requires mocks or setup should be in a .test.ts file.
Vitest TypeScript and Globals Setup
Vitest doesn't need ts-jest or Babel for TypeScript as the types are provided by the vitest package.
Test APIs are imported explicitly by default (globals: false). If you'd like to use Jest-style globals without having to import them, then turn them on in your config and in your tsconfig.json:
// vitest.config.ts
export default defineConfig({ test: { globals: true } })
// tsconfig.json
{ "compilerOptions": { "types": ["vitest/globals"] } }Turn globals on if you're using @testing-library/react as that depends on a global afterEach for automatic cleanup.
Vitest jsdom and happy-dom Environments
Vitest runs its tests in the node environment by default (where document and window don't exist). To run in the browser, you'll need to install jsdom or happy-dom and set environment: 'jsdom' (or 'happy-dom') in your config. To run a single file in the browser, you can simply put a control comment on the first line of that file:
// @vitest-environment jsdomThe docs point out that happy-dom is faster than jsdom, albeit missing a few browser APIs. For the React-specific setup with React Testing Library, see our React unit testing tutorial.
How to Mock in Vitest: vi.fn, vi.mock and vi.spyOn
Vitest mocks functions, modules and globals via the vi helper. Use vi.fn() to create a standalone mock function, vi.mock() to replace a whole module and vi.spyOn() to spy on or stub a method on an existing object.
vi.mock and vi.fn: Replace a Module
The code under test calls an API wrapper:
// src/api.ts
export async function getJson(url: string): Promise<unknown> {
const res = await fetch(url)
if (!res.ok) throw new Error(`HTTP ${res.status}`)
return res.json()
}
// src/user.ts
import { getJson } from './api'
export interface User {
id: number
name: string
}
export async function getUserName(id: number): Promise<string> {
const user = (await getJson(`https://api.example.com/users/${id}`)) as User
return user.name.toUpperCase()
}The test swaps ./api for a mock, so no network call happens:
// src/user.test.ts
import { describe, expect, test, vi } from 'vitest'
import { getJson } from './api'
import { getUserName } from './user'
// vi.mock is hoisted above the imports, so user.ts receives the mock
vi.mock('./api', () => ({
getJson: vi.fn(),
}))
describe('getUserName', () => {
test('upper-cases the name returned by the API', async () => {
vi.mocked(getJson).mockResolvedValue({ id: 7, name: 'ada' })
await expect(getUserName(7)).resolves.toBe('ADA')
expect(getJson).toHaveBeenCalledWith('https://api.example.com/users/7')
expect(getJson).toHaveBeenCalledTimes(1)
})
})vi.mocked() is a TypeScript helper only. It returns the same function, just typed as a mock so that mockResolvedValue will type check. Vitest hoists vi.mock() to the top of the file.
In Vitest 5 you'll get an error if you call vi.mock() inside a function or block, and in that case vi.doMock() is the option if you need a mock that isn't hoisted.
For a partial mock you pass importOriginal to the factory and spread the real module.
vi.spyOn: Stub One Method, Such as fetch
vi.spyOn() keeps the real object and replaces one method, which suits globals like fetch:
// src/api.test.ts
import { afterEach, expect, test, vi } from 'vitest'
import { getJson } from './api'
afterEach(() => {
vi.restoreAllMocks()
})
test('throws on a non-2xx response', async () => {
const fetchSpy = vi
.spyOn(globalThis, 'fetch')
.mockResolvedValue(new Response('nope', { status: 500 }))
await expect(getJson('https://api.example.com/health')).rejects.toThrow('HTTP 500')
expect(fetchSpy).toHaveBeenCalledOnce()
})
test('returns parsed JSON on 200', async () => {
vi.spyOn(globalThis, 'fetch').mockResolvedValue(Response.json({ ok: true }))
await expect(getJson('https://api.example.com/health')).resolves.toEqual({ ok: true })
})vi.restoreAllMocks() restores the original methods of all spies created with vi.spyOn.
In the example setup file above, the local afterEach is redundant and is included simply so the file works on its own.
Since Vitest 5, clearMocks defaults to true, so call history is cleared before every test. Set clearMocks: false in your config if you have a suite that relies on the old behavior.
For larger suites with a lot of endpoints, the Vitest docs recommend Mock Service Worker (MSW) over the hand-crafted fetch stubs.
Vitest Fake Timers: vi.useFakeTimers
Vitest fake timers replace setTimeout, setInterval and Date so time-based code runs instantly.
In Vitest 5 the fake timers also mock the Temporal API.
// src/debounce.ts
export function debounce<T extends unknown[]>(fn: (...args: T) => void, ms: number) {
let timer: ReturnType<typeof setTimeout> | undefined
return (...args: T) => {
clearTimeout(timer)
timer = setTimeout(() => fn(...args), ms)
}
}
// src/debounce.test.ts
import { afterEach, beforeEach, expect, test, vi } from 'vitest'
import { debounce } from './debounce'
beforeEach(() => {
vi.useFakeTimers()
})
afterEach(() => {
vi.useRealTimers()
})
test('calls the function once after 300 ms of silence', () => {
const save = vi.fn()
const debouncedSave = debounce(save, 300)
debouncedSave('a')
debouncedSave('b')
vi.advanceTimersByTime(299)
expect(save).not.toHaveBeenCalled()
vi.advanceTimersByTime(1)
expect(save).toHaveBeenCalledOnce()
expect(save).toHaveBeenCalledWith('b')
})Vitest Coverage With @vitest/coverage-v8
Vitest measures code coverage via one of two provider packages: @vitest/coverage-v8 (the default) or @vitest/coverage-istanbul. You'll need to install the provider and then run with --coverage.
npm install -D @vitest/coverage-v8
npx vitest run --coverageTo show what coverage.include does, our demo has one file that no test imports:
// src/mul.ts (no test imports this file)
export function mul(a: number, b: number): number {
return a * b
}With the config as shown earlier, Vitest 5.1.2 printed out that table in a normal terminal and produced an HTML report at ./coverage/index.html:
% Coverage report from v8
-------------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
-------------|---------|----------|---------|---------|-------------------
All files | 92.3 | 100 | 87.5 | 90.9 |
api.ts | 100 | 100 | 100 | 100 |
debounce.ts | 100 | 100 | 100 | 100 |
mul.ts | 0 | 100 | 0 | 0 | 3
slug.ts | 100 | 100 | 100 | 100 |
sum.ts | 100 | 100 | 100 | 100 |
user.ts | 100 | 100 | 100 | 100 |
-------------|---------|----------|---------|---------|-------------------
The run still passed as all the totals were above the thresholds. Remove coverage.include and mul.ts simply disappears from the report altogether, which is how untested files get to hide.
Vitest changes the output when it detects that you're running it via an AI coding agent (e.g. Claude Code). In that case it just skips the fully covered files and adds in a text summary block so the same run will only list mul.ts and a totals summary.
We've reproduced both outputs on the same project so you'll see the shorter version if you're running it via an agent.
Set these three coverage options:
coverage.include: otherwise Vitest will only report on files that are imported during the run, and so any files that aren't imported will just not show up. Set it to your source glob.coverage.thresholds: fails the run if the % of lines, functions, branches or statements falls below the values you've set.coverage.reporter: defaults to['text', 'html', 'clover', 'json']. Add'lcov'if you're using Codecov, Coveralls or SonarQube.
There is no coverage.all option in the current config reference, because coverage.include does that job.
The output directory defaults to ./coverage and changes with coverage.reportsDirectory.
How to Use Vitest UI
Vitest UI is a browser-based dashboard for browsing your test files, re-running tests and looking at the errors and coverage. Install it as a separate package and then run Vitest with --ui:
npm install -D @vitest/ui
npx vitest --uiVitest prints out a URL with an access token in it (e.g. http://localhost:51204/__vitest__/?token=....). Vitest 5 protects the UI with that token, so you need to copy the full URL from the terminal.

If you're looking to generate a static report that you can share from CI, then you can run vitest run --reporter=html. Vitest 5 will write that to .vitest/index.html, and you can then open it up with npx vite preview --outDir .vitest (Vitest will print that command out itself).
How to Run a Specific Test in Vitest
Vitest can filter tests by file path, line number or test name from the CLI.
Each of the commands below was run against the demo project using Vitest 5.1.2.
# every test file whose path contains "sum"
npx vitest run sum
# one file
npx vitest run src/sum.test.ts
# the test that starts on line 10 of a file (full file name required)
npx vitest run src/sum.test.ts:10
# tests whose full name matches a regex, inside one file
npx vitest run src/sum.test.ts -t "negative"
# one project in a projects setup
npx vitest run --project unit
# only tests that failed in the previous run (Vitest 5.1+)
npx vitest run --last-failedVitest 5 changed the way -t matches names. The full name is now joined with ' > ' so -t "sum > handles negative" will target the test inside describe('sum').
In the code test.only and describe.only will focus a test and test.skip will skip one.
Remove .only before committing - allowOnly defaults to !process.env.CI so a CI run will fail if it finds a focused test.
Vitest Projects: Different Settings in One Run
Vitest projects allow a single Vitest process to run multiple configurations (e.g. Node tests and DOM tests) or one project per package in a monorepo. These are defined under test.projects. The older workspace name has been deprecated since Vitest 3.2.
// vitest.config.ts
import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
projects: [
{
test: {
name: 'unit',
environment: 'node',
include: ['src/**/*.test.ts'],
exclude: ['src/**/*.dom.test.ts'],
},
},
{
test: {
name: 'dom',
environment: 'jsdom',
include: ['src/**/*.dom.test.ts'],
},
},
],
},
})Run one project with vitest --project dom (short form -p dom). Glob entries such as 'packages/*' will turn each folder into its own project.
In Vitest 5, inline projects will inherit the root config by default (no extends: true required) and, when they don't change Vite options, share one Vite server (sharedViteServer) so files used by multiple projects will be transformed just once.
Vitest Browser Mode in Brief
Vitest's browser mode runs your tests inside a real browser rather than in a simulated DOM, which removes the gap between jsdom and actual browsers (Chromium, Firefox, WebKit, etc.). The quickest way to set it up is npx vitest init browser. The manual setup option installs @vitest/browser-playwright and enables it in your config:
import { defineConfig } from 'vitest/config'
import { playwright } from '@vitest/browser-playwright'
export default defineConfig({
test: {
browser: {
enabled: true,
provider: playwright(),
instances: [{ browser: 'chromium' }],
},
},
})The Playwright provider supports Chromium, Firefox and WebKit. WebdriverIO and the default preview provider are the alternatives. Browser mode still tests components in isolation (it doesn't drive your app through a login, payment and email flow).
When Not to Use Vitest
Skip Vitest in these five cases:
- Node.js older than 22.12. Vitest 5 won't run on that. Upgrade Node or stay on the Vitest 4.1.x line (latest 4.1.12 as of 15th October 2026), which supports Node.js 20 and 22.
- React Native apps. The React Native default template comes with Jest and the testing docs are all written for Jest. Leave Jest in.
- CommonJS code which is being mocked using
require(). The Vitest API docs make it quite clear thatvi.mockonly works for modules that are loaded viaimport, not viarequire(). That code will need to be refactored prior to the mocks being of any use. - Full user journeys. Login, checkout, OAuth redirects, emails and payments across real browsers and real devices should all be part of an end-to-end suite.
- A very large, stable Jest suite with absolutely no pain. If Jest is fast enough and you're not blocked on ESM or TypeScript, then a rewrite is going to cost you more than it's worth.
Where Vitest Stops and End-to-End Testing Starts
Vitest will answer "does this unit of code behave?" in milliseconds. An end-to-end test will answer "can a user actually complete the task in the deployed app?" The line is clear.
jsdom does no layout or rendering at all, so anything that relies on layout (offsetTop, getBoundingClientRect(), etc.) will come back as zero. Cookies, OAuth redirects, CDN caching and third-party scripts only exist in the deployed app, so no Vitest mock is going to be able to prove them.
Kane CLI (the end-to-end testing agent from TestMu AI) covers that second layer from the same terminal where you run Vitest. You give Kane CLI a plain English objective, and it drives a real Chrome browser (or with --target an Android emulator or iOS simulator on an Apple Silicon Mac, or a real device on the TestMu AI cloud if you have a paid plan). Each run gives you a pass/fail and an evidence pack:
npm install -g @testmuai/kane-cli
kane-cli login
kane-cli run "Open https://staging.example.com, add the first product to the cart and assert the cart badge shows 1" --agent--agent flag switches output to NDJSON so that Claude Code, Cursor, Codex or Gemini CLI can consume the output and fix what failed before handing the work back. A sensible split for a Vite app would be Vitest on every save and every PR for the logic and components, and Kane CLI on the flows that make money (sign-up, checkout, billing) prior to each deploy.
Manual testers and product managers who prefer to write their tests in a web UI can use KaneAI (TestMu AI's end-to-end testing agent) for those same flows. Our end-to-end testing guide covers how to decide which journeys to automate.
If your coding agent is writing your Vitest tests, then TestMu AI also publishes an open-source vitest-skill that teaches Claude Code, Copilot, Cursor and the Gemini CLI Vitest patterns.
npx agentskillsforall add https://github.com/LambdaTest/agent-skills.git --skill vitest-skillVitest 5 Breaking Changes and Common Errors
Vitest 5 errors are almost always down to the test environment or a changed default. We came across the first one whilst building this tutorial for Vitest 5.1.2.
The rest are from the Vitest 5 migration guide, and we've recreated the -t and coverage-output changes ourselves.
| Error or symptom | Cause | Fix |
|---|---|---|
ReferenceError: document is not defined | Test touches the DOM but runs in the default node environment | Set environment: 'jsdom' (or happy-dom) in config, or add // @vitest-environment jsdom to the file |
vi.mock throws when called inside a function | Vitest 5 forbids non-top-level vi.mock, vi.unmock and vi.hoisted | Move it to the top level, or use vi.doMock |
| A test that counts mock calls across several tests fails after upgrading to Vitest 5 | Vitest 5 sets clearMocks: true by default | Count calls inside each test, or set clearMocks: false if a suite relied on shared history |
-t "name" stopped matching after upgrading | Vitest 5 joins full test names with ' > ' | Use -t "describe name > test name" or a shorter regex |
| Vitest fails to start in a Yarn project because vite is missing | Vite is a peer dependency in Vitest 5, and the Yarn install command must list it | yarn add -D vite |
| Vitest UI shows an error page | Vitest 5 UI requires the token in the URL | Open the full URL printed in the terminal |
Unawaited expect(...).resolves now fails the test | Vitest 5 fails unawaited async assertions | Add await before expect(...).resolves / .rejects |
| JUnit or JSON results no longer appear in the console | Vitest 5 writes junit and json reports to files under .vitest/ | Read .vitest/junit/output.xml, or point the reporter at stdout |
| Coverage table lists only uncovered files | Vitest detected an AI coding agent and trimmed the text reporter | Expected. Run from a normal terminal, or read coverage/index.html for every file |
Note: Ship the unit layer with Vitest, then check the user flow. Kane CLI runs end-to-end checks in a real Chrome browser from your terminal, CI or coding agent. New accounts start with 10,000 free credits, valid for 30 days. npm install -g @testmuai/kane-cli - Try Kane CLI free.
Conclusion
Start with npm install -D vitest and the sum test above, then add the setup file, coverage thresholds and coverage.include before the suite grows. When CI time starts to matter, shard the run with blob reports and merge them in one final job.
For the flows Vitest cannot prove, the Kane CLI introduction covers installing the CLI and running your first plain-English check.
Testing from the terminal? Kane CLI by TestMu AI lets SDETs and developers plan, write, run and debug tests from the command line.
Was this helpful?
Authors
Sri Harsha
Author · 20 posts
Sri Harsha is Engineering Manager of the Open Source Program Office at TestMu AI, where he leads open-source engineering behind the Selenium and Appium automation grid and builds agentic AI systems for quality engineering. He is a member of the Selenium Technical Leadership Committee and a committer to WebdriverIO and Appium, and was recognized with the LambdaTest Delta Award 2023 for Best Contributor in open-source testing. He brings over 10 years of experience in software testing and automation, with earlier roles at EPAM Systems and ZenQ. Sri Harsha holds a B.Tech in Computer Science from Jawaharlal Nehru Technological University.
Mayank Bhola
Reviewer
Mayank Bhola is Co-Founder and Head of Products at TestMu AI, where he leads the entire product portfolio across KaneAI, Kane CLI, HyperExecute, SmartUI, the Real Device Cloud, Accessibility, and other software testing product lines. As an early Lead Architect he designed and built the company's flagship Tunnel technology from scratch, created the React-based automation platform, and architected the data-intensive pipelines and FAAS services that scale it. He brings more than 10 years of experience in software development and product engineering, with earlier roles as Head of Technology at Juggernaut Books and Senior Software Engineer at PressPlay TV and Zomato. Mayank holds a B.Tech in Computer Engineering from JIIT Noida.
Vitest FAQs
TestMu AI forEnterprise
Get access to solutions built on Enterprise
grade security, privacy, & compliance
- Advanced access controls
- Advanced data retention rules
- Advanced Local Testing
- Premium Support options
- Early access to beta features
- Private Slack Channel
- Unlimited Manual Accessibility DevTools Tests



