···853853854854- **CLI:** `--standalone`
855855856856-Start Vitest without running tests. Tests will be running only on change. This option is ignored when CLI file filters are passed. (default: `false`)
856856+Start Vitest without running tests. Tests will be running only on change. If browser mode is enabled, the UI will be opened automatically. This option is ignored when CLI file filters are passed. (default: `false`)
857857858858### listTags
859859
+1-1
docs/api/advanced/reporters.md
···5555This method is called when [Vitest](/api/advanced/vitest) was initiated or started, but before the tests were filtered.
56565757::: info
5858-Internally this method is called inside [`vitest.start`](/api/advanced/vitest#start), [`vitest.init`](/api/advanced/vitest#init) or [`vitest.mergeReports`](/api/advanced/vitest#mergereports). If you are using programmatic API, make sure to call either one depending on your needs before calling [`vitest.runTestSpecifications`](/api/advanced/vitest#runtestspecifications), for example. Built-in CLI will always run methods in correct order.
5858+Internally this method is called inside [`vitest.start`](/api/advanced/vitest#start), [`vitest.standalone`](/api/advanced/vitest#standalone) or [`vitest.mergeReports`](/api/advanced/vitest#mergereports). If you are using programmatic API, make sure to call either one depending on your needs before calling [`vitest.runTestSpecifications`](/api/advanced/vitest#runtestspecifications), for example. Built-in CLI will always run methods in correct order.
5959:::
60606161Note that you can also get access to `vitest` instance from test cases, suites and test modules via a [`project`](/api/advanced/test-project) property, but it might also be useful to store a reference to `vitest` in this method.
+6-4
docs/api/advanced/vitest.md
···233233Initialize reporters, the coverage provider, and run tests. This method accepts string filters to match the test files - these are the same filters that [CLI supports](/guide/filtering#cli).
234234235235::: warning
236236-This method should not be called if [`vitest.init()`](#init) is also invoked. Use [`runTestSpecifications`](#runtestspecifications) or [`rerunTestSpecifications`](#reruntestspecifications) instead if you need to run tests after Vitest was initialised.
236236+This method should not be called if [`vitest.standalone()`](#standalone) is also invoked. Use [`runTestSpecifications`](#runtestspecifications) or [`rerunTestSpecifications`](#reruntestspecifications) instead if you need to run tests after Vitest was initialised.
237237:::
238238239239This method is called automatically by [`startVitest`](/guide/advanced/tests) if `config.mergeReports` and `config.standalone` are not set.
240240241241-## init
241241+## standalone <Version type="experimental">4.1.1</Version> {#standalone}
242242243243```ts
244244-function init(): Promise<void>
244244+function standalone(): Promise<void>
245245```
246246+247247+- **Alias**: `init` <Deprecated />
246248247249Initialize reporters and the coverage provider. This method doesn't run any tests. If the `--watch` flag is provided, Vitest will still run changed tests even if this method was not called.
248250···545547function createCoverageProvider(): Promise<CoverageProvider | null>
546548```
547549548548-Creates a coverage provider if `coverage` is enabled in the config. This is done automatically if you are running tests with [`start`](#start) or [`init`](#init) methods.
550550+Creates a coverage provider if `coverage` is enabled in the config. This is done automatically if you are running tests with [`start`](#start) or [`standalone`](#standalone) methods.
549551550552::: warning
551553This method will also clean all previous reports if [`coverage.clean`](/config/coverage#coverage-clean) is not set to `false`.
+11-1
packages/vitest/src/node/core.ts
···795795 }
796796797797 /**
798798+ * @deprecated use `standalone()` instead
799799+ */
800800+ init(): Promise<void> {
801801+ this.logger.deprecate('`vitest.init()` is deprecated. Use `vitest.standalone()` instead.')
802802+ return this.standalone()
803803+ }
804804+805805+ /**
798806 * Initialize reporters and the coverage provider. This method doesn't run any tests.
799807 * If the `--watch` flag is provided, Vitest will still run changed tests even if this method was not called.
800808 */
801801- async init(): Promise<void> {
809809+ async standalone(): Promise<void> {
802810 await this._traces.$('vitest.init', async () => {
803811 try {
804812 await this.initCoverageProvider()
···810818811819 // populate test files cache so watch mode can trigger a file rerun
812820 await this.globTestSpecifications()
821821+822822+ await Promise.all(this.projects.map(project => project._standalone()))
813823814824 if (this.config.watch) {
815825 await this.report('onWatcherStart')
+1-1
packages/vitest/src/node/logger.ts
···258258 }
259259260260 if (this.ctx.config.standalone) {
261261- this.log(c.yellow(`\nVitest is running in standalone mode. Edit a test file to rerun tests.`))
261261+ this.log(c.yellow(`\nVitest is running in standalone mode. Edit a test file to rerun tests.\n`))
262262 }
263263 else {
264264 this.log()
···807807 },
808808 standalone: {
809809 description:
810810- 'Start Vitest without running tests. Tests will be running only on change. This option is ignored when CLI file filters are passed. (default: `false`)',
810810+ 'Start Vitest without running tests. Tests will be running only on change. If browser mode is enabled, the UI will be opened automatically. This option is ignored when CLI file filters are passed. (default: `false`)',
811811 },
812812 mergeReports: {
813813 description: