# Vitest > This guide lists advanced APIs to run tests via a Node.js script. If you just want to [run tests](/guide/), you probably don't need this. It is primarily used by library authors. ## Pages - [Getting Started advanced {#getting-started}](advanced.md): ::: warning - [alias](alias.md): * **Type:**`Record | Array<{ find: string | RegExp, replacement: string, customResolver?: ResolverFu... - [allowOnly](allowonly.md): * **Type**:`boolean` - [api](api.md): * **Type:**`boolean | number` - [Test Artifacts 4.0.11 ](artifacts.md): ::: warning - [assertType](assert-type.md): ::: warning - [assert](assert.md): Vitest reexports the`assert`method from [`chai`](https://www.chaijs.com/api/assert/) for verifying invariants. - [Assertion API](assertions.md): Vitest provides a wide range of DOM assertions out of the box forked from [`@testing-library/jest-dom`](https://githu... - [attachmentsDir](attachmentsdir.md): * **Type:**`string` - [bail](bail.md): * **Type:**`number` - [benchmark {#benchmark}](benchmark.md): * **Type:**`{ include?, exclude?, ... }` - [Browser Mode {#browser-mode}](browser.md): This page provides information about the browser mode feature in the Vitest API, which allows you to run your tests i... - [cache ](cache.md): * **Type**:`false` - [chaiConfig](chaiconfig.md): * **Type:**`{ includeStack?, showDiff?, truncateThreshold? }` - [Mocking Classes](classes.md): You can mock an entire class with a single [`vi.fn`](/api/vi#fn) call. - [clearMocks](clearmocks.md): * **Type:**`boolean` - [Command Line Interface](cli.md): Start Vitest in the current directory. Will enter the watch mode in development environment and run mode in CI (or no... - [browser.commands](commands.md): * **Type:**`Record` - [Common Errors](common-errors.md): If you receive an error that module cannot be found, it might mean several different things: - [Comparisons with Other Test Runners](comparisons.md): [Jest](https://jestjs.io/) took over the Testing Framework space by providing out-of-the-box support for most JavaScr... - [Component Testing](component-testing.md): Component testing is a testing strategy that focuses on testing individual UI components in isolation. Unlike end-to-... - [Configuring Vitest](config.md): If you are using Vite and have a`vite.config`file, Vitest will read it to match with the plugins and setup as your ... - [browser.connectTimeout](connecttimeout.md): * **Type:**`number` - [Context API](context.md): Vitest exposes a context module via`vitest/browser`entry point. As of 2.0, it exposes a small set of utilities that... - [coverage {#coverage}](coverage.md): You can use [`v8`](/guide/coverage.html#v8-provider), [`istanbul`](/guide/coverage.html#istanbul-provider) or [a cust... - [css](css.md): * **Type**:`boolean | { include?, exclude?, modules? }` - [dangerouslyIgnoreUnhandledErrors ](dangerouslyignoreunhandlederrors.md): * **Type**:`boolean` - [Mocking Dates](dates.md): Sometimes you need to be in control of the date to ensure consistency when testing. Vitest uses [`@sinonjs/fake-timer... - [Debugging](debugging.md): :::tip - [deps](deps.md): * **Type:**`{ optimizer?, ... }` - [diff](diff.md): * **Type:**`string` - [dir](dir.md): * **Type:**`string` - [disableConsoleIntercept](disableconsoleintercept.md): * **Type:**`boolean` - [browser.enabled](enabled.md): * **Type:**`boolean` - [env](env.md): * **Type:**`Partial` - [environment](environment.md): * **Type:**`'node' | 'jsdom' | 'happy-dom' | 'edge-runtime' | string` - [environmentOptions](environmentoptions.md): * **Type:**`Record` - [exclude](exclude.md): * **Type:**`string[]` - [execArgv](execargv.md): * **Type:**`string[]` - [expandSnapshotDiff](expandsnapshotdiff.md): * **Type:**`boolean` - [expectTypeOf](expect-typeof.md): ::: warning - [expect](expect.md): * **Type:**`ExpectOptions` - [experimental](experimental.md): ::: tip FEEDBACK - [Extending Matchers](extending-matchers.md): Since Vitest is compatible with both Chai and Jest, you can use either the`chai.use`API or`expect.extend`, whichev... - [fakeTimers](faketimers.md): * **Type:**`FakeTimerInstallOpts` - [Features](features.md): Vite's config, transformers, resolvers, and plugins. Use the same setup from your app to run the tests. - [Mocking the File System](file-system.md): Mocking the file system ensures that the tests do not depend on the actual file system, making the tests more reliabl... - [fileParallelism](fileparallelism.md): * **Type:**`boolean` - [Test Filtering](filtering.md): Filtering, timeouts, concurrent for suite and tests - [forceRerunTriggers ](forcereruntriggers.md): * **Type**:`string[]` - [Mocking Functions](functions.md): Mocking functions can be split up into two different categories: spying and mocking. - [globals](globals.md): * **Type:**`boolean` - [globalSetup](globalsetup.md): * **Type:**`string | string[]` - [Getting Started](guide.md): Vitest (pronounced as *"veetest"*) is a next generation testing framework - [browser.headless](headless.md): * **Type:**`boolean` - [hideSkippedTests](hideskippedtests.md): * **Type:**`boolean` - [hookTimeout](hooktimeout.md): * **Type:**`number` - [IDE Integrations](ide.md): WebStorm, PhpStorm, IntelliJ IDEA Ultimate, and other JetBrains IDEs come with built-in support for Vitest. - [Import Example](import-example.md): function import(moduleId: string): Promise - [Improving Performance](improving-performance.md): By default Vitest runs every test file in an isolated environment based on the [pool](/config/#pool): - [In-Source Testing](in-source.md): Vitest provides a way to run tests within your source code along side the implementation, similar to [Rust's module t... - [includeSource](include-source.md): * **Type:**`string[]` - [include](include.md): * **Type:**`string[]` - [includeTaskLocation](includetasklocation.md): * **Type:**`boolean` - [browser.instances](instances.md): * **Type:**`BrowserConfig` - [Interactivity API](interactivity.md): Vitest implements a subset of [`@testing-library/user-event`](https://testing-library.com/docs/user-event/intro) APIs... - [isolate](isolate.md): * **Type:**`boolean` - [Test Run Lifecycle](lifecycle.md): Understanding the test run lifecycle is essential for writing effective tests, debugging issues, and optimizing your ... - [browser.locators](locators.md): Options for built-in [browser locators](/api/browser/locators). - [logHeapUsage](logheapusage.md): * **Type**:`boolean` - [maxConcurrency](maxconcurrency.md): * **Type**:`number` - [maxWorkers](maxworkers.md): * **Type:**`number | string` - [Task Metadata advanced](metadata.md): If you are developing a custom reporter or using Vitest Node.js API, you might find it useful to pass data from tests... - [Migration Guide](migration.md): Vitest's V8 code coverage provider is now using more accurate coverage result remapping logic. - [Mocks](mock.md): You can create a mock function or a class to track its execution with the`vi.fn`method. If you want to track a prop... - [Mocking](mocking.md): When writing tests it's only a matter of time before you need to create a "fake" version of an internal — or external... - [mockReset](mockreset.md): * **Type:**`boolean` - [mode](mode.md): * **Type:**`string` - [Mocking Modules](modules.md): Before mocking a "module", we should define what it is. In Vitest context, the "module" is a file that exports someth... - [Multiple Setups](multiple-setups.md): You can specify several different browser setups using the [`browser.instances`](/config/browser/instances) option. - [name](name.md): * **Type:** - [onConsoleLog ](onconsolelog.md): function onConsoleLog( - [onStackTrace ](onstacktrace.md): * **Type**:`(error: Error, frame: ParsedStack) => boolean | void` - [onUnhandledError 4.0.0](onunhandlederror.md): * **Type:** - [Open Telemetry Support {#open-telemetry-support}](open-telemetry.md): ::: tip FEEDBACK - [open ](open.md): * **Type:**`boolean` - [browser.orchestratorScripts](orchestratorscripts.md): * **Type:**`BrowserScript[]` - [outputFile {#outputfile}](outputfile.md): * **Type:**`string | Record` - [Parallelism](parallelism.md): By default, Vitest runs *test files* in parallel. Depending on the specified`pool`, Vitest uses a different mechanis... - [passWithNoTests ](passwithnotests.md): * **Type**:`boolean` - [Configuring Playwright](playwright.md): To run tests using playwright, you need to install the [`@vitest/browser-playwright`](https://www.npmjs.com/package/@... - [Plugin API 3.1.0 {#plugin-api}](plugin.md): ::: warning - [pool](pool.md): * **Type:**`'threads' | 'forks' | 'vmThreads' | 'vmForks'` - [Configuring Preview](preview.md): ::: warning - [printConsoleTrace](printconsoletrace.md): * **Type:**`boolean` - [Profiling Test Performance](profiling-test-performance.md): When you run Vitest it reports multiple time metrics of your tests: - [projects ](projects.md): * **Type:**`TestProjectConfiguration[]` - [provide](provide.md): * **Type:**`Partial` - [browser.provider {#browser-provider}](provider.md): * **Type:**`BrowserProviderOption` - [Recipes](recipes.md): You can speed up your test run by disabling isolation for specific set of files by specifying`isolate`per`projects... - [reporters ](reporters.md): * **Type:** - [Mocking Requests](requests.md): Because Vitest runs in Node, mocking network requests is tricky; web APIs are not available, so we need something tha... - [resolveSnapshotPath ](resolvesnapshotpath.md): * **Type**:`(testPath: string, snapExtension: string, context: { config: SerializedConfig }) => string` - [restoreMocks](restoremocks.md): * **Type:**`boolean` - [retry](retry.md): * **Type:**`number` - [root](root.md): * **Type:**`string` - [runner](runner.md): * **Type**:`VitestRunnerConstructor` - [browser.screenshotDirectory](screenshotdirectory.md): * **Type:**`string` - [browser.screenshotFailures](screenshotfailures.md): * **Type:**`boolean` - [sequence](sequence.md): * **Type**:`{ sequencer?, shuffle?, seed?, hooks?, setupFiles?, groupOrder }` - [server ](server.md): Before Vitest 4, this option was used to define the configuration for the`vite-node`server. - [setupFiles](setupfiles.md): * **Type:**`string | string[]` - [silent {#silent}](silent.md): * **Type:**`boolean | 'passed-only'` - [slowTestThreshold ](slowtestthreshold.md): * **Type**:`number` - [Snapshot](snapshot.md): Learn Snapshot by video from Vue School - [snapshotEnvironment](snapshotenvironment.md): * **Type:**`string` - [snapshotFormat ](snapshotformat.md): * **Type:**`PrettyFormatOptions` - [snapshotSerializers ](snapshotserializers.md): * **Type:**`string[]` - [teardownTimeout {#teardowntimeout}](teardowntimeout.md): * **Type:**`number` - [Test Annotations](test-annotations.md): Vitest supports annotating your tests with custom messages and files via the [`context.annotate`](/guide/test-context... - [TestCase](test-case.md): The`TestCase`class represents a single test. This class is only available in the main thread. Refer to the ["Runner... - [TestCollection](test-collection.md): `TestCollection`represents a collection of top-level [suites](/api/advanced/test-suite) and [tests](/api/advanced/te... - [Test Context](test-context.md): Inspired by [Playwright Fixtures](https://playwright.dev/docs/test-fixtures), Vitest's test context allows you to def... - [TestModule](test-module.md): The`TestModule`class represents a single module in a single project. This class is only available in the main threa... - [TestProject 3.0.0 {#testproject}](test-project.md): ::: warning - [TestSpecification](test-specification.md): The`TestSpecification`class describes what module to run as a test and its parameters. - [TestSuite](test-suite.md): The`TestSuite`class represents a single suite. This class is only available in the main thread. Refer to the ["Runn... - [browser.testerHtmlPath](testerhtmlpath.md): * **Type:**`string` - [Testing Types](testing-types.md): ::: tip Sample Project - [testNamePattern {#testnamepattern}](testnamepattern.md): * **Type**`string | RegExp` - [Running Tests advanced {#running-tests}](tests.md): ::: warning - [testTimeout](testtimeout.md): * **Type:**`number` - [Timers](timers.md): When we test code that involves timeouts or intervals, instead of having our tests wait it out or timeout, we can spe... - [Remove UnoCSS - Migration Complete](todo.md): UnoCSS was causing OOM in CI. Removed entirely and replaced with`@iconify/vue`+ plain CSS. - [Trace View](trace-view.md): Vitest Browser Mode supports generating Playwright's [trace files](https://playwright.dev/docs/trace-viewer#viewing-r... - [browser.trace](trace.md): * **Type:**`'on' | 'off' | 'on-first-retry' | 'on-all-retries' | 'retain-on-failure' | object` - [browser.trackUnhandledErrors](trackunhandlederrors.md): * **Type:**`boolean` - [typecheck {#typecheck}](typecheck.md): Options for configuring [typechecking](/guide/testing-types) test environment. - [ui ](ui.md): * **Type:**`boolean` - [unstubEnvs](unstubenvs.md): * **Type:**`boolean` - [unstubGlobals](unstubglobals.md): * **Type:**`boolean` - [update {#update}](update.md): * **Type:**`boolean` - [Using Plugins](using-plugins.md): Vitest can be extended using plugins, similar to how Vite plugins work. This allows you to enhance and customize Vite... - [Vi](vi.md): Vitest provides utility functions to help you out through its`vi`helper. You can access it globally (when [globals ... - [browser.viewport](viewport.md): * **Type:**`{ width, height }` - [Visual Regression Testing](visual-regression-testing.md): Vitest can run visual regression tests out of the box. It captures screenshots - [Vitest](vitest.md): Vitest instance requires the current test mode. It can be either: - [vmMemoryLimit](vmmemorylimit.md): * **Type:**`string | number` - [watch {#watch}](watch.md): * **Type:**`boolean` - [watchTriggerPatterns 3.2.0](watchtriggerpatterns.md): * **Type:**`WatcherTriggerPattern[]` - [Configuring WebdriverIO](webdriverio.md): ::: info Playwright vs WebdriverIO - [Why Vitest](why.md): :::tip NOTE