├── .editorconfig ├── .gitattributes ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ ├── config.yml │ └── feature_request.yml ├── PULL_REQUEST_TEMPLATE.md ├── actions │ └── setup-and-cache │ │ └── action.yml ├── commit-convention.md ├── renovate.json5 └── workflows │ ├── ci.yml │ ├── cr.yml │ ├── ecosystem-ci-trigger.yml │ ├── issue-close-require.yml │ ├── issue-labeled.yml │ ├── lock-closed-issues.yml │ └── publish.yml ├── .gitignore ├── .npmrc ├── .tazerc.json ├── .vscode ├── settings.json └── tasks.json ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── FUNDING.json ├── LICENSE ├── README.md ├── SECURITY.md ├── docs ├── .vitepress │ ├── blog.data.ts │ ├── components.d.ts │ ├── components │ │ ├── BlogIndex.vue │ │ ├── Contributors.vue │ │ ├── CourseLink.vue │ │ ├── FeaturesList.vue │ │ ├── HomePage.vue │ │ ├── ListItem.vue │ │ ├── NonProjectOption.vue │ │ └── Version.vue │ ├── config.ts │ ├── contributor-names.json │ ├── contributors.ts │ ├── meta.ts │ ├── scripts │ │ ├── cli-generator.ts │ │ ├── fetch-avatars.ts │ │ ├── pwa.ts │ │ └── transformHead.ts │ ├── sponsors.ts │ ├── style │ │ ├── main.css │ │ └── vars.css │ └── theme │ │ ├── index.ts │ │ └── pwa.ts ├── advanced │ ├── api │ │ ├── import-example.md │ │ ├── index.md │ │ ├── plugin.md │ │ ├── reporters.md │ │ ├── test-case.md │ │ ├── test-collection.md │ │ ├── test-module.md │ │ ├── test-project.md │ │ ├── test-specification.md │ │ ├── test-suite.md │ │ └── vitest.md │ ├── guide │ │ └── tests.md │ ├── metadata.md │ ├── pool.md │ ├── reporters.md │ └── runner.md ├── api │ ├── assert-type.md │ ├── assert.md │ ├── expect-typeof.md │ ├── expect.md │ ├── index.md │ ├── mock.md │ └── vi.md ├── blog.md ├── blog │ └── vitest-3.md ├── config │ └── index.md ├── guide │ ├── browser │ │ ├── assertion-api.md │ │ ├── commands.md │ │ ├── config.md │ │ ├── context.md │ │ ├── index.md │ │ ├── interactivity-api.md │ │ ├── locators.md │ │ ├── multiple-setups.md │ │ ├── playwright.md │ │ ├── webdriverio.md │ │ └── why.md │ ├── cli-generated.md │ ├── cli.md │ ├── common-errors.md │ ├── comparisons.md │ ├── coverage.md │ ├── debugging.md │ ├── environment.md │ ├── examples │ │ └── promise-done.md │ ├── extending-matchers.md │ ├── features.md │ ├── filtering.md │ ├── ide.md │ ├── improving-performance.md │ ├── in-source.md │ ├── index.md │ ├── migration.md │ ├── mocking.md │ ├── parallelism.md │ ├── profiling-test-performance.md │ ├── projects.md │ ├── reporters.md │ ├── snapshot.md │ ├── test-annotations.md │ ├── test-context.md │ ├── testing-types.md │ ├── ui.md │ ├── using-plugins.md │ └── why.md ├── index.md ├── package.json ├── public │ ├── _headers │ ├── annotations-gha-dark.png │ ├── annotations-gha-light.png │ ├── annotations-html-dark.png │ ├── annotations-html-light.png │ ├── apple-touch-icon.png │ ├── bit.svg │ ├── bolt.svg │ ├── docs-api-dark.png │ ├── docs-api-light.png │ ├── favicon.ico │ ├── infosupport.svg │ ├── logo-shadow.svg │ ├── logo.svg │ ├── maskable-icon.png │ ├── module-graph-barrel-file.png │ ├── netlify.svg │ ├── new-reporter.webm │ ├── nuxtlabs.svg │ ├── og-original.png │ ├── og-vitest-3.jpg │ ├── og.png │ ├── on-task-update.gif │ ├── pwa-192x192.png │ ├── pwa-512x512.png │ ├── pwa-64x64.png │ ├── robots.txt │ ├── stackblitz.svg │ ├── ui-1-dark.png │ ├── ui-1-light.png │ ├── ui-browser-1-dark.png │ ├── ui-browser-1-light.png │ ├── ui-coverage-1-dark.png │ ├── ui-coverage-1-light.png │ ├── vital.svg │ ├── vite.svg │ ├── vitest-ui-show-coverage-dark.png │ ├── vitest-ui-show-coverage-light.png │ ├── voidzero.svg │ └── zammad.svg ├── pwa-assets.config.ts ├── team.md ├── tsconfig.json └── vite.config.ts ├── eslint.config.js ├── examples ├── basic │ ├── README.md │ ├── package.json │ ├── src │ │ └── basic.ts │ ├── test │ │ ├── __snapshots__ │ │ │ └── suite.test.ts.snap │ │ ├── basic.test.ts │ │ └── suite.test.ts │ ├── tsconfig.json │ └── vite.config.ts ├── fastify │ ├── mockData.ts │ ├── package.json │ ├── src │ │ ├── app.ts │ │ └── index.ts │ └── test │ │ └── app.test.ts ├── in-source-test │ ├── package.json │ ├── src │ │ └── index.ts │ ├── tsconfig.json │ └── vitest.config.ts ├── lit │ ├── index.html │ ├── package.json │ ├── src │ │ └── my-button.ts │ ├── test │ │ └── basic.test.ts │ ├── tsconfig.json │ └── vite.config.ts ├── profiling │ ├── global-setup.ts │ ├── package.json │ ├── src │ │ └── prime-number.ts │ ├── test │ │ └── prime-number.test.ts │ └── vitest.config.ts ├── projects │ ├── package.json │ ├── packages │ │ ├── client │ │ │ ├── components │ │ │ │ └── Link.tsx │ │ │ ├── test │ │ │ │ └── basic.test.tsx │ │ │ ├── tsconfig.json │ │ │ ├── vitest.config.ts │ │ │ └── vitest.setup.ts │ │ └── server │ │ │ ├── mockData.ts │ │ │ ├── src │ │ │ ├── app.ts │ │ │ └── index.ts │ │ │ └── test │ │ │ └── app.test.ts │ ├── tsconfig.json │ └── vitest.config.ts └── typecheck │ ├── package.json │ ├── test │ ├── normal.test.ts │ └── type.test-d.ts │ ├── tsconfig.json │ └── vite.config.ts ├── netlify.toml ├── package.json ├── packages ├── browser │ ├── README.md │ ├── aria-role.d.ts │ ├── context.d.ts │ ├── context.js │ ├── dummy.js │ ├── jest-dom.d.ts │ ├── matchers.d.ts │ ├── package.json │ ├── providers.d.ts │ ├── providers │ │ ├── playwright.d.ts │ │ └── webdriverio.d.ts │ ├── rollup.config.js │ ├── src │ │ ├── client │ │ │ ├── channel.ts │ │ │ ├── client.ts │ │ │ ├── orchestrator.html │ │ │ ├── orchestrator.ts │ │ │ ├── public │ │ │ │ ├── error-catcher.js │ │ │ │ ├── esm-client-injector.js │ │ │ │ └── favicon.svg │ │ │ ├── tester │ │ │ │ ├── context.ts │ │ │ │ ├── dialog.ts │ │ │ │ ├── expect-element.ts │ │ │ │ ├── expect │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── toBeChecked.ts │ │ │ │ │ ├── toBeEmptyDOMElement.ts │ │ │ │ │ ├── toBeEnabled.ts │ │ │ │ │ ├── toBeInTheDocument.ts │ │ │ │ │ ├── toBeInvalid.ts │ │ │ │ │ ├── toBePartiallyChecked.ts │ │ │ │ │ ├── toBeRequired.ts │ │ │ │ │ ├── toBeVisible.ts │ │ │ │ │ ├── toContainElement.ts │ │ │ │ │ ├── toContainHTML.ts │ │ │ │ │ ├── toHaveAccessibleDescription.ts │ │ │ │ │ ├── toHaveAccessibleErrorMessage.ts │ │ │ │ │ ├── toHaveAccessibleName.ts │ │ │ │ │ ├── toHaveAttribute.ts │ │ │ │ │ ├── toHaveClass.ts │ │ │ │ │ ├── toHaveDisplayValue.ts │ │ │ │ │ ├── toHaveFocus.ts │ │ │ │ │ ├── toHaveFormValues.ts │ │ │ │ │ ├── toHaveRole.ts │ │ │ │ │ ├── toHaveSelection.ts │ │ │ │ │ ├── toHaveStyle.ts │ │ │ │ │ ├── toHaveTextContent.ts │ │ │ │ │ ├── toHaveValue.ts │ │ │ │ │ └── utils.ts │ │ │ │ ├── locators │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── playwright.ts │ │ │ │ │ ├── preview.ts │ │ │ │ │ └── webdriverio.ts │ │ │ │ ├── logger.ts │ │ │ │ ├── mocker-interceptor.ts │ │ │ │ ├── mocker.ts │ │ │ │ ├── public-utils.ts │ │ │ │ ├── rpc.ts │ │ │ │ ├── runner.ts │ │ │ │ ├── snapshot.ts │ │ │ │ ├── state.ts │ │ │ │ ├── tester.html │ │ │ │ ├── tester.ts │ │ │ │ └── utils.ts │ │ │ ├── ui.ts │ │ │ ├── utils.ts │ │ │ └── vite.config.ts │ │ └── node │ │ │ ├── cdp.ts │ │ │ ├── commands │ │ │ ├── clear.ts │ │ │ ├── click.ts │ │ │ ├── dragAndDrop.ts │ │ │ ├── fill.ts │ │ │ ├── fs.ts │ │ │ ├── hover.ts │ │ │ ├── index.ts │ │ │ ├── keyboard.ts │ │ │ ├── screenshot.ts │ │ │ ├── select.ts │ │ │ ├── tab.ts │ │ │ ├── type.ts │ │ │ ├── upload.ts │ │ │ ├── utils.ts │ │ │ └── viewport.ts │ │ │ ├── constants.ts │ │ │ ├── index.ts │ │ │ ├── middlewares │ │ │ ├── orchestratorMiddleware.ts │ │ │ ├── testerMiddleware.ts │ │ │ └── utils.ts │ │ │ ├── plugin.ts │ │ │ ├── plugins │ │ │ └── pluginContext.ts │ │ │ ├── pool.ts │ │ │ ├── project.ts │ │ │ ├── projectParent.ts │ │ │ ├── providers │ │ │ ├── index.ts │ │ │ ├── playwright.ts │ │ │ ├── preview.ts │ │ │ └── webdriver.ts │ │ │ ├── rpc.ts │ │ │ ├── serverOrchestrator.ts │ │ │ ├── serverTester.ts │ │ │ ├── state.ts │ │ │ ├── types.ts │ │ │ └── utils.ts │ ├── tsconfig.json │ ├── types.ts │ └── utils.d.ts ├── coverage-istanbul │ ├── package.json │ ├── rollup.config.js │ ├── src │ │ ├── constants.ts │ │ ├── index.ts │ │ └── provider.ts │ └── tsconfig.json ├── coverage-v8 │ ├── package.json │ ├── rollup.config.js │ ├── src │ │ ├── browser.ts │ │ ├── index.ts │ │ ├── load-provider.ts │ │ └── provider.ts │ └── tsconfig.json ├── expect │ ├── README.md │ ├── index.d.ts │ ├── package.json │ ├── rollup.config.js │ ├── src │ │ ├── constants.ts │ │ ├── custom-matchers.ts │ │ ├── index.ts │ │ ├── jest-asymmetric-matchers.ts │ │ ├── jest-expect.ts │ │ ├── jest-extend.ts │ │ ├── jest-matcher-utils.ts │ │ ├── jest-utils.ts │ │ ├── state.ts │ │ ├── types.ts │ │ └── utils.ts │ └── tsconfig.json ├── mocker │ ├── EXPORTS.md │ ├── README.md │ ├── package.json │ ├── rollup.config.js │ ├── src │ │ ├── automocker.ts │ │ ├── browser │ │ │ ├── auto-register.ts │ │ │ ├── hints.ts │ │ │ ├── index.ts │ │ │ ├── interceptor-msw.ts │ │ │ ├── interceptor-native.ts │ │ │ ├── interceptor.ts │ │ │ ├── mocker.ts │ │ │ ├── register.ts │ │ │ └── utils.ts │ │ ├── index.ts │ │ ├── node │ │ │ ├── automockPlugin.ts │ │ │ ├── dynamicImportPlugin.ts │ │ │ ├── esmWalker.ts │ │ │ ├── hoistMocksPlugin.ts │ │ │ ├── index.ts │ │ │ ├── interceptorPlugin.ts │ │ │ ├── mockerPlugin.ts │ │ │ ├── redirect.ts │ │ │ └── resolver.ts │ │ ├── registry.ts │ │ ├── types.ts │ │ └── utils.ts │ └── tsconfig.json ├── pretty-format │ ├── package.json │ ├── rollup.config.js │ ├── src │ │ ├── collections.ts │ │ ├── index.ts │ │ ├── plugins │ │ │ ├── AsymmetricMatcher.ts │ │ │ ├── DOMCollection.ts │ │ │ ├── DOMElement.ts │ │ │ ├── Immutable.ts │ │ │ ├── ReactElement.ts │ │ │ ├── ReactTestComponent.ts │ │ │ └── lib │ │ │ │ ├── escapeHTML.ts │ │ │ │ └── markup.ts │ │ └── types.ts │ └── tsconfig.json ├── runner │ ├── README.md │ ├── package.json │ ├── rollup.config.js │ ├── src │ │ ├── collect.ts │ │ ├── context.ts │ │ ├── errors.ts │ │ ├── fixture.ts │ │ ├── hooks.ts │ │ ├── index.ts │ │ ├── map.ts │ │ ├── run.ts │ │ ├── setup.ts │ │ ├── suite.ts │ │ ├── test-state.ts │ │ ├── types.ts │ │ ├── types │ │ │ ├── runner.ts │ │ │ └── tasks.ts │ │ └── utils │ │ │ ├── chain.ts │ │ │ ├── collect.ts │ │ │ ├── index.ts │ │ │ ├── limit-concurrency.ts │ │ │ ├── suite.ts │ │ │ └── tasks.ts │ ├── tsconfig.json │ ├── types.d.ts │ └── utils.d.ts ├── snapshot │ ├── README.md │ ├── environment.d.ts │ ├── manager.d.ts │ ├── package.json │ ├── rollup.config.js │ ├── src │ │ ├── client.ts │ │ ├── env │ │ │ └── node.ts │ │ ├── environment.ts │ │ ├── index.ts │ │ ├── manager.ts │ │ ├── port │ │ │ ├── inlineSnapshot.ts │ │ │ ├── mockSerializer.ts │ │ │ ├── plugins.ts │ │ │ ├── rawSnapshot.ts │ │ │ ├── state.ts │ │ │ └── utils.ts │ │ └── types │ │ │ ├── environment.ts │ │ │ └── index.ts │ └── tsconfig.json ├── spy │ ├── README.md │ ├── package.json │ ├── rollup.config.js │ ├── src │ │ └── index.ts │ └── tsconfig.json ├── ui │ ├── README.md │ ├── browser.dev.js │ ├── client │ │ ├── App.vue │ │ ├── auto-imports.d.ts │ │ ├── components.d.ts │ │ ├── components │ │ │ ├── BrowserIframe.vue │ │ │ ├── CodeMirrorContainer.vue │ │ │ ├── ConnectionOverlay.vue │ │ │ ├── Coverage.vue │ │ │ ├── Dashboard.vue │ │ │ ├── DetailsPanel.vue │ │ │ ├── FileDetails.vue │ │ │ ├── FilterStatus.vue │ │ │ ├── IconAction.vue │ │ │ ├── IconButton.vue │ │ │ ├── Modal.vue │ │ │ ├── ModuleTransformResultView.vue │ │ │ ├── Navigation.vue │ │ │ ├── ProgressBar.vue │ │ │ ├── StatusIcon.vue │ │ │ ├── dashboard │ │ │ │ ├── DashboardEntry.spec.ts │ │ │ │ ├── DashboardEntry.vue │ │ │ │ ├── ErrorEntry.vue │ │ │ │ ├── TestFilesEntry.vue │ │ │ │ ├── TestsEntry.vue │ │ │ │ └── TestsFilesContainer.vue │ │ │ ├── explorer │ │ │ │ ├── Explorer.vue │ │ │ │ └── ExplorerItem.vue │ │ │ └── views │ │ │ │ ├── ScreenshotError.vue │ │ │ │ ├── ViewConsoleOutput.vue │ │ │ │ ├── ViewConsoleOutputEntry.spec.ts │ │ │ │ ├── ViewConsoleOutputEntry.vue │ │ │ │ ├── ViewEditor.vue │ │ │ │ ├── ViewModuleGraph.vue │ │ │ │ ├── ViewReport.spec.ts │ │ │ │ ├── ViewReport.vue │ │ │ │ └── ViewReportError.vue │ │ ├── composables │ │ │ ├── api.ts │ │ │ ├── browser.ts │ │ │ ├── client │ │ │ │ ├── index.ts │ │ │ │ ├── state.ts │ │ │ │ └── static.ts │ │ │ ├── codemirror.ts │ │ │ ├── dark.ts │ │ │ ├── error.ts │ │ │ ├── explorer │ │ │ │ ├── collapse.ts │ │ │ │ ├── collector.ts │ │ │ │ ├── expand.ts │ │ │ │ ├── filter.ts │ │ │ │ ├── index.ts │ │ │ │ ├── search.ts │ │ │ │ ├── state.ts │ │ │ │ ├── tree.ts │ │ │ │ ├── types.ts │ │ │ │ └── utils.ts │ │ │ ├── index.ts │ │ │ ├── module-graph.ts │ │ │ ├── navigation.ts │ │ │ └── params.ts │ │ ├── constants.ts │ │ ├── global-setup.ts │ │ ├── main.ts │ │ ├── pages │ │ │ └── index.vue │ │ ├── shim.d.ts │ │ ├── styles │ │ │ └── main.css │ │ ├── test.ts │ │ └── utils │ │ │ ├── escape.ts │ │ │ └── task.ts │ ├── explorer.md │ ├── index.html │ ├── node │ │ ├── index.ts │ │ ├── reporter.ts │ │ └── tsconfig.json │ ├── package.json │ ├── public │ │ ├── bg.png │ │ ├── favicon.ico │ │ └── favicon.svg │ ├── reporter.d.ts │ ├── rollup.config.js │ ├── shim.d.ts │ ├── tsconfig.json │ ├── types.ts │ └── vite.config.ts ├── utils │ ├── diff.d.ts │ ├── error.d.ts │ ├── helpers.d.ts │ ├── package.json │ ├── rollup.config.js │ ├── source-map.ts │ ├── src │ │ ├── diff │ │ │ ├── cleanupSemantic.ts │ │ │ ├── constants.ts │ │ │ ├── diffLines.ts │ │ │ ├── diffStrings.ts │ │ │ ├── getAlignedDiffs.ts │ │ │ ├── getType.ts │ │ │ ├── index.ts │ │ │ ├── joinAlignedDiffs.ts │ │ │ ├── normalizeDiffOptions.ts │ │ │ ├── printDiffs.ts │ │ │ └── types.ts │ │ ├── display.ts │ │ ├── error.ts │ │ ├── helpers.ts │ │ ├── highlight.ts │ │ ├── index.ts │ │ ├── nanoid.ts │ │ ├── offset.ts │ │ ├── random.ts │ │ ├── source-map.ts │ │ ├── timers.ts │ │ └── types.ts │ └── tsconfig.json ├── vite-node │ ├── .gitignore │ ├── README.md │ ├── assets │ │ └── vite-node.svg │ ├── package.json │ ├── rollup.config.js │ ├── src │ │ ├── cli.ts │ │ ├── client.ts │ │ ├── constants.ts │ │ ├── debug.ts │ │ ├── externalize.ts │ │ ├── hmr │ │ │ ├── emitter.ts │ │ │ ├── hmr.ts │ │ │ └── index.ts │ │ ├── index.ts │ │ ├── server.ts │ │ ├── source-map-handler.ts │ │ ├── source-map.ts │ │ ├── types.ts │ │ └── utils.ts │ ├── tsconfig.json │ └── vite-node.mjs ├── vitest │ ├── LICENSE.md │ ├── README.md │ ├── browser.d.ts │ ├── config.d.ts │ ├── coverage.d.ts │ ├── environments.d.ts │ ├── execute.d.ts │ ├── globals.d.ts │ ├── import-meta.d.ts │ ├── importMeta.d.ts │ ├── index.cjs │ ├── index.d.cts │ ├── jsdom.d.ts │ ├── mocker.d.ts │ ├── node.d.ts │ ├── optional-types.d.ts │ ├── package.json │ ├── reporters.d.ts │ ├── rollup.config.js │ ├── runners.d.ts │ ├── snapshot.d.ts │ ├── src │ │ ├── api │ │ │ ├── check.ts │ │ │ ├── setup.ts │ │ │ └── types.ts │ │ ├── constants.ts │ │ ├── create │ │ │ └── browser │ │ │ │ ├── creator.ts │ │ │ │ └── examples.ts │ │ ├── defaults.ts │ │ ├── integrations │ │ │ ├── chai │ │ │ │ ├── chai-subset.d.ts │ │ │ │ ├── config.ts │ │ │ │ ├── index.ts │ │ │ │ ├── poll.ts │ │ │ │ └── setup.ts │ │ │ ├── coverage.ts │ │ │ ├── css │ │ │ │ └── css-modules.ts │ │ │ ├── env │ │ │ │ ├── edge-runtime.ts │ │ │ │ ├── happy-dom.ts │ │ │ │ ├── index.ts │ │ │ │ ├── jsdom-keys.ts │ │ │ │ ├── jsdom.ts │ │ │ │ ├── loader.ts │ │ │ │ ├── node.ts │ │ │ │ └── utils.ts │ │ │ ├── globals.ts │ │ │ ├── inject.ts │ │ │ ├── mock │ │ │ │ ├── date.ts │ │ │ │ └── timers.ts │ │ │ ├── snapshot │ │ │ │ ├── chai.ts │ │ │ │ └── environments │ │ │ │ │ ├── node.ts │ │ │ │ │ └── resolveSnapshotEnvironment.ts │ │ │ ├── spy.ts │ │ │ ├── vi.ts │ │ │ └── wait.ts │ │ ├── node │ │ │ ├── browser │ │ │ │ └── sessions.ts │ │ │ ├── cache │ │ │ │ ├── files.ts │ │ │ │ ├── index.ts │ │ │ │ └── results.ts │ │ │ ├── cli.ts │ │ │ ├── cli │ │ │ │ ├── cac.ts │ │ │ │ ├── cli-api.ts │ │ │ │ ├── cli-config.ts │ │ │ │ └── filter.ts │ │ │ ├── config │ │ │ │ ├── resolveConfig.ts │ │ │ │ └── serializeConfig.ts │ │ │ ├── core.ts │ │ │ ├── coverage.ts │ │ │ ├── create.ts │ │ │ ├── errors.ts │ │ │ ├── git.ts │ │ │ ├── globalSetup.ts │ │ │ ├── hash.ts │ │ │ ├── logger.ts │ │ │ ├── packageInstaller.ts │ │ │ ├── plugins │ │ │ │ ├── coverageTransform.ts │ │ │ │ ├── cssEnabler.ts │ │ │ │ ├── index.ts │ │ │ │ ├── mocks.ts │ │ │ │ ├── normalizeURL.ts │ │ │ │ ├── optimizer.ts │ │ │ │ ├── publicConfig.ts │ │ │ │ ├── ssrReplacer.ts │ │ │ │ ├── utils.ts │ │ │ │ ├── vitestResolver.ts │ │ │ │ └── workspace.ts │ │ │ ├── pool.ts │ │ │ ├── pools │ │ │ │ ├── forks.ts │ │ │ │ ├── rpc.ts │ │ │ │ ├── threads.ts │ │ │ │ ├── typecheck.ts │ │ │ │ ├── vmForks.ts │ │ │ │ └── vmThreads.ts │ │ │ ├── printError.ts │ │ │ ├── project.ts │ │ │ ├── projects │ │ │ │ └── resolveProjects.ts │ │ │ ├── reporters │ │ │ │ ├── base.ts │ │ │ │ ├── basic.ts │ │ │ │ ├── benchmark │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── json-formatter.ts │ │ │ │ │ ├── reporter.ts │ │ │ │ │ ├── tableRender.ts │ │ │ │ │ └── verbose.ts │ │ │ │ ├── blob.ts │ │ │ │ ├── default.ts │ │ │ │ ├── dot.ts │ │ │ │ ├── github-actions.ts │ │ │ │ ├── hanging-process.ts │ │ │ │ ├── html.ts │ │ │ │ ├── index.ts │ │ │ │ ├── json.ts │ │ │ │ ├── junit.ts │ │ │ │ ├── renderers │ │ │ │ │ ├── figures.ts │ │ │ │ │ ├── indented-logger.ts │ │ │ │ │ ├── utils.ts │ │ │ │ │ └── windowedRenderer.ts │ │ │ │ ├── reported-tasks.ts │ │ │ │ ├── summary.ts │ │ │ │ ├── tap-flat.ts │ │ │ │ ├── tap.ts │ │ │ │ ├── utils.ts │ │ │ │ └── verbose.ts │ │ │ ├── sequencers │ │ │ │ ├── BaseSequencer.ts │ │ │ │ ├── RandomSequencer.ts │ │ │ │ └── types.ts │ │ │ ├── spec.ts │ │ │ ├── specifications.ts │ │ │ ├── state.ts │ │ │ ├── stdin.ts │ │ │ ├── test-run.ts │ │ │ ├── types │ │ │ │ ├── benchmark.ts │ │ │ │ ├── browser.ts │ │ │ │ ├── config.ts │ │ │ │ ├── coverage.ts │ │ │ │ ├── plugin.ts │ │ │ │ ├── pool-options.ts │ │ │ │ ├── reporter.ts │ │ │ │ ├── tests.ts │ │ │ │ ├── vite.ts │ │ │ │ └── worker.ts │ │ │ ├── vite.ts │ │ │ ├── viteLogger.ts │ │ │ ├── watch-filter.ts │ │ │ └── watcher.ts │ │ ├── paths.ts │ │ ├── public │ │ │ ├── browser.ts │ │ │ ├── config.ts │ │ │ ├── coverage.ts │ │ │ ├── environments.ts │ │ │ ├── execute.ts │ │ │ ├── index.ts │ │ │ ├── mocker.ts │ │ │ ├── node.ts │ │ │ ├── reporters.ts │ │ │ ├── runners.ts │ │ │ ├── snapshot.ts │ │ │ ├── suite.ts │ │ │ └── workers.ts │ │ ├── runtime │ │ │ ├── benchmark.ts │ │ │ ├── cleanup.ts │ │ │ ├── config.ts │ │ │ ├── console.ts │ │ │ ├── execute.ts │ │ │ ├── external-executor.ts │ │ │ ├── inspector.ts │ │ │ ├── mocker.ts │ │ │ ├── rpc.ts │ │ │ ├── runBaseTests.ts │ │ │ ├── runVmTests.ts │ │ │ ├── runners │ │ │ │ ├── benchmark.ts │ │ │ │ ├── index.ts │ │ │ │ └── test.ts │ │ │ ├── setup-common.ts │ │ │ ├── setup-node.ts │ │ │ ├── types │ │ │ │ ├── benchmark.ts │ │ │ │ └── utils.ts │ │ │ ├── utils.ts │ │ │ ├── vm │ │ │ │ ├── commonjs-executor.ts │ │ │ │ ├── esm-executor.ts │ │ │ │ ├── file-map.ts │ │ │ │ ├── types.ts │ │ │ │ ├── utils.ts │ │ │ │ └── vite-executor.ts │ │ │ ├── worker.ts │ │ │ └── workers │ │ │ │ ├── base.ts │ │ │ │ ├── forks.ts │ │ │ │ ├── threads.ts │ │ │ │ ├── types.ts │ │ │ │ ├── utils.ts │ │ │ │ ├── vm.ts │ │ │ │ ├── vmForks.ts │ │ │ │ └── vmThreads.ts │ │ ├── shims.dev.d.ts │ │ ├── typecheck │ │ │ ├── assertType.ts │ │ │ ├── collect.ts │ │ │ ├── expectTypeOf.ts │ │ │ ├── parse.ts │ │ │ ├── typechecker.ts │ │ │ ├── types.ts │ │ │ └── utils.ts │ │ ├── types │ │ │ ├── browser.ts │ │ │ ├── environment.ts │ │ │ ├── general.ts │ │ │ ├── global.ts │ │ │ ├── happy-dom-options.ts │ │ │ ├── jsdom-options.ts │ │ │ ├── mocker.ts │ │ │ ├── rpc.ts │ │ │ ├── ui.ts │ │ │ └── worker.ts │ │ └── utils │ │ │ ├── base.ts │ │ │ ├── colors.ts │ │ │ ├── config-helpers.ts │ │ │ ├── coverage.ts │ │ │ ├── debugger.ts │ │ │ ├── env.ts │ │ │ ├── graph.ts │ │ │ ├── memory-limit.ts │ │ │ ├── serialization.ts │ │ │ ├── source-map.ts │ │ │ ├── tasks.ts │ │ │ ├── test-helpers.ts │ │ │ ├── timers.ts │ │ │ └── workers.ts │ ├── suite.d.ts │ ├── suppress-warnings.cjs │ ├── tsconfig.json │ ├── utils.d.ts │ ├── vitest.mjs │ └── workers.d.ts ├── web-worker │ ├── README.md │ ├── index.d.ts │ ├── package.json │ ├── pure.d.ts │ ├── rollup.config.js │ ├── src │ │ ├── index.ts │ │ ├── pure.ts │ │ ├── runner.ts │ │ ├── shared-worker.ts │ │ ├── types.ts │ │ ├── utils.ts │ │ └── worker.ts │ └── tsconfig.json └── ws-client │ ├── package.json │ ├── rollup.config.js │ ├── src │ ├── index.ts │ └── state.ts │ └── tsconfig.json ├── patches ├── @sinonjs__fake-timers@14.0.0.patch ├── @types__sinonjs__fake-timers@8.1.5.patch ├── acorn@8.11.3.patch ├── cac@6.7.14.patch └── v8-to-istanbul@9.3.0.patch ├── pnpm-lock.yaml ├── pnpm-workspace.yaml ├── scripts ├── build-utils.js ├── publish-ci.ts ├── release.ts └── update-contributors.ts ├── shims.d.ts ├── test ├── README.md ├── benchmark │ ├── fixtures │ │ ├── basic │ │ │ ├── base.bench.ts │ │ │ ├── mode.bench.ts │ │ │ ├── only.bench.ts │ │ │ ├── should-not-run.test-d.ts │ │ │ └── vitest.config.ts │ │ ├── compare │ │ │ ├── basic.bench.ts │ │ │ └── vitest.config.ts │ │ ├── reporter │ │ │ ├── multiple.bench.ts │ │ │ ├── summary.bench.ts │ │ │ └── vitest.config.ts │ │ └── sequential │ │ │ ├── f1.bench.ts │ │ │ ├── f2.bench.ts │ │ │ ├── helper.ts │ │ │ ├── setup.ts │ │ │ └── vitest.config.ts │ ├── package.json │ ├── test │ │ ├── __snapshots__ │ │ │ ├── reporter.test.ts.snap │ │ │ └── sequential.test.ts.snap │ │ ├── basic.test.ts │ │ ├── compare.test.ts │ │ ├── reporter.test.ts │ │ └── sequential.test.ts │ └── vitest.config.ts ├── browser │ ├── bundled-lib │ │ ├── package.json │ │ └── src │ │ │ ├── a.js │ │ │ ├── b.js │ │ │ ├── index.d.ts │ │ │ └── index.js │ ├── cjs-lib │ │ ├── index.js │ │ ├── lib.d.ts │ │ ├── lib.mjs │ │ └── package.json │ ├── custom-diff-config.ts │ ├── custom-snapshot-env.ts │ ├── fixtures │ │ ├── benchmark │ │ │ ├── basic.bench.ts │ │ │ └── vitest.config.ts │ │ ├── browser-crash │ │ │ ├── browser-crash.test.ts │ │ │ └── vitest.config.ts │ │ ├── expect-dom │ │ │ ├── setup.ts │ │ │ ├── toBeChecked.test.ts │ │ │ ├── toBeDisabled.test.ts │ │ │ ├── toBeEmptyDOMElement.test.ts │ │ │ ├── toBeInTheDocument.test.ts │ │ │ ├── toBeInvalid.test.ts │ │ │ ├── toBePartiallyChecked.test.ts │ │ │ ├── toBeRequired.test.ts │ │ │ ├── toBeVisible.test.ts │ │ │ ├── toContainElement.test.ts │ │ │ ├── toContainHTML.test.ts │ │ │ ├── toHaveAccessibleDescription.test.ts │ │ │ ├── toHaveAccessibleErrorMessage.test.ts │ │ │ ├── toHaveAttribute.test.ts │ │ │ ├── toHaveClass.test.ts │ │ │ ├── toHaveDisplayValue.test.ts │ │ │ ├── toHaveFocus.test.ts │ │ │ ├── toHaveFormValues.test.ts │ │ │ ├── toHaveRole.test.ts │ │ │ ├── toHaveSelection.test.ts │ │ │ ├── toHaveStyle.test.ts │ │ │ ├── toHaveTextContent.test.ts │ │ │ ├── toHaveValue.test.ts │ │ │ ├── utils.ts │ │ │ └── vitest.config.js │ │ ├── failing │ │ │ ├── failing.snaphot.test.ts │ │ │ ├── failing.test.ts │ │ │ ├── src │ │ │ │ └── error.ts │ │ │ └── vitest.config.ts │ │ ├── inspect │ │ │ ├── math.test.ts │ │ │ ├── vitest.config.ts │ │ │ └── vitest.config.with-workspace.ts │ │ ├── locators-custom │ │ │ ├── basic.test.tsx │ │ │ └── vitest.config.ts │ │ ├── locators │ │ │ ├── blog.test.tsx │ │ │ ├── query.test.ts │ │ │ └── vitest.config.ts │ │ ├── mocking-out-of-root │ │ │ ├── project1 │ │ │ │ ├── basic.test.js │ │ │ │ ├── imported-test.js │ │ │ │ ├── lib.js │ │ │ │ └── vitest.config.ts │ │ │ ├── project2 │ │ │ │ └── index.js │ │ │ └── project3 │ │ │ │ ├── imported-test.js │ │ │ │ └── lib.js │ │ ├── mocking-watch │ │ │ ├── 1_mocked-on-watch-change.test.ts │ │ │ ├── 2_not-mocked-import.test.ts │ │ │ └── vitest.config.ts │ │ ├── mocking │ │ │ ├── automocked.test.ts │ │ │ ├── autospying.test.ts │ │ │ ├── import-actual-dep.test.ts │ │ │ ├── import-actual-in-mock.test.ts │ │ │ ├── import-actual-query.test.ts │ │ │ ├── import-mock.test.ts │ │ │ ├── mocked-__mocks__.test.ts │ │ │ ├── mocked-do-mock-factory.test.ts │ │ │ ├── mocked-factory-hoisted.test.ts │ │ │ ├── mocked-factory.test.ts │ │ │ ├── mocked-nested.test.ts │ │ │ ├── mocking-dep.test.ts │ │ │ ├── not-mocked-nested.test.ts │ │ │ ├── not-mocked.test.ts │ │ │ ├── src │ │ │ │ ├── __mocks__ │ │ │ │ │ └── mocks_calculator.ts │ │ │ │ ├── actions.ts │ │ │ │ ├── calculator.ts │ │ │ │ ├── example.ts │ │ │ │ ├── mocks_calculator.ts │ │ │ │ ├── mocks_factory.ts │ │ │ │ ├── mocks_factory_many.ts │ │ │ │ ├── mocks_factory_many_dep1.ts │ │ │ │ ├── mocks_factory_many_dep2.ts │ │ │ │ ├── nested_child.ts │ │ │ │ └── nested_parent.ts │ │ │ └── vitest.config.ts │ │ ├── multiple-different-configs │ │ │ ├── basic.test.js │ │ │ ├── customTester.html │ │ │ └── vitest.config.js │ │ ├── playwright-connect │ │ │ ├── basic.test.js │ │ │ └── vitest.config.js │ │ ├── print-logs │ │ │ ├── test │ │ │ │ ├── dialog.test.ts │ │ │ │ └── logs.test.ts │ │ │ └── vitest.config.ts │ │ ├── server-url │ │ │ ├── basic.test.ts │ │ │ └── vitest.config.ts │ │ ├── setup-file │ │ │ ├── browser-setup.ts │ │ │ ├── module-equality.test.ts │ │ │ ├── source.ts │ │ │ └── vitest.config.ts │ │ ├── timeout-hooks │ │ │ ├── hooks-timeout.test.ts │ │ │ └── vitest.config.ts │ │ ├── timeout │ │ │ ├── timeout.test.ts │ │ │ └── vitest.config.ts │ │ ├── unhandled │ │ │ ├── throw-unhandled-error.test.ts │ │ │ └── vitest.config.ts │ │ ├── update-snapshot │ │ │ ├── __snapshots__ │ │ │ │ ├── basic.test.ts.snap │ │ │ │ └── custom │ │ │ │ │ └── my_snapshot │ │ │ ├── basic-fixture.ts │ │ │ └── vitest.config.ts │ │ ├── user-event │ │ │ ├── cleanup-retry.test.ts │ │ │ ├── cleanup1.test.ts │ │ │ ├── cleanup2.test.ts │ │ │ ├── clipboard.test.ts │ │ │ ├── keyboard.test.ts │ │ │ └── vitest.config.ts │ │ ├── viewport │ │ │ ├── basic.test.ts │ │ │ └── vitest.config.ts │ │ └── worker │ │ │ ├── src │ │ │ ├── basic.test.ts │ │ │ ├── worker-dynamic-dep.ts │ │ │ └── worker.ts │ │ │ └── vitest.config.ts │ ├── injected-lib │ │ ├── index.js │ │ └── package.json │ ├── injected.ts │ ├── package.json │ ├── settings.ts │ ├── setup.unit.ts │ ├── specs │ │ ├── __snapshots__ │ │ │ └── update-snapshot.test.ts.snap │ │ ├── benchmark.test.ts │ │ ├── browser-crash.test.ts │ │ ├── expect-dom.test.ts │ │ ├── filter.test.ts │ │ ├── fix-4686.test.ts │ │ ├── inspect.test.ts │ │ ├── locators.test.ts │ │ ├── mocking.test.ts │ │ ├── multiple-different-configs.test.ts │ │ ├── playwright-connect.test.ts │ │ ├── runner.test.ts │ │ ├── server-url.test.ts │ │ ├── setup-file.test.ts │ │ ├── unhandled.test.ts │ │ ├── update-snapshot.test.ts │ │ ├── utils.ts │ │ ├── viewport.test.ts │ │ └── worker.test.ts │ ├── src │ │ ├── __mocks__ │ │ │ └── _calculator.ts │ │ ├── actions.ts │ │ ├── blog-app │ │ │ └── blog.tsx │ │ ├── button.css │ │ ├── calculator.ts │ │ └── createNode.ts │ ├── test │ │ ├── __snapshots__ │ │ │ ├── custom │ │ │ │ └── my_snapshot │ │ │ ├── snapshot.test.ts.snap │ │ │ └── utils.test.ts.snap │ │ ├── another.test.ts │ │ ├── basic.test.ts │ │ ├── cdp.test.ts │ │ ├── cjs-lib.test.ts │ │ ├── commands.test.ts │ │ ├── dom.test.ts │ │ ├── expect-element.test.ts │ │ ├── injected.test.ts │ │ ├── polyfill-lib.test.ts │ │ ├── server-headers.test.ts │ │ ├── snapshot.test.ts │ │ ├── timers.test.ts │ │ ├── userEvent.test.ts │ │ ├── utils.test.ts │ │ └── viewport.test.ts │ ├── tsconfig.json │ ├── vitest.config-basepath.mts │ ├── vitest.config.mts │ └── vitest.config.unit.mts ├── cli │ ├── custom.ts │ ├── deps │ │ ├── error │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ ├── transpiled-inline.js │ │ │ ├── transpiled-inline.ts │ │ │ ├── transpiled.js │ │ │ ├── transpiled.js.map │ │ │ ├── transpiled.ts │ │ │ └── ts.ts │ │ └── linked │ │ │ ├── index.ts │ │ │ └── package.json │ ├── fixtures │ │ ├── browser-init │ │ │ ├── package.json │ │ │ └── vitest.config.ts │ │ ├── browser-multiple │ │ │ ├── basic.test.js │ │ │ ├── package.json │ │ │ └── vitest.config.ts │ │ ├── config-loader │ │ │ ├── browser │ │ │ │ ├── basic.test.ts │ │ │ │ └── vitest.config.ts │ │ │ ├── node │ │ │ │ ├── basic.test.ts │ │ │ │ └── vitest.config.ts │ │ │ └── vitest.config.ts │ │ ├── console │ │ │ ├── trace.test.ts │ │ │ └── vitest.config.ts │ │ ├── create-vitest │ │ │ ├── basic.test.ts │ │ │ └── vitest.config.ts │ │ ├── custom-file-env │ │ │ └── custom-file-env.test.ts │ │ ├── custom-pool │ │ │ ├── pool │ │ │ │ └── custom-pool.ts │ │ │ ├── tests │ │ │ │ ├── custom-not-run.spec.ts │ │ │ │ └── custom-run.threads.spec.ts │ │ │ └── vitest.config.ts │ │ ├── custom-runner │ │ │ ├── custom-runner.test.ts │ │ │ ├── test-runner.ts │ │ │ ├── utils.ts │ │ │ └── vitest.config.ts │ │ ├── dotted-files │ │ │ └── .cache │ │ │ │ └── projects │ │ │ │ └── test │ │ │ │ ├── .cache │ │ │ │ └── should-not-run.test.ts │ │ │ │ └── should-run.test.ts │ │ ├── expect-soft │ │ │ ├── expects │ │ │ │ └── soft.test.ts │ │ │ └── vite.config.ts │ │ ├── fails │ │ │ ├── .dot-folder │ │ │ │ └── dot-test.test.ts │ │ │ ├── async-assertion.test.ts │ │ │ ├── concurrent-suite-deadlock.test.ts │ │ │ ├── concurrent-test-deadlock.test.ts │ │ │ ├── each-timeout.test.ts │ │ │ ├── empty.test.ts │ │ │ ├── expect-soft.test.ts │ │ │ ├── expect-unreachable.test.ts │ │ │ ├── expect.test.ts │ │ │ ├── hook-timeout.test.ts │ │ │ ├── hooks-called.test.ts │ │ │ ├── hooks-fail-afterAll.test.ts │ │ │ ├── hooks-fail-afterEach.test.ts │ │ │ ├── hooks-fail-beforeAll.test.ts │ │ │ ├── hooks-fail-beforeEach.test.ts │ │ │ ├── hooks-timeout-before-hook-cleanup-callback.test.ts │ │ │ ├── inline-snapshop-inside-each.test.ts │ │ │ ├── mock-import-proxy-module.test.ts │ │ │ ├── nested-suite.test.ts │ │ │ ├── no-assertions.test.ts │ │ │ ├── node-browser-context.test.ts │ │ │ ├── poll-no-awaited.test.ts │ │ │ ├── primitive-error.test.ts │ │ │ ├── proxy-module.ts │ │ │ ├── skip-conditional.test.ts │ │ │ ├── snapshot-with-not.test.ts │ │ │ ├── stall.test.ts │ │ │ ├── test-extend │ │ │ │ ├── circular-dependency.test.ts │ │ │ │ ├── fixture-error.test.ts │ │ │ │ ├── fixture-rest-params.test.ts │ │ │ │ ├── fixture-rest-props.test.ts │ │ │ │ ├── fixture-without-destructuring.test.ts │ │ │ │ ├── test-rest-params.test.ts │ │ │ │ ├── test-rest-props.test.ts │ │ │ │ └── test-without-destructuring.test.ts │ │ │ ├── test-timeout.test.ts │ │ │ ├── unhandled-suite.test.ts │ │ │ ├── unhandled.test.ts │ │ │ └── vite.config.ts │ │ ├── git-changed │ │ │ ├── related │ │ │ │ ├── deep-related-exports.test.ts │ │ │ │ ├── deep-related-imports.test.ts │ │ │ │ ├── not-related.test.ts │ │ │ │ ├── related.test.ts │ │ │ │ ├── src │ │ │ │ │ ├── sourceA.ts │ │ │ │ │ ├── sourceB.ts │ │ │ │ │ ├── sourceC.ts │ │ │ │ │ └── sourceD.ts │ │ │ │ └── vitest.config.js │ │ │ └── workspace │ │ │ │ ├── package.json │ │ │ │ ├── packages │ │ │ │ ├── packageA │ │ │ │ │ ├── index.js │ │ │ │ │ ├── index.test.js │ │ │ │ │ └── vitest.config.mjs │ │ │ │ └── packageB │ │ │ │ │ ├── index.js │ │ │ │ │ ├── index.test.js │ │ │ │ │ └── vitest.config.mjs │ │ │ │ └── vitest.config.mjs │ │ ├── global-setup-fail │ │ │ ├── example.test.ts │ │ │ ├── globalSetup │ │ │ │ └── error.js │ │ │ └── vitest.config.ts │ │ ├── inspect │ │ │ ├── math.test.ts │ │ │ ├── vitest.config.ts │ │ │ └── vitest.config.ts.timestamp-1713887058308-b154731a64b17.mjs │ │ ├── list │ │ │ ├── basic.test.ts │ │ │ ├── custom.config.ts │ │ │ ├── describe-error.test.ts │ │ │ ├── fail.config.ts │ │ │ ├── math.test.ts │ │ │ ├── top-level-error.test.ts │ │ │ ├── type.test-d.ts │ │ │ └── vitest.config.ts │ │ ├── location-filters │ │ │ ├── basic.test.ts │ │ │ ├── math-with-dashes-in-name.test.ts │ │ │ ├── math.test.ts │ │ │ ├── no-task-location.config.ts │ │ │ └── vitest.config.ts │ │ ├── network-imports │ │ │ ├── basic.test.ts │ │ │ └── public │ │ │ │ └── slash@3.0.0.js │ │ ├── plugin │ │ │ ├── basic.test.ts │ │ │ └── vitest.config.ts │ │ ├── public-api │ │ │ ├── custom.spec.ts │ │ │ └── vitest.config.ts │ │ ├── reported-tasks │ │ │ └── 1_first.test.ts │ │ ├── restricted-fs │ │ │ ├── src │ │ │ │ └── math.js │ │ │ ├── tests │ │ │ │ └── basic.spec.js │ │ │ ├── vitest.config.ts │ │ │ └── vitest.setup.js │ │ ├── setup-files │ │ │ ├── console-setup.ts │ │ │ ├── empty-setup.ts │ │ │ └── empty.test.ts │ │ ├── skip-note │ │ │ └── basic.test.ts │ │ ├── stacktraces │ │ │ ├── add-in-imba.test.imba │ │ │ ├── add-in-js.test.js │ │ │ ├── add.test.ts │ │ │ ├── error-in-deps.test.js │ │ │ ├── error-in-package.test.js │ │ │ ├── error-with-stack.test.js │ │ │ ├── foo.js │ │ │ ├── frame.spec.imba │ │ │ ├── mocked-global.test.js │ │ │ ├── mocked-imported.test.js │ │ │ ├── mocked-imported.test.ts │ │ │ ├── require-assertions.test.js │ │ │ ├── reset-modules.test.ts │ │ │ ├── setup.js │ │ │ ├── utils.ts │ │ │ └── vite.config.ts │ │ ├── tty │ │ │ ├── example.test.ts │ │ │ ├── example.ts │ │ │ ├── math.test.ts │ │ │ ├── math.ts │ │ │ └── vitest.config.ts │ │ ├── vitest.config.js │ │ ├── vm-threads │ │ │ ├── import-external-css-assets.test.js │ │ │ ├── module.test.js │ │ │ ├── not-found.test.ts │ │ │ ├── require-cjs.test.js │ │ │ ├── src │ │ │ │ └── external │ │ │ │ │ ├── assets │ │ │ │ │ ├── file1.png │ │ │ │ │ ├── file2.txt │ │ │ │ │ └── file3.svg │ │ │ │ │ ├── css │ │ │ │ │ ├── empty.css │ │ │ │ │ ├── processed.css │ │ │ │ │ └── processed.module.css │ │ │ │ │ ├── default-cjs.cjs │ │ │ │ │ ├── export-default-cjs.js │ │ │ │ │ ├── export-nested-default-cjs.js │ │ │ │ │ ├── nested-default-cjs.cjs │ │ │ │ │ ├── not-found.js │ │ │ │ │ ├── package-null │ │ │ │ │ └── package-null.js │ │ │ │ │ ├── package.json │ │ │ │ │ └── primitive-cjs.cjs │ │ │ └── vitest.config.ts │ │ ├── windows-drive-case │ │ │ └── basic.test.ts │ │ └── ws-server-url │ │ │ ├── basic.test.ts │ │ │ └── vitest.config.ts │ ├── package.json │ ├── test │ │ ├── __snapshots__ │ │ │ ├── fails.test.ts.snap │ │ │ ├── list.test.ts.snap │ │ │ └── stacktraces.test.ts.snap │ │ ├── annotations.test.ts │ │ ├── browser-multiple.test.ts │ │ ├── config-loader.test.ts │ │ ├── console.test.ts │ │ ├── create-vitest.test.ts │ │ ├── custom-pool.test.ts │ │ ├── custom-runner.test.ts │ │ ├── dotted-files.test.ts │ │ ├── expect-soft.test.ts │ │ ├── fails.test.ts │ │ ├── git-changed.test.ts │ │ ├── global-setup-fail.test.ts │ │ ├── group-order.test.ts │ │ ├── init.test.ts │ │ ├── inspect.test.ts │ │ ├── list.test.ts │ │ ├── location-filters.test.ts │ │ ├── network-imports.test.ts │ │ ├── plugin.test.ts │ │ ├── print-error.test.ts │ │ ├── public-api.test.ts │ │ ├── reported-tasks.test.ts │ │ ├── restricted-fs.test.ts │ │ ├── retry-clear-mocks.test.ts │ │ ├── run-custom-env.test.ts │ │ ├── scoped-fixtures.test.ts │ │ ├── server-url.test.ts │ │ ├── setup-files.test.ts │ │ ├── signal.test.ts │ │ ├── skip-note.test.ts │ │ ├── stacktraces.test.ts │ │ ├── tty.test.ts │ │ ├── vm-threads.test.ts │ │ └── windows-drive-case.test.ts │ └── vitest.config.ts ├── config │ ├── deps │ │ ├── test-dep-conditions-indirect │ │ │ ├── false.js │ │ │ ├── package.json │ │ │ └── true.js │ │ └── test-dep-conditions │ │ │ ├── false.js │ │ │ ├── indirect.js │ │ │ ├── inline.js │ │ │ ├── package.json │ │ │ └── true.js │ ├── fixtures │ │ ├── allowed-exec-args-fixtures │ │ │ ├── allowed-exec-argv.test.ts │ │ │ └── vitest.config.ts │ │ ├── bail │ │ │ ├── test │ │ │ │ ├── first.test.ts │ │ │ │ └── second.test.ts │ │ │ └── vitest.config.ts │ │ ├── base-path │ │ │ ├── src │ │ │ │ └── index.ts │ │ │ └── test │ │ │ │ └── mocking-with-base.spec.ts │ │ ├── browser-custom-html │ │ │ ├── browser-basic.test.ts │ │ │ ├── browser-custom.test.ts │ │ │ ├── custom-html.html │ │ │ ├── vitest.config.correct.ts │ │ │ ├── vitest.config.custom-transformIndexHtml.ts │ │ │ ├── vitest.config.default-transformIndexHtml.ts │ │ │ ├── vitest.config.error-hook.ts │ │ │ └── vitest.config.non-existing.ts │ │ ├── browser-no-config │ │ │ └── vitest.config.ts │ │ ├── cache │ │ │ ├── basic.test.ts │ │ │ └── second.test.ts │ │ ├── chai-config │ │ │ ├── test-each-title.test.ts │ │ │ └── vitest.config.ts │ │ ├── conditions-pkg │ │ │ ├── index.js │ │ │ └── package.json │ │ ├── conditions-subpackage │ │ │ ├── custom.js │ │ │ ├── default.js │ │ │ ├── development.js │ │ │ ├── package.json │ │ │ └── production.js │ │ ├── conditions-test │ │ │ ├── conditions.test.js │ │ │ └── vitest.config.ts │ │ ├── conditions │ │ │ ├── basic.test.js │ │ │ └── vite.config.ts │ │ ├── console-batch │ │ │ └── basic.test.ts │ │ ├── console-color │ │ │ ├── basic.test.ts │ │ │ └── vitest.config.ts │ │ ├── console │ │ │ ├── basic.test.ts │ │ │ └── vitest.config.ts │ │ ├── css │ │ │ ├── App.css │ │ │ ├── App.module.css │ │ │ ├── test │ │ │ │ ├── default-css.spec.ts │ │ │ │ ├── non-scope-module.spec.ts │ │ │ │ ├── process-css.spec.ts │ │ │ │ ├── process-inline.spec.ts │ │ │ │ ├── process-module.spec.ts │ │ │ │ └── scope-module.spec.ts │ │ │ └── utils.ts │ │ ├── dangerously-ignore-unhandled-errors │ │ │ └── tests │ │ │ │ └── throw-errors.test.ts │ │ ├── diff │ │ │ ├── basic.test.ts │ │ │ └── vite.config.ts │ │ ├── exclude │ │ │ ├── math.test.ts │ │ │ ├── math.ts │ │ │ ├── string.test.ts │ │ │ ├── string.ts │ │ │ └── vitest.exclude.config.ts │ │ ├── exec-args-fixtures │ │ │ ├── forks.test.ts │ │ │ ├── threads.test.ts │ │ │ └── vmThreads.test.ts │ │ ├── filters-slash │ │ │ ├── test │ │ │ │ ├── basic-foo │ │ │ │ │ └── a.test.ts │ │ │ │ ├── basic.test.ts │ │ │ │ ├── basic │ │ │ │ │ └── a.test.ts │ │ │ │ └── foo-basic │ │ │ │ │ └── a.test.ts │ │ │ └── vitest.config.ts │ │ ├── filters │ │ │ └── test │ │ │ │ ├── config.test.ts │ │ │ │ ├── dont-run-this.test.ts │ │ │ │ └── example.test.ts │ │ ├── fixture-no-async │ │ │ ├── basic.test.ts │ │ │ └── vitest.config.ts │ │ ├── fs-cached-check │ │ │ └── basic.test.ts │ │ ├── get-state │ │ │ ├── a.test.ts │ │ │ ├── b.test.ts │ │ │ ├── c.test.ts │ │ │ └── vitest.config.ts │ │ ├── hook-timeout │ │ │ └── basic.test.ts │ │ ├── inline-setup-file │ │ │ ├── file-setup.js │ │ │ ├── test.test.js │ │ │ └── vitest.config.js │ │ ├── mixed-environments │ │ │ ├── project │ │ │ │ └── test │ │ │ │ │ ├── happy-dom.test.ts │ │ │ │ │ ├── jsdom.test.ts │ │ │ │ │ ├── node.test.ts │ │ │ │ │ └── workspace-project.test.ts │ │ │ └── vitest.config.ts │ │ ├── mode │ │ │ ├── example.benchmark.ts │ │ │ ├── example.test.ts │ │ │ ├── vitest.benchmark.config.ts │ │ │ └── vitest.test.config.ts │ │ ├── no-browser-workspace │ │ │ └── vitest.config.ts │ │ ├── no-exec-args-fixtures │ │ │ ├── no-exec-argv.test.ts │ │ │ └── vitest.config.ts │ │ ├── pass-empty-files │ │ │ └── empty.test.ts │ │ ├── pool-isolation │ │ │ ├── isolated.test.ts │ │ │ └── non-isolated.test.ts │ │ ├── project │ │ │ ├── packages │ │ │ │ ├── project_1 │ │ │ │ │ └── base.test.ts │ │ │ │ ├── project_2 │ │ │ │ │ └── base.test.ts │ │ │ │ └── space_1 │ │ │ │ │ └── base.test.ts │ │ │ └── vitest.config.ts │ │ ├── public-config │ │ │ ├── vitest.config.ts │ │ │ └── vitest.custom.config.ts │ │ ├── retry │ │ │ ├── retry.test.ts │ │ │ └── vitest.config.ts │ │ ├── rollup-error │ │ │ ├── not-found-export.test.ts │ │ │ ├── not-found-package.test.ts │ │ │ └── vitest.config.ts │ │ ├── sequence-concurrent │ │ │ ├── sequence-concurrent-false-concurrent.test.ts │ │ │ ├── sequence-concurrent-false-sequential.test.ts │ │ │ ├── sequence-concurrent-true-concurrent.test.ts │ │ │ └── sequence-concurrent-true-sequential.test.ts │ │ ├── shard │ │ │ ├── test │ │ │ │ ├── 1.test.js │ │ │ │ ├── 2.test.js │ │ │ │ └── 3.test.js │ │ │ └── vitest.config.js │ │ ├── shuffle │ │ │ ├── basic.test.ts │ │ │ └── vitest.config.ts │ │ ├── snapshot-path-context │ │ │ ├── __snapshots__ │ │ │ │ ├── project1 │ │ │ │ │ └── basic.test.ts.snap │ │ │ │ └── project2 │ │ │ │ │ └── basic.test.ts.snap │ │ │ ├── basic.test.ts │ │ │ └── vitest.config.ts │ │ ├── test │ │ │ ├── example.test.ts │ │ │ ├── fake-timers.test.ts │ │ │ └── vitest.config.js │ │ ├── unhandled-rejections │ │ │ ├── setup-unhandled-rejections.ts │ │ │ └── tests │ │ │ │ └── example.test.ts │ │ ├── vitest.config.js │ │ ├── watch-trigger-pattern │ │ │ ├── folder │ │ │ │ └── fs │ │ │ │ │ ├── basic.test.ts │ │ │ │ │ └── text.txt │ │ │ └── vitest.config.ts │ │ ├── workers-option │ │ │ ├── example.test.ts │ │ │ └── vitest.config.js │ │ ├── workspace-flags │ │ │ ├── projects │ │ │ │ ├── cli-config.test.ts │ │ │ │ └── vitest.config.js │ │ │ └── vitest.config.js │ │ └── workspace │ │ │ ├── api │ │ │ ├── basic.test.ts │ │ │ └── vite.custom.config.js │ │ │ ├── browser │ │ │ └── workspace-with-browser.ts │ │ │ ├── config-empty │ │ │ └── vitest.config.js │ │ │ ├── config-extends │ │ │ ├── repro.test.js │ │ │ └── vitest.config.ts │ │ │ ├── config-import-analysis │ │ │ ├── dep.ts │ │ │ ├── packages │ │ │ │ └── a │ │ │ │ │ ├── package.json │ │ │ │ │ └── test.test.ts │ │ │ └── vitest.config.ts │ │ │ ├── invalid-duplicate-configs │ │ │ ├── vitest.config.ts │ │ │ ├── vitest1.config.js │ │ │ └── vitest2.config.js │ │ │ ├── invalid-duplicate-inline │ │ │ └── vitest.config.ts │ │ │ ├── invalid-non-existing-config │ │ │ └── vitest.config.ts │ │ │ ├── negated │ │ │ ├── packages │ │ │ │ ├── a │ │ │ │ │ ├── package.json │ │ │ │ │ └── test.test.ts │ │ │ │ ├── b │ │ │ │ │ ├── package.json │ │ │ │ │ └── test.test.ts │ │ │ │ └── c │ │ │ │ │ ├── package.json │ │ │ │ │ └── test.test.ts │ │ │ └── vitest.config.ts │ │ │ ├── nested │ │ │ └── e2e.projects.js │ │ │ ├── project-1 │ │ │ └── calculator-1.test.ts │ │ │ ├── project-2 │ │ │ └── calculator-2.test.ts │ │ │ ├── several-configs │ │ │ ├── test │ │ │ │ ├── 1_test.test.ts │ │ │ │ ├── 2_test.test.ts │ │ │ │ ├── vitest.config.one.ts │ │ │ │ └── vitest.config.two.ts │ │ │ └── vitest.config.ts │ │ │ └── several-folders │ │ │ ├── apps │ │ │ └── b │ │ │ │ ├── package.json │ │ │ │ └── test.test.ts │ │ │ ├── projects │ │ │ └── a │ │ │ │ ├── package.json │ │ │ │ └── test.test.ts │ │ │ └── vitest.config.ts │ ├── package.json │ ├── test │ │ ├── __snapshots__ │ │ │ ├── diff.test.ts.snap │ │ │ └── hook-timeout.test.ts.snap │ │ ├── bail.test.ts │ │ ├── base-path.test.ts │ │ ├── browser-configs.test.ts │ │ ├── browser-html.test.ts │ │ ├── cache.test.ts │ │ ├── chai-config.test.ts │ │ ├── conditions-cli.test.ts │ │ ├── config-types.test-d.ts │ │ ├── configureVitest.test.ts │ │ ├── console-color.test.ts │ │ ├── console.test.ts │ │ ├── css-configs.test.ts │ │ ├── dangerously-ignore-unhandled-errors.test.ts │ │ ├── diff.test.ts │ │ ├── exclude.test.ts │ │ ├── exec-args.test.ts │ │ ├── failures.test.ts │ │ ├── fixture-no-async.test.ts │ │ ├── flags.test.ts │ │ ├── fs-cached-check.test.ts │ │ ├── get-state.test.ts │ │ ├── hook-timeout.test.ts │ │ ├── inline-setup-file.test.ts │ │ ├── mixed-environments.test.ts │ │ ├── mode.test.ts │ │ ├── node-sqlite.test.ts │ │ ├── override.test.ts │ │ ├── pass-empty-files.test.ts │ │ ├── pool-isolation.test.ts │ │ ├── project.test.ts │ │ ├── projects.test.ts │ │ ├── public.test.ts │ │ ├── retry.test.ts │ │ ├── rollup-error.test.ts │ │ ├── sequence-concurrent.test.ts │ │ ├── shard.test.ts │ │ ├── shuffle-options.test.ts │ │ ├── snapshot.test.ts │ │ ├── testname-pattern.test.ts │ │ ├── unhandled-rejections.test.ts │ │ ├── watch-trigger-pattern.test.ts │ │ └── workers-option.test.ts │ ├── tsconfig.json │ └── vitest.config.ts ├── core │ ├── .env.local │ ├── __mocks__ │ │ ├── @vueuse │ │ │ └── integrations │ │ │ │ └── useJwt.ts │ │ ├── axios │ │ │ └── index.ts │ │ ├── custom-lib.ts │ │ ├── extension.js.ts │ │ ├── fs.cjs │ │ ├── fs │ │ │ └── promises.cjs │ │ ├── timers.ts │ │ ├── virtual-module.ts │ │ ├── vscode-mocks.ts │ │ └── zustand.ts │ ├── cute-puppy.jpg │ ├── deps │ │ ├── dep-cjs │ │ │ ├── esm-comment.js │ │ │ ├── esm-string.js │ │ │ └── package.json │ │ ├── dep1 │ │ │ ├── esm │ │ │ │ └── index.js │ │ │ └── package.json │ │ └── dep2 │ │ │ ├── index.js │ │ │ └── package.json │ ├── index.html │ ├── package.json │ ├── projects │ │ ├── custom-lib │ │ │ ├── index.js │ │ │ └── package.json │ │ └── inline-lib │ │ │ ├── index.js │ │ │ └── package.json │ ├── src │ │ ├── __mocks__ │ │ │ └── submodule.ts │ │ ├── aliased-mod.ts │ │ ├── circularA.ts │ │ ├── circularB.ts │ │ ├── cjs │ │ │ ├── array-cjs.js │ │ │ ├── bare-cjs.js │ │ │ ├── class-cjs.js │ │ │ ├── default-function.d.ts │ │ │ ├── default-function.js │ │ │ ├── module-cjs.ts │ │ │ ├── nested-default-cjs.js │ │ │ ├── primitive-cjs.js │ │ │ ├── promise-export.js │ │ │ └── prototype-cjs.js │ │ ├── custom │ │ │ └── gardener.ts │ │ ├── dynamic-import.ts │ │ ├── env.ts │ │ ├── esm │ │ │ ├── esm.js │ │ │ ├── internal-esm.mjs │ │ │ └── package.json │ │ ├── exec.ts │ │ ├── external │ │ │ ├── default-cjs.js │ │ │ ├── nested-default-cjs.js │ │ │ ├── package.json │ │ │ ├── pkg-browser │ │ │ │ ├── index.d.ts │ │ │ │ ├── package.json │ │ │ │ ├── ssr.js │ │ │ │ └── web.js │ │ │ └── pkg-node │ │ │ │ ├── index.d.ts │ │ │ │ ├── package.json │ │ │ │ ├── ssr.js │ │ │ │ └── web.js │ │ ├── file-css.css │ │ ├── file-less.less │ │ ├── file-sass.sass │ │ ├── file-scss.scss │ │ ├── file-txt.txt │ │ ├── global-mock.ts │ │ ├── in-source │ │ │ ├── add.ts │ │ │ ├── fibonacci.ts │ │ │ └── index.ts │ │ ├── mockedA.ts │ │ ├── mockedB.ts │ │ ├── mockedC.ts │ │ ├── mockedD.ts │ │ ├── mockedE.ts │ │ ├── mocks │ │ │ ├── A.ts │ │ │ ├── B.ts │ │ │ ├── cyclic-deps │ │ │ │ ├── module-1.mjs │ │ │ │ ├── module-2.mjs │ │ │ │ ├── module-3.mjs │ │ │ │ └── module-4.mjs │ │ │ ├── default.ts │ │ │ ├── dynamic-module.d.ts │ │ │ ├── dynamic-module.js │ │ │ ├── example.ts │ │ │ ├── export-default-circle-b.ts │ │ │ ├── export-default-circle-index.ts │ │ │ ├── external │ │ │ │ ├── cjs-pseudoesm.cjs │ │ │ │ ├── default-cjs.cjs │ │ │ │ ├── default-function.cjs │ │ │ │ └── external.mjs │ │ │ ├── has space in path.ts │ │ │ ├── integration.ts │ │ │ ├── log.ts │ │ │ ├── main.js │ │ │ ├── moduleA.ts │ │ │ ├── moduleB.ts │ │ │ ├── moduleWithSymbol.ts │ │ │ ├── retry-dynamic-import.ts │ │ │ ├── set-foo.ts │ │ │ ├── squared.js │ │ │ └── zustand-magic.ts │ │ ├── module-esm.ts │ │ ├── read-hello-world.ts │ │ ├── relative-import.ts │ │ ├── rely-on-hoisted.ts │ │ ├── self │ │ │ ├── foo.ts │ │ │ └── index.ts │ │ ├── submodule.ts │ │ ├── timeout.ts │ │ ├── wasm │ │ │ ├── add.wasm │ │ │ ├── wasm-bindgen-no-cyclic │ │ │ │ ├── README.md │ │ │ │ ├── index.d.ts │ │ │ │ ├── index.js │ │ │ │ ├── index_bg.js │ │ │ │ ├── index_bg.wasm │ │ │ │ ├── index_bg.wasm.d.ts │ │ │ │ └── package.json │ │ │ └── wasm-bindgen │ │ │ │ ├── README.md │ │ │ │ ├── index.js │ │ │ │ ├── index_bg.js │ │ │ │ ├── index_bg.wasm │ │ │ │ └── package.json │ │ └── web-worker │ │ │ ├── eventListenerWorker.ts │ │ │ ├── mock │ │ │ ├── worker-dep.ts │ │ │ └── worker.ts │ │ │ ├── objectWorker.ts │ │ │ ├── selfWorker.ts │ │ │ ├── selfWorkerDep.ts │ │ │ ├── sharedWorker.ts │ │ │ ├── worker-globals.ts │ │ │ └── worker.ts │ ├── test │ │ ├── __snapshots__ │ │ │ ├── injector-mock.test.ts.snap │ │ │ ├── jest-expect.test.ts.snap │ │ │ ├── mocked.test.ts.snap │ │ │ ├── nested-suite.test.ts.snap │ │ │ ├── serialize.test.ts.snap │ │ │ ├── snapshot-concurrent-sync.test.ts.snap │ │ │ ├── snapshot-concurrent.test.ts.snap │ │ │ ├── snapshot.test.ts.snap │ │ │ ├── suite.test.tsx.snap │ │ │ ├── test-for-suite.test.ts.snap │ │ │ └── test-for.test.ts.snap │ │ ├── alias.test.ts │ │ ├── basic.test.ts │ │ ├── browserAutomocker.test.ts │ │ ├── builtin.test.ts │ │ ├── chainable.test.ts │ │ ├── child-specific.child_process.test.ts │ │ ├── circular.test.ts │ │ ├── cli-test.test.ts │ │ ├── concurrent-suite.test.ts │ │ ├── concurrent.spec.ts │ │ ├── custom.test.ts │ │ ├── date-mock.test.ts │ │ ├── define-ssr.test.ts │ │ ├── define-web.test.ts │ │ ├── diff.test.ts │ │ ├── do-mock.test.ts │ │ ├── dom-single-line-options.test.ts │ │ ├── dom.test.ts │ │ ├── dual-package-hazard.test.ts │ │ ├── dynamic-import.test.ts │ │ ├── each.test.ts │ │ ├── edge.test.ts │ │ ├── env-glob-dom │ │ │ ├── env-glob.overrides.spec.ts │ │ │ └── env-glob.spec.ts │ │ ├── env-glob.dom.test.ts │ │ ├── env-glob.test.ts │ │ ├── env-jsdom.test.ts │ │ ├── env-runtime.test.ts │ │ ├── env.test.ts │ │ ├── environments │ │ │ ├── custom-env.test.ts │ │ │ ├── happy-dom.spec.ts │ │ │ ├── jsdom.spec.ts │ │ │ └── node.spec.ts │ │ ├── error.test.ts │ │ ├── esnext.test.ts │ │ ├── execution-order.test.ts │ │ ├── expect-circular.test.ts │ │ ├── expect-poll.test.ts │ │ ├── expect.test-d.ts │ │ ├── expect.test.ts │ │ ├── exports.test.ts │ │ ├── external-module-directory.test.ts │ │ ├── file-path.test.ts │ │ ├── fixture-concurrent-beforeEach.test.ts │ │ ├── fixture-concurrent.test.ts │ │ ├── fixture-initialization.test.ts │ │ ├── fixture-options.test.ts │ │ ├── fixtures │ │ │ ├── hello-mock.ts │ │ │ ├── hi.txt │ │ │ ├── increment.ts │ │ │ ├── mocked-dependency.ts │ │ │ ├── named-overwrite-all │ │ │ │ ├── dep1.js │ │ │ │ ├── dep2.js │ │ │ │ └── main.js │ │ │ ├── snapshot-empty.txt │ │ │ ├── snapshots │ │ │ │ ├── basic │ │ │ │ │ ├── input.json │ │ │ │ │ └── output.css │ │ │ │ └── multiple │ │ │ │ │ ├── input.json │ │ │ │ │ └── output.css │ │ │ └── timers.suite.ts │ │ ├── fn.test.ts │ │ ├── fs.test.ts │ │ ├── handled-unhandled.test.ts │ │ ├── happy-dom-custom.test.ts │ │ ├── happy-dom.test.ts │ │ ├── hoist-import.test.ts │ │ ├── hoisted-async-simple.test.ts │ │ ├── hoisted-simple.test.ts │ │ ├── hooks-list.test.ts │ │ ├── hooks-parallel.test.ts │ │ ├── hooks-stack.test.ts │ │ ├── hooks.test.js │ │ ├── hooks.test.ts │ │ ├── immutable.test.ts │ │ ├── imports.test.ts │ │ ├── injector-esm.test.ts │ │ ├── injector-mock.test.ts │ │ ├── inline-snap.test.ts │ │ ├── inlined.test.ts │ │ ├── isolate.test.ts │ │ ├── jest-expect-no-url.test.ts │ │ ├── jest-expect.test.ts │ │ ├── jest-matcher-utils.test.ts │ │ ├── jest-mock.test.ts │ │ ├── local-context.test.ts │ │ ├── lot-of-tests.test.ts │ │ ├── memory-limit.test.ts │ │ ├── mock-fs.test.ts │ │ ├── mock-internals.test.ts │ │ ├── mocked-circular.test.ts │ │ ├── mocked-class-restore-all.test.ts │ │ ├── mocked-class-restore-explicit.test.ts │ │ ├── mocked-class.test.ts │ │ ├── mocked-import-circular.test.ts │ │ ├── mocked-no-mocks-same.test.ts │ │ ├── mocked-no-mocks.test.ts │ │ ├── mocked-public-key.test.ts │ │ ├── mocked.test.js │ │ ├── mocked.test.ts │ │ ├── mocking │ │ │ ├── already-hoisted.test.ts │ │ │ ├── automocking.spec.ts │ │ │ ├── autospying.test.ts │ │ │ ├── axios-mocked.test.ts │ │ │ ├── axios-not-mocked.test.ts │ │ │ ├── circular-mocks.spec.ts │ │ │ ├── custom-module-directory.spec.ts │ │ │ ├── cyclic-import-actual.spec.ts │ │ │ ├── cyclic-import-original.spec.ts │ │ │ ├── destructured.test.ts │ │ │ ├── error-mock.spec.ts │ │ │ ├── external.test.ts │ │ │ ├── factory.test.ts │ │ │ ├── has-extension.spec.ts │ │ │ ├── hoisted.test.ts │ │ │ ├── integration.test.ts │ │ │ ├── nested-default.spec.ts │ │ │ ├── retry-dynamic-import.test.ts │ │ │ ├── self-importing.test.ts │ │ │ ├── spaced.spec.ts │ │ │ ├── tinyspy.test.ts │ │ │ └── virtual.test.ts │ │ ├── modes.test.ts │ │ ├── module.test.ts │ │ ├── moved-snapshot.test.ts │ │ ├── moved-snapshot.test.ts.snap │ │ ├── named-overwrite-all.test.ts │ │ ├── nested-suite.test.ts │ │ ├── nested-test.test.ts │ │ ├── node-protocol-jsdom.spec.ts │ │ ├── node-protocol-node.spec.ts │ │ ├── on-failed.test.ts │ │ ├── on-finished.test.ts │ │ ├── only.test.ts │ │ ├── pattern.test.ts │ │ ├── propagate-options-nested-suite.test.ts │ │ ├── random.test.ts │ │ ├── repeats.test.ts │ │ ├── replace-matcher.test.ts │ │ ├── require.test.ts │ │ ├── resolve-file-url.test.ts │ │ ├── resolve-file-url~dep.js │ │ ├── resolve-ssr.test.ts │ │ ├── resolve-web.test.ts │ │ ├── retry-only.test.ts │ │ ├── retry.test.ts │ │ ├── rpc.spec.ts │ │ ├── run-if.test.ts │ │ ├── self.test.ts │ │ ├── sequencers.test.ts │ │ ├── sequential.test.ts │ │ ├── serialize.test.ts │ │ ├── setup.ts │ │ ├── skip-reset-state.test.ts │ │ ├── skip.test.ts │ │ ├── snapshot-1.txt │ │ ├── snapshot-2.txt │ │ ├── snapshot-async.test.ts │ │ ├── snapshot-concurrent-sync.test.ts │ │ ├── snapshot-concurrent.test.ts │ │ ├── snapshot-custom-serializer.test.ts │ │ ├── snapshot-file.test.ts │ │ ├── snapshot-inline-(parentheses).test.ts │ │ ├── snapshot-inline.test.ts │ │ ├── snapshot-react-18.test.jsx │ │ ├── snapshot-react.test.jsx │ │ ├── snapshot.test.ts │ │ ├── snapshots-outside.ts │ │ ├── sourcemap.test.ts │ │ ├── spy.test.ts │ │ ├── strict.test.js │ │ ├── stubbed-process.test.ts │ │ ├── stubs.test.ts │ │ ├── suite.test.tsx │ │ ├── tab-effect.spec.mjs │ │ ├── task-collector.test.ts │ │ ├── test-extend-with-top-level-hooks.test.ts │ │ ├── test-extend.test.ts │ │ ├── test-for-suite.test.ts │ │ ├── test-for.test.ts │ │ ├── test-name-pattern.test.ts │ │ ├── test-options.test.ts │ │ ├── threads-specific.threads.test.ts │ │ ├── timeout.spec.ts │ │ ├── timers-getMockedSystemTime.test.ts │ │ ├── timers-jsdom.test.ts │ │ ├── timers-node.test.ts │ │ ├── timers-queueMicrotask.test.ts │ │ ├── unhandled.test.ts │ │ ├── unmock-import.test.ts │ │ ├── url-ssr.test.ts │ │ ├── url-web.test.ts │ │ ├── utils-display.spec.ts │ │ ├── utils.spec.ts │ │ ├── vi.spec.ts │ │ ├── vi.test-d.ts │ │ ├── wait.test.ts │ │ ├── wasm.test.ts │ │ ├── web-worker-jsdom.test.ts │ │ ├── web-worker-mock.test.ts │ │ ├── web-worker-node.test.ts │ │ └── write-file-dynamic-import.test.ts │ ├── tsconfig.typecheck.json │ ├── types │ │ ├── env.d.ts │ │ └── vite.d.ts │ ├── vite.config.ts │ └── vitest-environment-custom │ │ ├── index.ts │ │ └── package.json ├── coverage-test │ ├── fixtures │ │ ├── configs │ │ │ ├── vitest.config.conditional.ts │ │ │ ├── vitest.config.configure-vitest-hook.ts │ │ │ ├── vitest.config.decorators.ts │ │ │ ├── vitest.config.multi-transform.ts │ │ │ ├── vitest.config.multi-transforms.ts │ │ │ ├── vitest.config.thresholds-auto-update.ts │ │ │ ├── vitest.config.ts │ │ │ └── vitest.config.virtual-files.ts │ │ ├── custom-provider.ts │ │ ├── custom-reporter.cjs │ │ ├── setup.isolation.ts │ │ ├── setup.ts │ │ ├── src │ │ │ ├── .should-be-excluded-from-coverage │ │ │ │ └── excluded-from-coverage.ts │ │ │ ├── Vue │ │ │ │ ├── Counter │ │ │ │ │ ├── Counter.component.ts │ │ │ │ │ ├── Counter.vue │ │ │ │ │ └── index.ts │ │ │ │ ├── Defined.vue │ │ │ │ ├── Hello.vue │ │ │ │ └── vue.shim.d.ts │ │ │ ├── another-setup.ts │ │ │ ├── branch.ts │ │ │ ├── conditional │ │ │ │ ├── browser.ts │ │ │ │ └── node.ts │ │ │ ├── covered.custom-1 │ │ │ ├── decorators.ts │ │ │ ├── dynamic-files.ts │ │ │ ├── empty-lines.ts │ │ │ ├── even.ts │ │ │ ├── file-to-change.ts │ │ │ ├── ignore-hints.ts │ │ │ ├── implicit-else.ts │ │ │ ├── import-meta-env.ts │ │ │ ├── in-source.ts │ │ │ ├── json-data-import.ts │ │ │ ├── json-data.json │ │ │ ├── load-outside-vite.cjs │ │ │ ├── math.ts │ │ │ ├── multi-environment.ts │ │ │ ├── multi-suite.ts │ │ │ ├── pre-bundle │ │ │ │ ├── bundle.js │ │ │ │ ├── bundle.js.map │ │ │ │ ├── bundle.ts │ │ │ │ ├── first.ts │ │ │ │ └── second.ts │ │ │ ├── pre-transpiled │ │ │ │ ├── original.ts │ │ │ │ ├── transpiled.d.ts │ │ │ │ ├── transpiled.js │ │ │ │ └── transpiled.js.map │ │ │ ├── should-be-excluded-by-default.cts │ │ │ ├── test-that-looks-like-source-file.ts │ │ │ ├── types-only.ts │ │ │ ├── uncovered.custom-1 │ │ │ ├── untested-file.ts │ │ │ ├── virtual-files.ts │ │ │ ├── worker-wrapper.ts │ │ │ └── worker.ts │ │ ├── test │ │ │ ├── allow-external-fixture.test.ts │ │ │ ├── clean-on-rerun-fixture.test.ts │ │ │ ├── custom-1-syntax.test.ts │ │ │ ├── even.test.ts │ │ │ ├── file-to-change.test.ts │ │ │ ├── ignore-hints-fixture.test.ts │ │ │ ├── import-attributes-fixture.test.ts │ │ │ ├── isolation-1-fixture.test.ts │ │ │ ├── isolation-2-fixture.test.ts │ │ │ ├── math.test.ts │ │ │ ├── merge-fixture-1.test.ts │ │ │ ├── merge-fixture-2.test.ts │ │ │ ├── merge-fixture-3.test.ts │ │ │ ├── mocking-in-js-file.test.js │ │ │ ├── multi-environment-fixture-ssr.test.ts │ │ │ ├── multi-environment-fixture-web.test.ts │ │ │ ├── multi-suite-fixture.test.ts │ │ │ ├── pre-transpiled-fixture.test.ts │ │ │ ├── virtual-files-fixture.test.ts │ │ │ ├── vue-fixture.test.ts │ │ │ └── web-worker.test.ts │ │ └── workspaces │ │ │ └── custom-2 │ │ │ ├── src │ │ │ ├── covered.custom-2 │ │ │ └── uncovered.custom-2 │ │ │ └── test │ │ │ └── custom-2-syntax.test.ts │ ├── package.json │ ├── setup.ts │ ├── test │ │ ├── all.test.ts │ │ ├── allow-external.test.ts │ │ ├── bundled-sources.test.ts │ │ ├── changed.test.ts │ │ ├── clean-on-rerun.test.ts │ │ ├── configuration-options.test-d.ts │ │ ├── custom-provider.custom.test.ts │ │ ├── custom-reporter.test.ts │ │ ├── decorators.test.ts │ │ ├── dynamic-files.test.ts │ │ ├── empty-coverage-directory.test.ts │ │ ├── empty-lines.v8.test.ts │ │ ├── exclude-after-remap.test.ts │ │ ├── file-outside-vite.test.ts │ │ ├── ignore-hints.test.ts │ │ ├── implicit-else.istanbul.test.ts │ │ ├── import-attributes.test.ts │ │ ├── import-meta-env.test.ts │ │ ├── in-source.test.ts │ │ ├── include-exclude.test.ts │ │ ├── isolation.test.ts │ │ ├── merge-reports.test.ts │ │ ├── mixed-versions-warning.unit.test.ts │ │ ├── mocking-in-js-file.test.ts │ │ ├── multi-environment.test.ts │ │ ├── multi-suite.test.ts │ │ ├── multi-transform.test.ts │ │ ├── on-failure.test.ts │ │ ├── pre-transpiled-source.test.ts │ │ ├── reporters.test.ts │ │ ├── results-snapshot.test.ts │ │ ├── setup-files.test.ts │ │ ├── shard.test.ts │ │ ├── temporary-files.test.ts │ │ ├── test-reporter-conflicts.test.ts │ │ ├── threshold-100.test.ts │ │ ├── threshold-auto-update.test.ts │ │ ├── threshold-auto-update.unit.test.ts │ │ ├── threshold-failure.test.ts │ │ ├── threshold-glob.test.ts │ │ ├── virtual-files.test.ts │ │ ├── vue.test.ts │ │ ├── web-worker.test.ts │ │ └── workspace.multi-transform.test.ts │ ├── tsconfig.json │ ├── utils.ts │ ├── vitest.config.ts │ └── vitest.workspace.custom.ts ├── dts-config │ ├── happy-dom-patch.ts │ ├── package.json │ ├── tsconfig.json │ ├── tsconfig.patch.json │ └── vite.config.ts ├── dts-fixture │ ├── package.json │ ├── src │ │ └── repro.ts │ ├── tsconfig.check.json │ └── tsconfig.json ├── dts-playwright │ ├── package.json │ ├── src │ │ └── basic.test.ts │ ├── tsconfig.json │ └── vite.config.ts ├── global-setup │ ├── globalSetup │ │ ├── another-vite-instance.ts │ │ ├── default-export.js │ │ ├── named-exports.js │ │ ├── server.ts │ │ └── ts-with-imports.ts │ ├── index.html │ ├── package.json │ ├── setupFiles │ │ ├── add-something-to-global.ts │ │ └── without-relative-path-prefix.ts │ ├── test │ │ ├── global-setup.test.ts │ │ └── setup-files.test.ts │ └── vitest.config.ts ├── optimize-deps │ ├── dep-url │ │ ├── index.js │ │ └── package.json │ ├── package.json │ ├── test │ │ ├── ssr.test.ts │ │ └── web.test.ts │ └── vitest.config.ts ├── public-mocker │ ├── fixtures │ │ ├── automock │ │ │ ├── index.html │ │ │ ├── index.js │ │ │ └── test.js │ │ ├── autospy │ │ │ ├── index.html │ │ │ ├── index.js │ │ │ └── test.js │ │ ├── manual-mock │ │ │ ├── index.html │ │ │ ├── index.js │ │ │ └── test.js │ │ └── redirect │ │ │ ├── __mocks__ │ │ │ └── test.js │ │ │ ├── index.html │ │ │ ├── index.js │ │ │ └── test.js │ ├── package.json │ ├── test │ │ └── mocker.test.ts │ ├── vite.config.ts │ └── vitest.config.ts ├── reporters │ ├── .gitignore │ ├── custom-reporter-path.vitest.config.ts │ ├── custom-reporter.vitest.config.ts │ ├── deps-reporter.vitest.config.ts │ ├── fixtures │ │ ├── .gitignore │ │ ├── all-passing-or-skipped.test.ts │ │ ├── all-skipped.test.ts │ │ ├── better-testsuite-name │ │ │ ├── space-1 │ │ │ │ └── test │ │ │ │ │ └── base.test.ts │ │ │ ├── space-2 │ │ │ │ └── test │ │ │ │ │ └── base.test.ts │ │ │ └── vitest.config.ts │ │ ├── code-frame-line-limit.test.ts │ │ ├── console-interleave.test.ts │ │ ├── console-simple.test.ts │ │ ├── console-some-failing.test.ts │ │ ├── console.test.ts │ │ ├── custom-diff-config.test.ts │ │ ├── custom-diff-config.ts │ │ ├── custom-error │ │ │ ├── basic.test.ts │ │ │ └── vitest.config.ts │ │ ├── default │ │ │ ├── MockReporter.ts │ │ │ ├── a.test.ts │ │ │ ├── b1.test.ts │ │ │ ├── b2.test.ts │ │ │ ├── print-index.test.ts │ │ │ └── vitest.config.ts │ │ ├── duration │ │ │ ├── basic.test.ts │ │ │ └── vitest.config.ts │ │ ├── error-props │ │ │ └── basic.test.ts │ │ ├── error-to-json.test.ts │ │ ├── error.test.ts │ │ ├── function-as-name.bench.ts │ │ ├── function-as-name.test.ts │ │ ├── import-durations-25ms-throws.ts │ │ ├── import-durations-25ms.ts │ │ ├── import-durations-50ms.ts │ │ ├── import-durations-throws.test.ts │ │ ├── import-durations.test.ts │ │ ├── indicator-position.test.js │ │ ├── invalid-diff-config.ts │ │ ├── json-fail-import.test.ts │ │ ├── json-fail.test.ts │ │ ├── long-loading-task.test.ts │ │ ├── many-errors │ │ │ └── basic.test.ts │ │ ├── merge-reports │ │ │ ├── first.test.ts │ │ │ ├── second.test.ts │ │ │ └── vitest.config.js │ │ ├── ok.test.ts │ │ ├── pass-and-skip-test-suites.test.ts │ │ ├── project-name │ │ │ ├── example.test.ts │ │ │ └── vitest.config.ts │ │ ├── repeats.test.ts │ │ ├── retry.test.ts │ │ ├── some-failing.test.ts │ │ ├── suite-hook-failure │ │ │ ├── basic.test.ts │ │ │ └── vitest.config.ts │ │ ├── test-for-title.test.ts │ │ ├── verbose │ │ │ ├── example-1.test.ts │ │ │ └── example-2.test.ts │ │ ├── vitest.config.ts │ │ └── with-syntax-error.test.js │ ├── package.json │ ├── reportPkg │ │ ├── index.js │ │ └── package.json │ ├── reportTest2 │ │ └── custom-reporter-path.vitest.config.ts │ ├── src │ │ ├── context.ts │ │ ├── custom-reporter.js │ │ ├── custom-reporter.ts │ │ └── data.ts │ ├── tests │ │ ├── __snapshots__ │ │ │ ├── html.test.ts.snap │ │ │ ├── json.test.ts.snap │ │ │ ├── junit.test.ts.snap │ │ │ └── reporters.spec.ts.snap │ │ ├── code-frame-line-limit.test.ts │ │ ├── configuration-options.test-d.ts │ │ ├── console.test.ts │ │ ├── custom-diff-config.spec.ts │ │ ├── custom-reporter.spec.ts │ │ ├── default.test.ts │ │ ├── dot.test.ts │ │ ├── error-to-json.test.ts │ │ ├── function-as-name.test.ts │ │ ├── github-actions.test.ts │ │ ├── html.test.ts │ │ ├── import-durations.test.ts │ │ ├── indicator-position.test.ts │ │ ├── json.test.ts │ │ ├── junit.test.ts │ │ ├── logger.test.ts │ │ ├── merge-reports.test.ts │ │ ├── reporters.spec.ts │ │ ├── silent.test.ts │ │ ├── tap.test.ts │ │ ├── test-run.test.ts │ │ ├── utils.test.ts │ │ └── verbose.test.ts │ ├── tsconfig.json │ ├── vitest.config.ts │ └── without-custom-reporter.vitest.config.ts ├── snapshots │ ├── generate.mjs │ ├── package.json │ ├── test-update │ │ ├── __snapshots__ │ │ │ ├── retry-file.test.ts.snap │ │ │ └── same-title-file.test.js.snap │ │ ├── inline-concurrent.test.js │ │ ├── inline.test.js │ │ ├── retry-file.test.ts │ │ ├── retry-inline.test.ts │ │ ├── same-title-file.test.js │ │ └── same-title-inline.test.js │ ├── test │ │ ├── __snapshots__ │ │ │ └── test-update.test.ts.snap │ │ ├── custom-environment.test.ts │ │ ├── custom-serializers.test.ts │ │ ├── file.test.ts │ │ ├── fixtures │ │ │ ├── custom-serializers │ │ │ │ ├── custom-serializers.test.ts │ │ │ │ ├── serializer-1.js │ │ │ │ ├── serializer-2.ts │ │ │ │ └── vitest.config.ts │ │ │ ├── custom-snapshot-environment │ │ │ │ ├── snapshot-environment.ts │ │ │ │ ├── test │ │ │ │ │ └── snapshots.test.ts │ │ │ │ └── vitest.config.ts │ │ │ ├── file │ │ │ │ ├── basic.test.ts │ │ │ │ ├── snapshot-1.txt │ │ │ │ └── snapshot-2.txt │ │ │ ├── indent │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── basic.test.ts.snap │ │ │ │ └── basic.test.ts │ │ │ ├── inline-multiple-calls │ │ │ │ ├── different.test.ts │ │ │ │ ├── different2.test.ts │ │ │ │ ├── same.test.ts │ │ │ │ └── same2.test.ts │ │ │ ├── jest-image-snapshot │ │ │ │ ├── __image_snapshots__ │ │ │ │ │ └── basic-test-ts-to-match-image-snapshot-1-snap.png │ │ │ │ ├── basic.test.ts │ │ │ │ └── test.png │ │ │ ├── skip-test-custom │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── basic.test.ts.snap │ │ │ │ └── basic.test.ts │ │ │ ├── skip-test │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── repro.test.ts.snap │ │ │ │ ├── repro.test.ts │ │ │ │ └── vitest.config.ts │ │ │ ├── summary-removed │ │ │ │ ├── .gitignore │ │ │ │ └── basic.test.ts │ │ │ ├── summary │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── basic.test.ts.snap │ │ │ │ ├── basic.test.ts │ │ │ │ └── vitest.config.ts │ │ │ ├── test-update │ │ │ │ ├── __snapshots__ │ │ │ │ │ ├── retry-file.test.ts.snap │ │ │ │ │ └── same-title-file.test.js.snap │ │ │ │ ├── inline-concurrent.test.js │ │ │ │ ├── inline.test.js │ │ │ │ ├── retry-file.test.ts │ │ │ │ ├── retry-inline.test.ts │ │ │ │ ├── same-title-file.test.js │ │ │ │ └── same-title-inline.test.js │ │ │ └── workspace │ │ │ │ ├── packages │ │ │ │ └── space │ │ │ │ │ ├── test │ │ │ │ │ ├── __snapshots__ │ │ │ │ │ │ └── basic.test.ts.snap │ │ │ │ │ └── basic.test.ts │ │ │ │ │ └── vite.config.ts │ │ │ │ └── vitest.config.ts │ │ ├── indent.test.ts │ │ ├── inline-multiple-calls.test.ts │ │ ├── jest-image-snapshot.test.ts │ │ ├── skip-test.test.ts │ │ ├── snapshots.test.ts │ │ ├── summary.test.ts │ │ └── test-update.test.ts │ ├── tools │ │ └── generate-inline-test.mjs │ └── vitest.config.ts ├── test-utils │ ├── cli.ts │ ├── fixtures │ │ └── external-math.ts │ ├── index.ts │ └── package.json ├── tsconfig.json ├── typescript │ ├── failing │ │ ├── expect-error.test-d.ts │ │ ├── fail.test-d.ts │ │ ├── js-fail.test-d.js │ │ └── only.test-d.ts │ ├── fixtures │ │ ├── dynamic-title │ │ │ ├── test │ │ │ │ └── dynamic-title.test-d.ts │ │ │ ├── tsconfig.json │ │ │ └── vitest.config.ts │ │ └── source-error │ │ │ ├── src │ │ │ └── not-ok.ts │ │ │ ├── test │ │ │ └── ok.test-d.ts │ │ │ ├── tsconfig.json │ │ │ └── vite.config.ts │ ├── package.json │ ├── test-d │ │ ├── expect-extend.test-d.ts │ │ ├── js.test-d.js │ │ ├── nested-suite1.test-d.ts │ │ ├── nested-suite2.test-d.ts │ │ └── test.test-d.ts │ ├── test │ │ ├── __snapshots__ │ │ │ └── runner.test.ts.snap │ │ ├── runner.test.ts │ │ ├── vitest.custom.config.ts │ │ └── vitest.empty.config.ts │ ├── tsconfig.custom.json │ ├── tsconfig.empty.json │ ├── tsconfig.fails.json │ ├── tsconfig.json │ └── vitest.config.fails.ts ├── ui │ ├── .gitignore │ ├── fixtures │ │ ├── annotated.test.ts │ │ ├── console.test.ts │ │ ├── coverage.test.ts │ │ ├── coverage.ts │ │ ├── cute-puppy.jpg │ │ ├── error.test.ts │ │ ├── example.txt │ │ ├── sample.test.ts │ │ └── task-name.test.ts │ ├── package.json │ ├── playwright.config.ts │ ├── test │ │ ├── html-report.spec.ts │ │ └── ui.spec.ts │ ├── tsconfig.json │ └── vitest.config.ts ├── vite-node │ ├── .env.local │ ├── package.json │ ├── src │ │ ├── buildStart │ │ │ ├── test.ts │ │ │ └── vite.config.ts │ │ ├── circular1 │ │ │ ├── a.ts │ │ │ ├── b.ts │ │ │ └── index.ts │ │ ├── circular2 │ │ │ ├── a.ts │ │ │ ├── b.ts │ │ │ ├── c.ts │ │ │ ├── index.ts │ │ │ └── reg.ts │ │ ├── cli-parse-args.js │ │ ├── cli-print-env.js │ │ ├── deps.css │ │ ├── deps.ts │ │ ├── foo.js │ │ ├── hmr-script.js │ │ ├── hmr-throw.js │ │ ├── main.ts │ │ ├── self-export-example1.ts │ │ ├── self-export-example2.ts │ │ ├── self-export.d.ts │ │ ├── self-export.js │ │ ├── testMod.ts │ │ └── watch │ │ │ ├── index.cjs │ │ │ ├── index.js │ │ │ ├── index.mjs │ │ │ └── source-map.ts │ ├── test │ │ ├── circular.test.ts │ │ ├── cli.test.ts │ │ ├── hmr.test.ts │ │ ├── self-export.test.ts │ │ ├── server.test.ts │ │ └── sourcemap.test.ts │ └── vitest.config.ts ├── watch │ ├── .gitignore │ ├── fixtures │ │ ├── 42.txt │ │ ├── example.test.ts │ │ ├── example.ts │ │ ├── force-watch │ │ │ └── trigger.js │ │ ├── global-setup.ts │ │ ├── math.test.ts │ │ ├── math.ts │ │ ├── single-failed │ │ │ ├── basic.test.ts │ │ │ ├── failed.test.ts │ │ │ └── vitest.config.ts │ │ └── vitest.config.ts │ ├── package.json │ ├── test │ │ ├── change-project.test.ts │ │ ├── config-watching.test.ts │ │ ├── file-watching.test.ts │ │ ├── global-setup-rerun.test.ts │ │ ├── related.test.ts │ │ ├── reporter-failed.test.ts │ │ ├── stdin.test.ts │ │ ├── stdout.test.ts │ │ └── workspaces.test.ts │ └── vitest.config.ts ├── workspaces-browser │ ├── .gitignore │ ├── globalTest.ts │ ├── package.json │ ├── space_1 │ │ ├── test │ │ │ ├── math.spec.ts │ │ │ └── node.spec.ts │ │ ├── vite.config.ts │ │ └── vitest.config.ts.timestamp-4345324-324424.mjs │ ├── space_browser │ │ ├── test │ │ │ └── browser.spec.ts │ │ └── vitest.config.ts │ ├── space_browser_inline │ │ ├── test-alias-to.ts │ │ └── test │ │ │ └── basic.test.ts │ ├── src │ │ └── math.ts │ └── vitest.config.ts └── workspaces │ ├── .env.local │ ├── .gitignore │ ├── coverage-report-tests │ ├── check-coverage.test.ts │ └── vitest.config.ts │ ├── cwdPlugin.d.ts │ ├── cwdPlugin.js │ ├── globalTest.ts │ ├── package.json │ ├── space-multi-transform │ ├── src │ │ └── multi-transform.ts │ └── test │ │ ├── project-1.test.ts │ │ └── project-2.test.ts │ ├── space-pools │ ├── forks.test.ts │ ├── isolate.test.ts │ ├── multi-worker.test.ts │ ├── no-isolate.test.ts │ ├── single-worker.test.ts │ └── threads.test.ts │ ├── space_1 │ ├── .env.local │ ├── test │ │ ├── env-injected.spec.ts │ │ ├── happy-dom.spec.ts │ │ └── math.spec.ts │ ├── vite.config.ts │ └── vite.config.ts.timestamp-4345324-324424.mjs │ ├── space_2 │ └── test │ │ └── node.spec.ts │ ├── space_3 │ ├── fake-vitest │ │ ├── config.js │ │ ├── index.js │ │ └── package.json │ ├── global-provide.space-3-test.ts │ ├── localSetup.ts │ ├── math.space-3-test.ts │ ├── package.json │ ├── src │ │ └── multiply.ts │ ├── vite.config.ts │ └── vitest.config.ts │ ├── space_shared │ ├── setup.jsdom.ts │ ├── setup.node.ts │ └── test.spec.ts │ ├── src │ └── math.ts │ ├── vitest.config.ts │ └── vitest.config.watch.ts ├── tsconfig.base.json ├── tsconfig.build.json ├── tsconfig.check.json └── vitest.workspace.vscode.ts /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | 3 | test/reporters/fixtures/indicator-position.test.js eol=crlf 4 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [vitest-dev, sheremet-va, antfu, patak-dev] 2 | open_collective: vitest 3 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | ignore-workspace-root-check=true 2 | strict-peer-dependencies=false 3 | provenance=true 4 | shell-emulator=true 5 | registry=https://registry.npmjs.org/ 6 | VITE_NODE_DEPS_MODULE_DIRECTORIES=/node_modules/,/packages/ 7 | -------------------------------------------------------------------------------- /.tazerc.json: -------------------------------------------------------------------------------- 1 | { 2 | "exclude": [ 3 | "vue", 4 | "pretty-format" 5 | ], 6 | "packageMode": { 7 | "vue": "minor", 8 | "codemirror": "minor", 9 | "rollup": "minor" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /FUNDING.json: -------------------------------------------------------------------------------- 1 | { 2 | "drips": { 3 | "ethereum": { 4 | "ownedBy": "0x929Eb10Cf1621b26199120a521C785F8271e0b78" 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /docs/.vitepress/components/NonProjectOption.vue: -------------------------------------------------------------------------------- 1 | 11 | -------------------------------------------------------------------------------- /docs/.vitepress/components/Version.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | -------------------------------------------------------------------------------- /docs/.vitepress/theme/pwa.ts: -------------------------------------------------------------------------------- 1 | import { registerSW } from 'virtual:pwa-register' 2 | 3 | registerSW({ immediate: true }) 4 | -------------------------------------------------------------------------------- /docs/advanced/api/import-example.md: -------------------------------------------------------------------------------- 1 | ```ts 2 | function import(moduleId: string): Promise 3 | ``` 4 | -------------------------------------------------------------------------------- /docs/blog.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar: false 3 | editLink: false 4 | outline: false 5 | --- 6 | 7 | 10 | 11 | # Latest From the Vitest Blog 12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/guide/examples/promise-done.md: -------------------------------------------------------------------------------- 1 | ```js 2 | it('should work', (done) => { // [!code --] 3 | it('should work', () => new Promise(done => { // [!code ++] 4 | // ... 5 | done() 6 | }) // [!code --] 7 | })) // [!code ++] 8 | ``` 9 | -------------------------------------------------------------------------------- /docs/public/annotations-gha-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/docs/public/annotations-gha-dark.png -------------------------------------------------------------------------------- /docs/public/annotations-gha-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/docs/public/annotations-gha-light.png -------------------------------------------------------------------------------- /docs/public/annotations-html-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/docs/public/annotations-html-dark.png -------------------------------------------------------------------------------- /docs/public/annotations-html-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/docs/public/annotations-html-light.png -------------------------------------------------------------------------------- /docs/public/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/docs/public/apple-touch-icon.png -------------------------------------------------------------------------------- /docs/public/docs-api-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/docs/public/docs-api-dark.png -------------------------------------------------------------------------------- /docs/public/docs-api-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/docs/public/docs-api-light.png -------------------------------------------------------------------------------- /docs/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/docs/public/favicon.ico -------------------------------------------------------------------------------- /docs/public/maskable-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/docs/public/maskable-icon.png -------------------------------------------------------------------------------- /docs/public/module-graph-barrel-file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/docs/public/module-graph-barrel-file.png -------------------------------------------------------------------------------- /docs/public/new-reporter.webm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/docs/public/new-reporter.webm -------------------------------------------------------------------------------- /docs/public/og-original.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/docs/public/og-original.png -------------------------------------------------------------------------------- /docs/public/og-vitest-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/docs/public/og-vitest-3.jpg -------------------------------------------------------------------------------- /docs/public/og.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/docs/public/og.png -------------------------------------------------------------------------------- /docs/public/on-task-update.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/docs/public/on-task-update.gif -------------------------------------------------------------------------------- /docs/public/pwa-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/docs/public/pwa-192x192.png -------------------------------------------------------------------------------- /docs/public/pwa-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/docs/public/pwa-512x512.png -------------------------------------------------------------------------------- /docs/public/pwa-64x64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/docs/public/pwa-64x64.png -------------------------------------------------------------------------------- /docs/public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Allow: / 3 | -------------------------------------------------------------------------------- /docs/public/ui-1-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/docs/public/ui-1-dark.png -------------------------------------------------------------------------------- /docs/public/ui-1-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/docs/public/ui-1-light.png -------------------------------------------------------------------------------- /docs/public/ui-browser-1-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/docs/public/ui-browser-1-dark.png -------------------------------------------------------------------------------- /docs/public/ui-browser-1-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/docs/public/ui-browser-1-light.png -------------------------------------------------------------------------------- /docs/public/ui-coverage-1-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/docs/public/ui-coverage-1-dark.png -------------------------------------------------------------------------------- /docs/public/ui-coverage-1-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/docs/public/ui-coverage-1-light.png -------------------------------------------------------------------------------- /docs/public/vitest-ui-show-coverage-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/docs/public/vitest-ui-show-coverage-dark.png -------------------------------------------------------------------------------- /docs/public/vitest-ui-show-coverage-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/docs/public/vitest-ui-show-coverage-light.png -------------------------------------------------------------------------------- /examples/basic/README.md: -------------------------------------------------------------------------------- 1 | # Vitest Demo 2 | 3 | Run `npm test` and change a test or source code to see HMR in action! 4 | 5 | Learn more at https://vitest.dev 6 | -------------------------------------------------------------------------------- /examples/basic/src/basic.ts: -------------------------------------------------------------------------------- 1 | export const squared = (n: number) => n * n 2 | -------------------------------------------------------------------------------- /examples/basic/test/__snapshots__/suite.test.ts.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html 2 | 3 | exports[`suite name > snapshot 1`] = ` 4 | { 5 | "foo": "bar", 6 | } 7 | `; 8 | -------------------------------------------------------------------------------- /examples/fastify/src/index.ts: -------------------------------------------------------------------------------- 1 | import app from './app' 2 | 3 | async function start() { 4 | try { 5 | await app.listen({ port: 3000 }) 6 | } 7 | catch (err) { 8 | app.log.error(err) 9 | process.exit(1) 10 | } 11 | } 12 | 13 | start() 14 | -------------------------------------------------------------------------------- /examples/in-source-test/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({ 4 | test: { 5 | includeSource: ['src/**/*.{js,ts}'], 6 | }, 7 | }) 8 | -------------------------------------------------------------------------------- /examples/profiling/global-setup.ts: -------------------------------------------------------------------------------- 1 | import { rmSync } from 'node:fs' 2 | 3 | export function setup() { 4 | rmSync('./threads-profile', { force: true, recursive: true }) 5 | rmSync('./forks-profile', { force: true, recursive: true }) 6 | } 7 | -------------------------------------------------------------------------------- /examples/projects/packages/client/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({ 4 | test: { 5 | environment: 'jsdom', 6 | setupFiles: './vitest.setup.ts', 7 | }, 8 | }) 9 | -------------------------------------------------------------------------------- /examples/projects/packages/client/vitest.setup.ts: -------------------------------------------------------------------------------- 1 | import '@testing-library/jest-dom/vitest' 2 | -------------------------------------------------------------------------------- /examples/projects/packages/server/src/index.ts: -------------------------------------------------------------------------------- 1 | import app from './app.js' 2 | 3 | async function start() { 4 | try { 5 | await app.listen({ port: 3000 }) 6 | } 7 | catch (err) { 8 | app.log.error(err) 9 | process.exit(1) 10 | } 11 | } 12 | 13 | start() 14 | -------------------------------------------------------------------------------- /examples/projects/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({ 4 | test: { 5 | projects: ['packages/*'], 6 | }, 7 | }) 8 | -------------------------------------------------------------------------------- /examples/typecheck/test/normal.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('normal', () => { 4 | expect(1 + 1).toBe(2) 5 | }) 6 | -------------------------------------------------------------------------------- /examples/typecheck/test/type.test-d.ts: -------------------------------------------------------------------------------- 1 | import { expect, expectTypeOf, test } from 'vitest' 2 | 3 | test('type', () => { 4 | expectTypeOf(1).toEqualTypeOf(2) 5 | expect(1).toBe(2) // not executed 6 | }) 7 | -------------------------------------------------------------------------------- /packages/browser/dummy.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/packages/browser/dummy.js -------------------------------------------------------------------------------- /packages/browser/src/client/ui.ts: -------------------------------------------------------------------------------- 1 | import type { BrowserUI } from 'vitest' 2 | 3 | export function getUiAPI(): BrowserUI | undefined { 4 | // @ts-expect-error not typed global 5 | return window.__vitest_ui_api__ 6 | } 7 | -------------------------------------------------------------------------------- /packages/browser/src/node/constants.ts: -------------------------------------------------------------------------------- 1 | import { fileURLToPath } from 'node:url' 2 | import { resolve } from 'pathe' 3 | 4 | const pkgRoot = resolve(fileURLToPath(import.meta.url), '../..') 5 | export const distRoot: string = resolve(pkgRoot, 'dist') 6 | -------------------------------------------------------------------------------- /packages/browser/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "types": ["node", "vite/client"], 5 | "isolatedDeclarations": true 6 | }, 7 | "exclude": ["dist", "node_modules", "**/vite.config.ts"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/browser/types.ts: -------------------------------------------------------------------------------- 1 | export interface WSMessage { 2 | /** 3 | * Message type 4 | */ 5 | type: string 6 | 7 | /** 8 | * Message Data 9 | */ 10 | data: any 11 | } 12 | 13 | export type RunState = 'idle' | 'running' 14 | -------------------------------------------------------------------------------- /packages/coverage-istanbul/src/constants.ts: -------------------------------------------------------------------------------- 1 | export const COVERAGE_STORE_KEY: string = '__VITEST_COVERAGE__' 2 | -------------------------------------------------------------------------------- /packages/coverage-istanbul/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "moduleResolution": "Bundler", 5 | "isolatedDeclarations": true 6 | }, 7 | "include": ["./src/**/*.ts"], 8 | "exclude": ["./dist"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/expect/index.d.ts: -------------------------------------------------------------------------------- 1 | import './dist/chai.cjs' 2 | 3 | export * from './dist/index.js' 4 | -------------------------------------------------------------------------------- /packages/expect/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "isolatedDeclarations": true 5 | }, 6 | "include": ["./src/**/*.ts"], 7 | "exclude": ["./dist"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/mocker/README.md: -------------------------------------------------------------------------------- 1 | # @vitest/mocker 2 | 3 | Vitest's module mocker implementation. 4 | 5 | [GitHub](https://github.com/vitest-dev/vitest/blob/main/packages/mocker/) | [Documentation](https://github.com/vitest-dev/vitest/blob/main/packages/mocker/EXPORTS.md) 6 | -------------------------------------------------------------------------------- /packages/mocker/src/browser/auto-register.ts: -------------------------------------------------------------------------------- 1 | import { ModuleMockerServerInterceptor } from './interceptor-native' 2 | import { registerModuleMocker } from './register' 3 | 4 | registerModuleMocker( 5 | () => new ModuleMockerServerInterceptor(), 6 | ) 7 | -------------------------------------------------------------------------------- /packages/mocker/src/browser/interceptor.ts: -------------------------------------------------------------------------------- 1 | import type { MockedModule } from '../registry' 2 | 3 | export interface ModuleMockerInterceptor { 4 | register: (module: MockedModule) => Promise 5 | delete: (url: string) => Promise 6 | invalidate: () => Promise 7 | } 8 | -------------------------------------------------------------------------------- /packages/runner/README.md: -------------------------------------------------------------------------------- 1 | # @vitest/runner 2 | 3 | Vitest mechanism to collect and run tasks. 4 | 5 | [GitHub](https://github.com/vitest-dev/vitest) | [Documentation](https://vitest.dev/advanced/runner) 6 | -------------------------------------------------------------------------------- /packages/runner/types.d.ts: -------------------------------------------------------------------------------- 1 | export * from './dist/types.js' 2 | -------------------------------------------------------------------------------- /packages/runner/utils.d.ts: -------------------------------------------------------------------------------- 1 | export * from './dist/utils.js' 2 | -------------------------------------------------------------------------------- /packages/snapshot/environment.d.ts: -------------------------------------------------------------------------------- 1 | export * from './dist/environment.js' 2 | -------------------------------------------------------------------------------- /packages/snapshot/manager.d.ts: -------------------------------------------------------------------------------- 1 | export * from './dist/manager.js' 2 | -------------------------------------------------------------------------------- /packages/snapshot/src/environment.ts: -------------------------------------------------------------------------------- 1 | export { NodeSnapshotEnvironment } from './env/node' 2 | export type { SnapshotEnvironment } from './types/environment' 3 | -------------------------------------------------------------------------------- /packages/snapshot/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "moduleResolution": "Bundler", 5 | "isolatedDeclarations": true 6 | }, 7 | "include": ["./src/**/*.ts"], 8 | "exclude": ["./dist"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/spy/README.md: -------------------------------------------------------------------------------- 1 | # @vitest/spy 2 | 3 | Lightweight Jest compatible spy implementation. 4 | -------------------------------------------------------------------------------- /packages/spy/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "moduleResolution": "Bundler", 5 | "isolatedDeclarations": true 6 | }, 7 | "include": ["./src/**/*.ts"], 8 | "exclude": ["./dist"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/ui/browser.dev.js: -------------------------------------------------------------------------------- 1 | window.__vitest_browser_runner__ = { 2 | files: [], 3 | config: { 4 | browser: { 5 | name: 'chrome', 6 | }, 7 | }, 8 | type: 'orchestrator', 9 | provider: 'playwright', 10 | wrapModule: () => {}, 11 | } 12 | -------------------------------------------------------------------------------- /packages/ui/client/App.vue: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /packages/ui/client/composables/browser.ts: -------------------------------------------------------------------------------- 1 | export type ViewportSize = 2 | | 'small-mobile' 3 | | 'large-mobile' 4 | | 'tablet' 5 | export const viewport = ref<[number, number]>([414, 896]) 6 | -------------------------------------------------------------------------------- /packages/ui/client/composables/dark.ts: -------------------------------------------------------------------------------- 1 | export const isDark = useDark() 2 | export const toggleDark = useToggle(isDark) 3 | -------------------------------------------------------------------------------- /packages/ui/client/composables/explorer/index.ts: -------------------------------------------------------------------------------- 1 | import { ExplorerTree } from './tree' 2 | 3 | export const explorerTree = new ExplorerTree() 4 | -------------------------------------------------------------------------------- /packages/ui/client/composables/index.ts: -------------------------------------------------------------------------------- 1 | export * from './dark' 2 | -------------------------------------------------------------------------------- /packages/ui/client/utils/escape.ts: -------------------------------------------------------------------------------- 1 | export function escapeHtml(unsafe: string) { 2 | return unsafe 3 | .replace(/&/g, '&') 4 | .replace(//g, '>') 6 | .replace(/"/g, '"') 7 | .replace(/'/g, ''') 8 | } 9 | -------------------------------------------------------------------------------- /packages/ui/node/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "isolatedDeclarations": true 5 | }, 6 | "include": ["./*.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/ui/public/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/packages/ui/public/bg.png -------------------------------------------------------------------------------- /packages/ui/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/packages/ui/public/favicon.ico -------------------------------------------------------------------------------- /packages/ui/reporter.d.ts: -------------------------------------------------------------------------------- 1 | import type { Reporter } from 'vitest' 2 | 3 | declare const reporter: Reporter 4 | export default reporter 5 | -------------------------------------------------------------------------------- /packages/ui/shim.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | -------------------------------------------------------------------------------- /packages/ui/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "jsx": "preserve", 5 | "skipLibCheck": true 6 | }, 7 | "include": ["./client/**/*"], 8 | "exclude": ["dist", "node_modules"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/utils/diff.d.ts: -------------------------------------------------------------------------------- 1 | export * from './dist/diff.js' 2 | -------------------------------------------------------------------------------- /packages/utils/error.d.ts: -------------------------------------------------------------------------------- 1 | export * from './dist/error.js' 2 | -------------------------------------------------------------------------------- /packages/utils/helpers.d.ts: -------------------------------------------------------------------------------- 1 | export * from './dist/helpers.js' 2 | -------------------------------------------------------------------------------- /packages/utils/source-map.ts: -------------------------------------------------------------------------------- 1 | export * from './dist/source-map.js' 2 | -------------------------------------------------------------------------------- /packages/utils/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "moduleResolution": "Bundler", 5 | "isolatedDeclarations": true 6 | }, 7 | "include": ["src/**/*"], 8 | "exclude": ["**/dist/**"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/vite-node/.gitignore: -------------------------------------------------------------------------------- 1 | *.d.ts 2 | -------------------------------------------------------------------------------- /packages/vite-node/src/hmr/index.ts: -------------------------------------------------------------------------------- 1 | export * from './emitter' 2 | export * from './hmr' 3 | -------------------------------------------------------------------------------- /packages/vite-node/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './types' 2 | -------------------------------------------------------------------------------- /packages/vite-node/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "isolatedDeclarations": true 5 | }, 6 | "include": ["./src/**/*.ts"], 7 | "exclude": ["./dist"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/vite-node/vite-node.mjs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | import('./dist/cli.mjs') 3 | -------------------------------------------------------------------------------- /packages/vitest/browser.d.ts: -------------------------------------------------------------------------------- 1 | export * from './dist/browser.js' 2 | -------------------------------------------------------------------------------- /packages/vitest/config.d.ts: -------------------------------------------------------------------------------- 1 | // ensure `@vitest/expect` provides `chai` types 2 | import type {} from '@vitest/expect' 3 | export * from './dist/config.js' 4 | -------------------------------------------------------------------------------- /packages/vitest/coverage.d.ts: -------------------------------------------------------------------------------- 1 | export * from './dist/coverage.js' 2 | -------------------------------------------------------------------------------- /packages/vitest/environments.d.ts: -------------------------------------------------------------------------------- 1 | export * from './dist/environments' 2 | -------------------------------------------------------------------------------- /packages/vitest/execute.d.ts: -------------------------------------------------------------------------------- 1 | export * from './dist/execute.js' 2 | -------------------------------------------------------------------------------- /packages/vitest/importMeta.d.ts: -------------------------------------------------------------------------------- 1 | interface ImportMeta { 2 | url: string 3 | readonly vitest?: typeof import('vitest') 4 | } 5 | -------------------------------------------------------------------------------- /packages/vitest/index.d.cts: -------------------------------------------------------------------------------- 1 | export * from './dist/index.js' 2 | -------------------------------------------------------------------------------- /packages/vitest/jsdom.d.ts: -------------------------------------------------------------------------------- 1 | import type { JSDOM } from 'jsdom' 2 | 3 | declare global { 4 | const jsdom: JSDOM 5 | } 6 | export {} 7 | -------------------------------------------------------------------------------- /packages/vitest/mocker.d.ts: -------------------------------------------------------------------------------- 1 | export * from './dist/mocker.js' 2 | -------------------------------------------------------------------------------- /packages/vitest/node.d.ts: -------------------------------------------------------------------------------- 1 | export * from './dist/node.js' 2 | -------------------------------------------------------------------------------- /packages/vitest/optional-types.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable ts/ban-ts-comment */ 2 | 3 | // @ts-ignore optional peer dep 4 | export type * as jsdomTypes from 'jsdom' 5 | 6 | // @ts-ignore optional peer dep 7 | export type * as happyDomTypes from 'happy-dom' 8 | -------------------------------------------------------------------------------- /packages/vitest/reporters.d.ts: -------------------------------------------------------------------------------- 1 | export * from './dist/reporters.js' 2 | -------------------------------------------------------------------------------- /packages/vitest/runners.d.ts: -------------------------------------------------------------------------------- 1 | export * from './dist/runners.js' 2 | -------------------------------------------------------------------------------- /packages/vitest/snapshot.d.ts: -------------------------------------------------------------------------------- 1 | export * from './dist/snapshot.js' 2 | -------------------------------------------------------------------------------- /packages/vitest/src/integrations/chai/chai-subset.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'chai-subset' { 2 | const chaiSubset: Chai.ChaiPlugin 3 | 4 | export = chaiSubset 5 | } 6 | -------------------------------------------------------------------------------- /packages/vitest/src/integrations/spy.ts: -------------------------------------------------------------------------------- 1 | export * from '@vitest/spy' 2 | -------------------------------------------------------------------------------- /packages/vitest/src/node/cli.ts: -------------------------------------------------------------------------------- 1 | import { createCLI } from './cli/cac' 2 | 3 | createCLI().parse() 4 | -------------------------------------------------------------------------------- /packages/vitest/src/node/reporters/benchmark/verbose.ts: -------------------------------------------------------------------------------- 1 | import { BenchmarkReporter } from './reporter' 2 | 3 | export class VerboseBenchmarkReporter extends BenchmarkReporter { 4 | protected verbose = true 5 | } 6 | -------------------------------------------------------------------------------- /packages/vitest/src/node/reporters/html.ts: -------------------------------------------------------------------------------- 1 | export interface HTMLOptions { 2 | outputFile?: string 3 | } 4 | -------------------------------------------------------------------------------- /packages/vitest/src/node/types/tests.ts: -------------------------------------------------------------------------------- 1 | import type { TestModule } from '../reporters/reported-tasks' 2 | 3 | export interface TestRunResult { 4 | testModules: TestModule[] 5 | unhandledErrors: unknown[] 6 | } 7 | -------------------------------------------------------------------------------- /packages/vitest/src/node/types/worker.ts: -------------------------------------------------------------------------------- 1 | import type { MessagePort } from 'node:worker_threads' 2 | import type { ContextRPC } from '../../types/worker' 3 | 4 | export interface WorkerContext extends ContextRPC { 5 | port: MessagePort 6 | } 7 | -------------------------------------------------------------------------------- /packages/vitest/src/public/coverage.ts: -------------------------------------------------------------------------------- 1 | export { BaseCoverageProvider } from '../node/coverage' 2 | -------------------------------------------------------------------------------- /packages/vitest/src/public/execute.ts: -------------------------------------------------------------------------------- 1 | export { VitestExecutor } from '../runtime/execute' 2 | -------------------------------------------------------------------------------- /packages/vitest/src/public/mocker.ts: -------------------------------------------------------------------------------- 1 | export * from '@vitest/mocker' 2 | -------------------------------------------------------------------------------- /packages/vitest/src/public/runners.ts: -------------------------------------------------------------------------------- 1 | export { NodeBenchmarkRunner } from '../runtime/runners/benchmark' 2 | export { VitestTestRunner } from '../runtime/runners/test' 3 | export type { VitestRunner } from '@vitest/runner' 4 | -------------------------------------------------------------------------------- /packages/vitest/src/public/snapshot.ts: -------------------------------------------------------------------------------- 1 | export { VitestNodeSnapshotEnvironment as VitestSnapshotEnvironment } from '../integrations/snapshot/environments/node' 2 | export type { SnapshotEnvironment } from '@vitest/snapshot/environment' 3 | -------------------------------------------------------------------------------- /packages/vitest/src/runtime/types/utils.ts: -------------------------------------------------------------------------------- 1 | export type SerializedTestSpecification = [ 2 | project: { name: string | undefined; root: string }, 3 | file: string, 4 | options: { pool: string; testLines?: number[] | undefined }, 5 | ] 6 | -------------------------------------------------------------------------------- /packages/vitest/src/shims.dev.d.ts: -------------------------------------------------------------------------------- 1 | declare global { 2 | const __VITEST_GENERATE_UI_TOKEN__: boolean 3 | } 4 | 5 | export {} 6 | -------------------------------------------------------------------------------- /packages/vitest/src/typecheck/assertType.ts: -------------------------------------------------------------------------------- 1 | export interface AssertType { 2 | (value: T): void 3 | } 4 | 5 | export const assertType: AssertType = function assertType() {} 6 | -------------------------------------------------------------------------------- /packages/vitest/src/typecheck/expectTypeOf.ts: -------------------------------------------------------------------------------- 1 | export { expectTypeOf, type ExpectTypeOf } from 'expect-type' 2 | -------------------------------------------------------------------------------- /packages/vitest/src/types/browser.ts: -------------------------------------------------------------------------------- 1 | import type { TestExecutionMethod } from './worker' 2 | 3 | export interface BrowserTesterOptions { 4 | method: TestExecutionMethod 5 | files: string[] 6 | providedContext: string 7 | } 8 | -------------------------------------------------------------------------------- /packages/vitest/src/types/happy-dom-options.ts: -------------------------------------------------------------------------------- 1 | import type { happyDomTypes } from 'vitest/optional-types.js' 2 | 3 | export type HappyDOMOptions = Omit< 4 | NonNullable[0]>, 5 | 'console' 6 | > 7 | -------------------------------------------------------------------------------- /packages/vitest/src/types/ui.ts: -------------------------------------------------------------------------------- 1 | export interface BrowserUI { 2 | setCurrentFileId: (fileId: string) => void 3 | setIframeViewport: (width: number, height: number) => Promise 4 | } 5 | -------------------------------------------------------------------------------- /packages/vitest/src/utils/source-map.ts: -------------------------------------------------------------------------------- 1 | export { 2 | lineSplitRE, 3 | offsetToLineNumber, 4 | positionToOffset, 5 | } from '@vitest/utils' 6 | export { 7 | parseErrorStacktrace, 8 | parseSingleStack, 9 | parseStacktrace, 10 | } from '@vitest/utils/source-map' 11 | -------------------------------------------------------------------------------- /packages/vitest/src/utils/timers.ts: -------------------------------------------------------------------------------- 1 | export { getSafeTimers } from '@vitest/utils' 2 | -------------------------------------------------------------------------------- /packages/vitest/suite.d.ts: -------------------------------------------------------------------------------- 1 | export * from './dist/suite.js' 2 | -------------------------------------------------------------------------------- /packages/vitest/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "isolatedDeclarations": true 5 | }, 6 | "include": ["src/**/*"], 7 | "exclude": ["**/dist/**"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/vitest/utils.d.ts: -------------------------------------------------------------------------------- 1 | export * from './dist/utils.js' 2 | -------------------------------------------------------------------------------- /packages/vitest/vitest.mjs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | import './dist/cli.js' 3 | -------------------------------------------------------------------------------- /packages/vitest/workers.d.ts: -------------------------------------------------------------------------------- 1 | export * from './dist/workers.js' 2 | -------------------------------------------------------------------------------- /packages/web-worker/index.d.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/packages/web-worker/index.d.ts -------------------------------------------------------------------------------- /packages/web-worker/pure.d.ts: -------------------------------------------------------------------------------- 1 | export * from './dist/pure.js' 2 | -------------------------------------------------------------------------------- /packages/web-worker/src/index.ts: -------------------------------------------------------------------------------- 1 | import { defineWebWorkers } from './pure' 2 | 3 | defineWebWorkers() 4 | -------------------------------------------------------------------------------- /packages/web-worker/src/types.ts: -------------------------------------------------------------------------------- 1 | export type Procedure = (...args: any[]) => void 2 | export type CloneOption = 'native' | 'ponyfill' | 'none' 3 | 4 | export interface DefineWorkerOptions { 5 | clone: CloneOption 6 | } 7 | -------------------------------------------------------------------------------- /packages/web-worker/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "lib": ["ESNext", "WebWorker"], 5 | "isolatedDeclarations": true 6 | }, 7 | "exclude": ["./dist"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/ws-client/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "isolatedDeclarations": true 5 | }, 6 | "exclude": ["./dist"] 7 | } 8 | -------------------------------------------------------------------------------- /shims.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | -------------------------------------------------------------------------------- /test/benchmark/fixtures/basic/should-not-run.test-d.ts: -------------------------------------------------------------------------------- 1 | import { describe, expectTypeOf, test } from 'vitest' 2 | 3 | describe('test', () => { 4 | test('some-test', () => { 5 | expectTypeOf({ a: 1 }).toEqualTypeOf({ a: "should not match" }) 6 | }) 7 | }) 8 | -------------------------------------------------------------------------------- /test/benchmark/fixtures/basic/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({}) 4 | -------------------------------------------------------------------------------- /test/benchmark/fixtures/compare/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({}) 4 | -------------------------------------------------------------------------------- /test/benchmark/fixtures/reporter/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({}) 4 | -------------------------------------------------------------------------------- /test/benchmark/fixtures/sequential/setup.ts: -------------------------------------------------------------------------------- 1 | import fs from "node:fs"; 2 | import { testLogFile } from "./helper"; 3 | 4 | export default async function setup() { 5 | await fs.promises.rm(testLogFile, { force: true }); 6 | } 7 | -------------------------------------------------------------------------------- /test/benchmark/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@vitest/test-benchmark", 3 | "type": "module", 4 | "private": true, 5 | "scripts": { 6 | "test": "vitest" 7 | }, 8 | "devDependencies": { 9 | "vitest": "workspace:*" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /test/benchmark/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({}) 4 | -------------------------------------------------------------------------------- /test/browser/bundled-lib/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@vitest/bundled-lib", 3 | "type": "module", 4 | "private": true, 5 | "main": "./src/index.js" 6 | } 7 | -------------------------------------------------------------------------------- /test/browser/bundled-lib/src/a.js: -------------------------------------------------------------------------------- 1 | export function a() { 2 | return 'a' 3 | } 4 | -------------------------------------------------------------------------------- /test/browser/bundled-lib/src/b.js: -------------------------------------------------------------------------------- 1 | export function b() { 2 | throw new Error('error from b') 3 | } 4 | -------------------------------------------------------------------------------- /test/browser/bundled-lib/src/index.d.ts: -------------------------------------------------------------------------------- 1 | export declare function index(): string 2 | -------------------------------------------------------------------------------- /test/browser/bundled-lib/src/index.js: -------------------------------------------------------------------------------- 1 | import { a } from './a.js' 2 | import { b } from './b.js' 3 | 4 | export function index() { 5 | return a() + b() 6 | } 7 | -------------------------------------------------------------------------------- /test/browser/cjs-lib/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | a: 'a', 3 | b: 'b', 4 | object: { 5 | h: 'h', 6 | }, 7 | } 8 | -------------------------------------------------------------------------------- /test/browser/cjs-lib/lib.d.ts: -------------------------------------------------------------------------------- 1 | export function lib(): string 2 | -------------------------------------------------------------------------------- /test/browser/cjs-lib/lib.mjs: -------------------------------------------------------------------------------- 1 | export function lib() { 2 | return 'original' 3 | } 4 | -------------------------------------------------------------------------------- /test/browser/cjs-lib/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@vitest/cjs-lib", 3 | "type": "commonjs", 4 | "exports": { 5 | "./lib": { 6 | "types": "./lib.d.ts", 7 | "default": "./lib.mjs" 8 | }, 9 | ".": "./index.js" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /test/browser/custom-diff-config.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | aAnnotation: 'Expected to be', 3 | bAnnotation: 'But got', 4 | } 5 | -------------------------------------------------------------------------------- /test/browser/custom-snapshot-env.ts: -------------------------------------------------------------------------------- 1 | throw new Error('This file should not be executed') 2 | -------------------------------------------------------------------------------- /test/browser/fixtures/failing/failing.snaphot.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('file snapshot', async () => { 4 | await expect('inaccessible snapshot content') 5 | .toMatchFileSnapshot('/inaccesible/path') 6 | }) 7 | -------------------------------------------------------------------------------- /test/browser/fixtures/failing/src/error.ts: -------------------------------------------------------------------------------- 1 | interface _SomeType { 2 | _unused: string 3 | } 4 | 5 | // this should affect the line number 6 | 7 | export function throwError(_opts?: _SomeType) { 8 | throw new Error('error') 9 | } 10 | -------------------------------------------------------------------------------- /test/browser/fixtures/inspect/math.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from "vitest"; 2 | 3 | test("sum", () => { 4 | expect(1 + 1).toBe(2) 5 | }) 6 | -------------------------------------------------------------------------------- /test/browser/fixtures/mocking-out-of-root/project1/imported-test.js: -------------------------------------------------------------------------------- 1 | import { vi, test, expect } from "vitest" 2 | import lib from "./lib.js"; 3 | 4 | vi.mock("./lib.js", () => ({ default: "mocked" })) 5 | 6 | test("project1 imported", () => { 7 | expect(lib).toBe("mocked"); 8 | }) 9 | -------------------------------------------------------------------------------- /test/browser/fixtures/mocking-out-of-root/project1/lib.js: -------------------------------------------------------------------------------- 1 | export default "lib" 2 | -------------------------------------------------------------------------------- /test/browser/fixtures/mocking-out-of-root/project2/index.js: -------------------------------------------------------------------------------- 1 | export default "project2" 2 | -------------------------------------------------------------------------------- /test/browser/fixtures/mocking-out-of-root/project3/imported-test.js: -------------------------------------------------------------------------------- 1 | import { vi, test, expect } from "vitest" 2 | import lib from "./lib.js"; 3 | 4 | vi.mock("./lib.js", () => ({ default: "mocked" })) 5 | 6 | test("project3 imported", () => { 7 | expect(lib).toBe("mocked"); 8 | }) 9 | -------------------------------------------------------------------------------- /test/browser/fixtures/mocking-out-of-root/project3/lib.js: -------------------------------------------------------------------------------- 1 | export default "lib" 2 | -------------------------------------------------------------------------------- /test/browser/fixtures/mocking-watch/2_not-mocked-import.test.ts: -------------------------------------------------------------------------------- 1 | import { lib } from '@vitest/cjs-lib/lib' 2 | import { test, expect } from 'vitest' 3 | 4 | test('not mocked', () => { 5 | expect(lib()).toBe('original') 6 | }) 7 | -------------------------------------------------------------------------------- /test/browser/fixtures/mocking/mocked-__mocks__.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test, vi } from 'vitest' 2 | import { calculator } from './src/mocks_calculator' 3 | 4 | vi.mock(import('./src/mocks_calculator')) 5 | 6 | test('adds', () => { 7 | expect(calculator('plus', 1, 2)).toBe(42) 8 | }) 9 | -------------------------------------------------------------------------------- /test/browser/fixtures/mocking/not-mocked-nested.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | import { parent } from './src/nested_parent' 3 | 4 | test('adds', () => { 5 | expect(parent()).toBe(true) 6 | }) 7 | -------------------------------------------------------------------------------- /test/browser/fixtures/mocking/not-mocked.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | import { calculator } from './src/calculator' 3 | 4 | test('adds', () => { 5 | expect(calculator('plus', 1, 2)).toBe(3) 6 | }) 7 | -------------------------------------------------------------------------------- /test/browser/fixtures/mocking/src/__mocks__/mocks_calculator.ts: -------------------------------------------------------------------------------- 1 | export function calculator() { 2 | return 42 3 | } 4 | -------------------------------------------------------------------------------- /test/browser/fixtures/mocking/src/actions.ts: -------------------------------------------------------------------------------- 1 | export function plus(a: number, b: number) { 2 | return a + b 3 | } 4 | -------------------------------------------------------------------------------- /test/browser/fixtures/mocking/src/calculator.ts: -------------------------------------------------------------------------------- 1 | import { plus } from './actions' 2 | 3 | export function calculator(operation: 'plus', a: number, b: number) { 4 | if (operation === 'plus') 5 | return plus(a, b) 6 | 7 | throw new Error('unknown operation') 8 | } 9 | -------------------------------------------------------------------------------- /test/browser/fixtures/mocking/src/mocks_calculator.ts: -------------------------------------------------------------------------------- 1 | import { plus } from './actions' 2 | 3 | export function calculator(operation: 'plus', a: number, b: number) { 4 | if (operation === 'plus') 5 | return plus(a, b) 6 | 7 | throw new Error('unknown operation') 8 | } 9 | -------------------------------------------------------------------------------- /test/browser/fixtures/mocking/src/mocks_factory.ts: -------------------------------------------------------------------------------- 1 | export function calculator(_action: string, _a: number, _b: number) { 2 | return _a + _b 3 | } 4 | 5 | export const mocked: boolean = false 6 | -------------------------------------------------------------------------------- /test/browser/fixtures/mocking/src/mocks_factory_many.ts: -------------------------------------------------------------------------------- 1 | import { dep1 } from "./mocks_factory_many_dep1"; 2 | import { dep2 } from "./mocks_factory_many_dep2"; 3 | 4 | export default { dep1, dep2 } 5 | -------------------------------------------------------------------------------- /test/browser/fixtures/mocking/src/mocks_factory_many_dep1.ts: -------------------------------------------------------------------------------- 1 | export const dep1: string = "dep1" 2 | -------------------------------------------------------------------------------- /test/browser/fixtures/mocking/src/mocks_factory_many_dep2.ts: -------------------------------------------------------------------------------- 1 | export const dep2: string = "dep2" 2 | -------------------------------------------------------------------------------- /test/browser/fixtures/mocking/src/nested_child.ts: -------------------------------------------------------------------------------- 1 | export function child() { 2 | return true 3 | } -------------------------------------------------------------------------------- /test/browser/fixtures/mocking/src/nested_parent.ts: -------------------------------------------------------------------------------- 1 | import { child } from './nested_child' 2 | 3 | export function parent() { 4 | return child() 5 | } 6 | -------------------------------------------------------------------------------- /test/browser/fixtures/server-url/basic.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from "vitest"; 2 | 3 | test("basic", () => { 4 | expect(1).toBe(1); 5 | }) 6 | -------------------------------------------------------------------------------- /test/browser/fixtures/setup-file/browser-setup.ts: -------------------------------------------------------------------------------- 1 | import { beforeEach } from 'vitest'; 2 | import * as source from './source'; 3 | 4 | beforeEach<{ source: any }>((t) => { 5 | t.source = source 6 | }) 7 | -------------------------------------------------------------------------------- /test/browser/fixtures/setup-file/module-equality.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | import * as source from './source' 3 | 4 | test<{ source: any }>('modules are the same', (t) => { 5 | expect(source).toBe(t.source) 6 | }) 7 | -------------------------------------------------------------------------------- /test/browser/fixtures/setup-file/source.ts: -------------------------------------------------------------------------------- 1 | export function answer() { 2 | return 42 3 | } 4 | -------------------------------------------------------------------------------- /test/browser/fixtures/update-snapshot/__snapshots__/basic.test.ts.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html 2 | 3 | exports[`basic 1`] = `1`; 4 | -------------------------------------------------------------------------------- /test/browser/fixtures/update-snapshot/__snapshots__/custom/my_snapshot: -------------------------------------------------------------------------------- 1 | my snapshot content -------------------------------------------------------------------------------- /test/browser/fixtures/worker/src/worker-dynamic-dep.ts: -------------------------------------------------------------------------------- 1 | export default "worker-dynamic-dep-ok" 2 | -------------------------------------------------------------------------------- /test/browser/fixtures/worker/src/worker.ts: -------------------------------------------------------------------------------- 1 | self.onmessage = async () => { 2 | const mod = await import("./worker-dynamic-dep"); 3 | self.postMessage(mod.default); 4 | } 5 | -------------------------------------------------------------------------------- /test/browser/injected-lib/index.js: -------------------------------------------------------------------------------- 1 | __injected.push(4) 2 | -------------------------------------------------------------------------------- /test/browser/injected-lib/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@vitest/injected-lib", 3 | "type": "module", 4 | "exports": { 5 | "default": "./index.js" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/browser/injected.ts: -------------------------------------------------------------------------------- 1 | // @ts-expect-error not typed global 2 | ;(__injected as string[]).push(3) 3 | -------------------------------------------------------------------------------- /test/browser/src/__mocks__/_calculator.ts: -------------------------------------------------------------------------------- 1 | export function calculator() { 2 | return 4 3 | } 4 | -------------------------------------------------------------------------------- /test/browser/src/calculator.ts: -------------------------------------------------------------------------------- 1 | import { plus } from './actions' 2 | 3 | export function calculator(operation: 'plus', a: number, b: number) { 4 | if (operation === 'plus') { 5 | return plus(a, b) 6 | } 7 | 8 | throw new Error('unknown operation') 9 | } 10 | -------------------------------------------------------------------------------- /test/browser/src/createNode.ts: -------------------------------------------------------------------------------- 1 | export function createNode() { 2 | const div = document.createElement('div') 3 | div.className = 'node' 4 | div.textContent = 'Hello World!' 5 | return div 6 | } 7 | -------------------------------------------------------------------------------- /test/browser/test/__snapshots__/custom/my_snapshot: -------------------------------------------------------------------------------- 1 | my snapshot content -------------------------------------------------------------------------------- /test/browser/test/__snapshots__/snapshot.test.ts.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html 2 | 3 | exports[`snapshot 1`] = `1`; 4 | -------------------------------------------------------------------------------- /test/browser/test/another.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, it } from 'vitest' 2 | 3 | it('basic 3', async () => { 4 | expect(globalThis.window).toBeDefined() 5 | }) 6 | 7 | it('no process', () => { 8 | expect(globalThis.process).toBeUndefined() 9 | }) 10 | -------------------------------------------------------------------------------- /test/browser/test/injected.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('injected values are correct', () => { 4 | expect((globalThis as any).__injected).toEqual([ 5 | 1, 6 | 2, 7 | 3, 8 | 4, 9 | ]) 10 | }) 11 | -------------------------------------------------------------------------------- /test/browser/test/server-headers.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, it } from 'vitest' 2 | 3 | it('server.headers', async () => { 4 | const res = await fetch('/') 5 | expect(res.ok) 6 | expect(res.headers.get('x-custom')).toBe('hello') 7 | }) 8 | -------------------------------------------------------------------------------- /test/browser/vitest.config-basepath.mts: -------------------------------------------------------------------------------- 1 | import { defineConfig, mergeConfig } from 'vitest/config' 2 | import baseConfig from './vitest.config.mjs' 3 | 4 | export default mergeConfig(baseConfig, defineConfig({ base: '/fix-4686' })) 5 | -------------------------------------------------------------------------------- /test/cli/deps/error/index.js: -------------------------------------------------------------------------------- 1 | import 'node:path' 2 | 3 | export default function testStack() { 4 | innerTestStack() 5 | } 6 | 7 | import 'node:util' 8 | 9 | function innerTestStack() { 10 | throw new Error('__TEST_STACK__') 11 | } 12 | -------------------------------------------------------------------------------- /test/cli/deps/error/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@vitest/test-dep-error", 3 | "type": "module", 4 | "private": true, 5 | "exports": { 6 | ".": "./index.js", 7 | "./*": "./*" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/cli/deps/linked/index.ts: -------------------------------------------------------------------------------- 1 | export default 'ok' satisfies string 2 | -------------------------------------------------------------------------------- /test/cli/deps/linked/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@vitest/test-dep-linked", 3 | "type": "module", 4 | "private": true, 5 | "exports": { 6 | "./ts": "./index.ts" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/cli/fixtures/browser-init/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "test:browser": "vitest --config=vitest.browser.config.ts" 4 | }, 5 | "dependencies": { 6 | "vitest": "latest" 7 | }, 8 | "devDependencies": { 9 | "@vitest/browser": "latest" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /test/cli/fixtures/browser-init/vitest.config.ts: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /test/cli/fixtures/browser-multiple/basic.test.js: -------------------------------------------------------------------------------- 1 | import { test } from 'vitest'; 2 | 3 | test('passes') 4 | -------------------------------------------------------------------------------- /test/cli/fixtures/browser-multiple/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "browser-multiple" 3 | } -------------------------------------------------------------------------------- /test/cli/fixtures/config-loader/browser/basic.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from "vitest" 2 | 3 | test("browser ok", () => {}) 4 | -------------------------------------------------------------------------------- /test/cli/fixtures/config-loader/node/basic.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from "vitest" 2 | 3 | test("node ok", () => {}) 4 | -------------------------------------------------------------------------------- /test/cli/fixtures/config-loader/node/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "vitest/config" 2 | import "@vitest/test-dep-linked/ts"; 3 | 4 | export default defineConfig({}) 5 | -------------------------------------------------------------------------------- /test/cli/fixtures/console/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({ 4 | test: { 5 | printConsoleTrace: true, 6 | } 7 | }) -------------------------------------------------------------------------------- /test/cli/fixtures/create-vitest/basic.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from "vitest"; 2 | 3 | test("basic", () => { 4 | expect(1).toBe(1); 5 | }) 6 | -------------------------------------------------------------------------------- /test/cli/fixtures/create-vitest/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({}) 4 | -------------------------------------------------------------------------------- /test/cli/fixtures/custom-pool/tests/custom-not-run.spec.ts: -------------------------------------------------------------------------------- 1 | throw new Error('this file is not actually running') 2 | -------------------------------------------------------------------------------- /test/cli/fixtures/custom-pool/tests/custom-run.threads.spec.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('correctly runs threads test while there is a custom pool', () => { 4 | expect(1 + 1).toBe(2) 5 | }) 6 | -------------------------------------------------------------------------------- /test/cli/fixtures/custom-runner/utils.ts: -------------------------------------------------------------------------------- 1 | import { Suite } from "@vitest/runner" 2 | 3 | export function getSuiteNames(suite?: Suite) { 4 | const names = [] 5 | while (suite) { 6 | names.push(suite.name) 7 | suite = suite.suite 8 | } 9 | return names 10 | } 11 | -------------------------------------------------------------------------------- /test/cli/fixtures/custom-runner/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({ 4 | test: { 5 | runner: './test-runner.ts', 6 | }, 7 | }) 8 | -------------------------------------------------------------------------------- /test/cli/fixtures/dotted-files/.cache/projects/test/.cache/should-not-run.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('should not run', () => { 4 | expect(1).toBe(2) 5 | }) 6 | -------------------------------------------------------------------------------- /test/cli/fixtures/dotted-files/.cache/projects/test/should-run.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('should run', () => { 4 | expect(1).toBe(1) 5 | }) 6 | -------------------------------------------------------------------------------- /test/cli/fixtures/expect-soft/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | 3 | export default defineConfig({ 4 | test: { 5 | pool: 'forks', 6 | poolOptions: { 7 | forks: { 8 | isolate: false, 9 | }, 10 | }, 11 | }, 12 | }) 13 | -------------------------------------------------------------------------------- /test/cli/fixtures/fails/.dot-folder/dot-test.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('check that tests inside folder with . is run', () => { 4 | expect(true).toBe(false) 5 | }) 6 | -------------------------------------------------------------------------------- /test/cli/fixtures/fails/async-assertion.test.ts: -------------------------------------------------------------------------------- 1 | import { test, expect } from "vitest" 2 | 3 | test('multiple errors', () => { 4 | expect(new Promise((r) => r("xx"))).resolves.toBe("yy"); 5 | expect(new Promise((r) => setTimeout(() => r("xx"), 10))).resolves.toBe("zz"); 6 | }) 7 | -------------------------------------------------------------------------------- /test/cli/fixtures/fails/each-timeout.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from 'vitest' 2 | 3 | test.each([1])('test each timeout', async () => { 4 | await new Promise(resolve => setTimeout(resolve, 20)) 5 | }, 10) 6 | -------------------------------------------------------------------------------- /test/cli/fixtures/fails/empty.test.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/test/cli/fixtures/fails/empty.test.ts -------------------------------------------------------------------------------- /test/cli/fixtures/fails/expect-soft.test.ts: -------------------------------------------------------------------------------- 1 | import { expect } from 'vitest' 2 | 3 | expect.soft(1 + 1).toEqual(3) 4 | -------------------------------------------------------------------------------- /test/cli/fixtures/fails/expect-unreachable.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('', () => { 4 | expect.unreachable('hi') 5 | }) 6 | -------------------------------------------------------------------------------- /test/cli/fixtures/fails/expect.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('hi', () => { 4 | expect(1 + 1).toEqual(3) 5 | }) 6 | -------------------------------------------------------------------------------- /test/cli/fixtures/fails/hooks-fail-afterAll.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, test, afterAll } from 'vitest'; 2 | 3 | describe('afterAll hooks fail', () => { 4 | // @ts-ignore expects a function 5 | afterAll('fail') 6 | test.todo('todo') 7 | }) 8 | -------------------------------------------------------------------------------- /test/cli/fixtures/fails/hooks-fail-afterEach.test.ts: -------------------------------------------------------------------------------- 1 | import { afterEach, describe, test } from 'vitest'; 2 | 3 | describe('afterEach hooks fail', () => { 4 | // @ts-ignore expects a function 5 | afterEach('fail') 6 | test.todo('todo') 7 | }) 8 | -------------------------------------------------------------------------------- /test/cli/fixtures/fails/hooks-fail-beforeAll.test.ts: -------------------------------------------------------------------------------- 1 | import { beforeAll, describe, test } from 'vitest'; 2 | 3 | describe('beforeAll hooks fail', () => { 4 | // @ts-ignore expects a function 5 | beforeAll('fail') 6 | test.todo('todo') 7 | }) 8 | -------------------------------------------------------------------------------- /test/cli/fixtures/fails/hooks-fail-beforeEach.test.ts: -------------------------------------------------------------------------------- 1 | import { beforeEach, describe, test } from 'vitest'; 2 | 3 | describe('beforeEach hooks fail', () => { 4 | // @ts-ignore expects a function 5 | beforeEach('fail') 6 | test.todo('todo') 7 | }) 8 | -------------------------------------------------------------------------------- /test/cli/fixtures/fails/mock-import-proxy-module.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test, vi } from './proxy-module' 2 | 3 | // This can be used only when imported directly from vitest 4 | vi.mock('vite') 5 | 6 | test('hi', () => { 7 | expect(1 + 1).toEqual(2) 8 | }) 9 | -------------------------------------------------------------------------------- /test/cli/fixtures/fails/no-assertions.test.ts: -------------------------------------------------------------------------------- 1 | import { it } from 'vitest' 2 | 3 | it('test without assertions') -------------------------------------------------------------------------------- /test/cli/fixtures/fails/node-browser-context.test.ts: -------------------------------------------------------------------------------- 1 | import { page } from '@vitest/browser/context' 2 | 3 | console.log(page) 4 | -------------------------------------------------------------------------------- /test/cli/fixtures/fails/primitive-error.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from 'vitest' 2 | 3 | test('primitive error thrown', () => { 4 | // eslint-disable-next-line no-throw-literal 5 | throw 42 6 | }) 7 | -------------------------------------------------------------------------------- /test/cli/fixtures/fails/proxy-module.ts: -------------------------------------------------------------------------------- 1 | export * from 'vitest' 2 | -------------------------------------------------------------------------------- /test/cli/fixtures/fails/test-extend/fixture-rest-params.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from 'vitest' 2 | 3 | test.extend({ 4 | // eslint-disable-next-line unused-imports/no-unused-vars 5 | a: async (...rest) => {}, 6 | }) 7 | -------------------------------------------------------------------------------- /test/cli/fixtures/fails/test-extend/fixture-rest-props.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from 'vitest' 2 | 3 | test.extend({ 4 | // eslint-disable-next-line unused-imports/no-unused-vars 5 | a: async ({ ...rest }) => {}, 6 | }) 7 | -------------------------------------------------------------------------------- /test/cli/fixtures/fails/test-extend/fixture-without-destructuring.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from 'vitest' 2 | 3 | test.extend({ 4 | // eslint-disable-next-line unused-imports/no-unused-vars 5 | a: async (context) => {}, 6 | }) 7 | -------------------------------------------------------------------------------- /test/cli/fixtures/fails/test-extend/test-rest-params.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from 'vitest' 2 | 3 | const myTest = test.extend({ a: 1 }) 4 | 5 | // eslint-disable-next-line unused-imports/no-unused-vars 6 | myTest('', (...rest) => { 7 | 8 | }) 9 | -------------------------------------------------------------------------------- /test/cli/fixtures/fails/test-extend/test-rest-props.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from 'vitest' 2 | 3 | const myTest = test.extend({ a: 1 }) 4 | 5 | // eslint-disable-next-line unused-imports/no-unused-vars 6 | myTest('', ({ ...rest }) => { 7 | 8 | }) 9 | -------------------------------------------------------------------------------- /test/cli/fixtures/fails/test-extend/test-without-destructuring.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from 'vitest' 2 | 3 | const myTest = test.extend({ a: 1 }) 4 | 5 | // eslint-disable-next-line unused-imports/no-unused-vars 6 | myTest('', (context) => { 7 | 8 | }) 9 | -------------------------------------------------------------------------------- /test/cli/fixtures/fails/unhandled-suite.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, it } from 'vitest'; 2 | 3 | it('foo', () => { 4 | expect(1).toBe(1) 5 | new Promise((resolve, reject) => { 6 | reject('promise error'); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /test/cli/fixtures/git-changed/related/not-related.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | import { B } from './src/sourceB' 3 | 4 | test('shouldn\'t run', () => { 5 | expect(B).toBe('B') 6 | expect.fail() 7 | }) 8 | -------------------------------------------------------------------------------- /test/cli/fixtures/git-changed/related/src/sourceA.ts: -------------------------------------------------------------------------------- 1 | export const A = 'A' 2 | -------------------------------------------------------------------------------- /test/cli/fixtures/git-changed/related/src/sourceB.ts: -------------------------------------------------------------------------------- 1 | export const B = 'B' 2 | -------------------------------------------------------------------------------- /test/cli/fixtures/git-changed/related/src/sourceC.ts: -------------------------------------------------------------------------------- 1 | // re-exporting for deep changed detection 2 | export { A } from './sourceA' 3 | -------------------------------------------------------------------------------- /test/cli/fixtures/git-changed/related/src/sourceD.ts: -------------------------------------------------------------------------------- 1 | // import and re-exporting for deep changed detection 2 | import { A as sourceA } from './sourceA' 3 | 4 | export const A = sourceA 5 | -------------------------------------------------------------------------------- /test/cli/fixtures/git-changed/related/vitest.config.js: -------------------------------------------------------------------------------- 1 | export default {} -------------------------------------------------------------------------------- /test/cli/fixtures/git-changed/workspace/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "commonjs" 3 | } -------------------------------------------------------------------------------- /test/cli/fixtures/git-changed/workspace/packages/packageA/index.js: -------------------------------------------------------------------------------- 1 | export default function getLetter() { 2 | return 'c'; 3 | } 4 | -------------------------------------------------------------------------------- /test/cli/fixtures/git-changed/workspace/packages/packageA/vitest.config.mjs: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "vitest/config"; 2 | 3 | export default defineConfig({}); 4 | -------------------------------------------------------------------------------- /test/cli/fixtures/git-changed/workspace/packages/packageB/index.js: -------------------------------------------------------------------------------- 1 | export default function getNumber() { 2 | return 3; 3 | } 4 | -------------------------------------------------------------------------------- /test/cli/fixtures/git-changed/workspace/packages/packageB/vitest.config.mjs: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "vitest/config"; 2 | 3 | export default defineConfig({}); 4 | -------------------------------------------------------------------------------- /test/cli/fixtures/git-changed/workspace/vitest.config.mjs: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({ 4 | test: { 5 | projects: [ 6 | "packages/*/vitest.config.mjs", 7 | ] 8 | }, 9 | }) 10 | -------------------------------------------------------------------------------- /test/cli/fixtures/global-setup-fail/example.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('example test', () => { 4 | expect(1 + 1).toBe(2) 5 | }) 6 | -------------------------------------------------------------------------------- /test/cli/fixtures/global-setup-fail/globalSetup/error.js: -------------------------------------------------------------------------------- 1 | export default function () { 2 | throw new Error('error') 3 | } 4 | -------------------------------------------------------------------------------- /test/cli/fixtures/inspect/math.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from "vitest"; 2 | 3 | test("sum", () => { 4 | expect(1 + 1).toBe(2) 5 | }) -------------------------------------------------------------------------------- /test/cli/fixtures/inspect/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({ 4 | test: { 5 | include: ['./**.test.ts'], 6 | watch: false, 7 | }, 8 | }) 9 | -------------------------------------------------------------------------------- /test/cli/fixtures/list/custom.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({ 4 | test: { 5 | include: ['basic.test.ts', 'math.test.ts'], 6 | name: 'custom', 7 | includeTaskLocation: true, 8 | }, 9 | }) 10 | -------------------------------------------------------------------------------- /test/cli/fixtures/list/describe-error.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, expect, it } from 'vitest'; 2 | 3 | describe('describe error', () => { 4 | throw new Error('describe error') 5 | 6 | it('wont run', () => { 7 | expect(true).toBe(true) 8 | }) 9 | }) -------------------------------------------------------------------------------- /test/cli/fixtures/list/fail.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({ 4 | test: { 5 | include: ['top-level-error.test.ts', 'describe-error.test.ts'], 6 | }, 7 | }) 8 | -------------------------------------------------------------------------------- /test/cli/fixtures/list/math.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, it } from 'vitest' 2 | 3 | console.log('logging during collection') 4 | 5 | it('1 plus 1', () => { 6 | expect(1 + 1).toBe(2) 7 | }) 8 | 9 | it('failing test', () => { 10 | expect(1 + 1).toBe(3) 11 | }) 12 | -------------------------------------------------------------------------------- /test/cli/fixtures/list/top-level-error.test.ts: -------------------------------------------------------------------------------- 1 | throw new Error('top level error') 2 | -------------------------------------------------------------------------------- /test/cli/fixtures/list/type.test-d.ts: -------------------------------------------------------------------------------- 1 | import { expectTypeOf, it } from 'vitest' 2 | 3 | it('1 plus 1', () => { 4 | expectTypeOf(1 + 1).toBeNumber() 5 | }) 6 | -------------------------------------------------------------------------------- /test/cli/fixtures/location-filters/math-with-dashes-in-name.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, it } from 'vitest' 2 | 3 | it('1 plus 1', () => { 4 | expect(1 + 1).toBe(2) 5 | }) 6 | 7 | it('2 plus 2', () => { 8 | expect(2 + 2).toBe(4) 9 | }) 10 | -------------------------------------------------------------------------------- /test/cli/fixtures/location-filters/math.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, it } from 'vitest' 2 | 3 | it('1 plus 1', () => { 4 | expect(1 + 1).toBe(2) 5 | }) 6 | 7 | it('2 plus 2', () => { 8 | expect(2 + 2).toBe(4) 9 | }) 10 | -------------------------------------------------------------------------------- /test/cli/fixtures/location-filters/no-task-location.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({ 4 | test: { 5 | includeTaskLocation: false, 6 | }, 7 | }) 8 | 9 | -------------------------------------------------------------------------------- /test/cli/fixtures/location-filters/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({ 4 | test: { 5 | includeTaskLocation: true, 6 | }, 7 | }) 8 | -------------------------------------------------------------------------------- /test/cli/fixtures/plugin/basic.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from "vitest"; 2 | 3 | test("basic", () => { 4 | expect(1).toBe(1); 5 | }) 6 | -------------------------------------------------------------------------------- /test/cli/fixtures/restricted-fs/src/math.js: -------------------------------------------------------------------------------- 1 | export function multiply(a, b) { 2 | return a * b 3 | } 4 | -------------------------------------------------------------------------------- /test/cli/fixtures/restricted-fs/tests/basic.spec.js: -------------------------------------------------------------------------------- 1 | import { expect, it } from 'vitest' 2 | import { multiply } from '../src/math' 3 | 4 | it('2 x 2 = 4', () => { 5 | expect(multiply(2, 2)).toBe(4) 6 | expect(multiply(2, 2)).toBe(Math.sqrt(16)) 7 | }) 8 | -------------------------------------------------------------------------------- /test/cli/fixtures/restricted-fs/vitest.setup.js: -------------------------------------------------------------------------------- 1 | globalThis.SOME_TEST_VARIABLE = '3' 2 | -------------------------------------------------------------------------------- /test/cli/fixtures/setup-files/console-setup.ts: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line no-console 2 | console.log('setup') 3 | 4 | console.error('setup') 5 | -------------------------------------------------------------------------------- /test/cli/fixtures/setup-files/empty-setup.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/test/cli/fixtures/setup-files/empty-setup.ts -------------------------------------------------------------------------------- /test/cli/fixtures/setup-files/empty.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from 'vitest' 2 | 3 | test('empty', () => {}) 4 | -------------------------------------------------------------------------------- /test/cli/fixtures/skip-note/basic.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from 'vitest'; 2 | 3 | test('my skipped test', ctx => { 4 | ctx.skip('custom message') 5 | }) 6 | -------------------------------------------------------------------------------- /test/cli/fixtures/stacktraces/add-in-imba.test.imba: -------------------------------------------------------------------------------- 1 | import {it, expect} from 'vitest' 2 | 3 | export def add(...args) 4 | return args.reduce((do(a, b) a + b), 0) 5 | 6 | it "add", do 7 | expect(add()).toBe 0 8 | expect(add(1)).toBe 3 9 | expect(add(1, 2, 3)).toBe 6 10 | -------------------------------------------------------------------------------- /test/cli/fixtures/stacktraces/add-in-js.test.js: -------------------------------------------------------------------------------- 1 | /* body */ 2 | import { expect, it } from 'vitest' 3 | import { add } from './utils' 4 | 5 | it('add', () => { 6 | expect(add()).toBe(100) 7 | expect(add(1)).toBe(1) 8 | return expect(add(1, 2, 3)).toBe(6) 9 | }) 10 | -------------------------------------------------------------------------------- /test/cli/fixtures/stacktraces/error-in-deps.test.js: -------------------------------------------------------------------------------- 1 | import { test } from 'vitest' 2 | import { add } from './foo' 3 | 4 | test('error in deps', () => { 5 | add() 6 | }) 7 | -------------------------------------------------------------------------------- /test/cli/fixtures/stacktraces/foo.js: -------------------------------------------------------------------------------- 1 | export function add() { 2 | // eslint-disable-next-line no-undef 3 | return bar() 4 | } 5 | -------------------------------------------------------------------------------- /test/cli/fixtures/stacktraces/frame.spec.imba: -------------------------------------------------------------------------------- 1 | describe "Test" do 2 | test("1+1") do 3 | expect(1+1).toBe 2 4 | ciyet. -------------------------------------------------------------------------------- /test/cli/fixtures/stacktraces/mocked-global.test.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-undef */ 2 | 3 | vi.mock('./path') 4 | 5 | test('failed', () => { 6 | expect(1).toBe(2) 7 | }) 8 | -------------------------------------------------------------------------------- /test/cli/fixtures/stacktraces/mocked-imported.test.js: -------------------------------------------------------------------------------- 1 | import { expect, test, vi } from 'vitest' 2 | 3 | vi.mock('./path') 4 | 5 | test('failed', () => { 6 | expect(1).toBe(2) 7 | }) 8 | -------------------------------------------------------------------------------- /test/cli/fixtures/stacktraces/mocked-imported.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test, vi } from 'vitest' 2 | 3 | vi.mock('./path') 4 | 5 | test('failed', () => { 6 | expect(1).toBe(2) 7 | }) 8 | -------------------------------------------------------------------------------- /test/cli/fixtures/stacktraces/require-assertions.test.js: -------------------------------------------------------------------------------- 1 | import { test } from 'vitest' 2 | 3 | test('assertion is not called', () => { 4 | // no expect 5 | }) 6 | -------------------------------------------------------------------------------- /test/cli/fixtures/stacktraces/setup.js: -------------------------------------------------------------------------------- 1 | import { expect, test, vi } from 'vitest' 2 | 3 | globalThis.vi = vi 4 | globalThis.test = test 5 | globalThis.expect = expect 6 | -------------------------------------------------------------------------------- /test/cli/fixtures/stacktraces/utils.ts: -------------------------------------------------------------------------------- 1 | export function add(...args: number[]) { 2 | return args.reduce((a, b) => a + b, 0) 3 | } 4 | -------------------------------------------------------------------------------- /test/cli/fixtures/tty/example.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | import { getHelloWorld } from './example' 4 | 5 | test('getHello', async () => { 6 | expect(getHelloWorld()).toBe('Hello world') 7 | }) 8 | -------------------------------------------------------------------------------- /test/cli/fixtures/tty/example.ts: -------------------------------------------------------------------------------- 1 | export function getHelloWorld() { 2 | return 'Hello world' 3 | } 4 | -------------------------------------------------------------------------------- /test/cli/fixtures/tty/math.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | import { sum } from './math' 4 | 5 | test('sum', () => { 6 | expect(sum(1, 2)).toBe(3) 7 | }) 8 | -------------------------------------------------------------------------------- /test/cli/fixtures/tty/math.ts: -------------------------------------------------------------------------------- 1 | export function sum(a: number, b: number) { 2 | return a + b 3 | } 4 | -------------------------------------------------------------------------------- /test/cli/fixtures/vitest.config.js: -------------------------------------------------------------------------------- 1 | // an empty config so the main one is not accidentally inherited by the tests 2 | export default {} 3 | -------------------------------------------------------------------------------- /test/cli/fixtures/vm-threads/src/external/assets/file1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/test/cli/fixtures/vm-threads/src/external/assets/file1.png -------------------------------------------------------------------------------- /test/cli/fixtures/vm-threads/src/external/assets/file2.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/test/cli/fixtures/vm-threads/src/external/assets/file2.txt -------------------------------------------------------------------------------- /test/cli/fixtures/vm-threads/src/external/assets/file3.svg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/test/cli/fixtures/vm-threads/src/external/assets/file3.svg -------------------------------------------------------------------------------- /test/cli/fixtures/vm-threads/src/external/css/empty.css: -------------------------------------------------------------------------------- 1 | .test1 { 2 | color: red; 3 | } 4 | -------------------------------------------------------------------------------- /test/cli/fixtures/vm-threads/src/external/css/processed.css: -------------------------------------------------------------------------------- 1 | .test2 { 2 | color: green; 3 | } 4 | -------------------------------------------------------------------------------- /test/cli/fixtures/vm-threads/src/external/css/processed.module.css: -------------------------------------------------------------------------------- 1 | .test3 { 2 | color: yellow; 3 | } 4 | -------------------------------------------------------------------------------- /test/cli/fixtures/vm-threads/src/external/default-cjs.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | a: 'a', 3 | b: 'b', 4 | object: { 5 | h: 'h', 6 | }, 7 | } 8 | -------------------------------------------------------------------------------- /test/cli/fixtures/vm-threads/src/external/export-default-cjs.js: -------------------------------------------------------------------------------- 1 | export * from './default-cjs.cjs' 2 | export { default } from './default-cjs.cjs' 3 | -------------------------------------------------------------------------------- /test/cli/fixtures/vm-threads/src/external/export-nested-default-cjs.js: -------------------------------------------------------------------------------- 1 | export * from './nested-default-cjs.cjs' 2 | export { default } from './nested-default-cjs.cjs' 3 | -------------------------------------------------------------------------------- /test/cli/fixtures/vm-threads/src/external/nested-default-cjs.cjs: -------------------------------------------------------------------------------- 1 | exports.default = { 2 | a: 'a', 3 | b: 'b', 4 | object: { 5 | h: 'h', 6 | }, 7 | } 8 | Object.defineProperty(exports, '__esModule', { value: true, enumerable: false }) 9 | -------------------------------------------------------------------------------- /test/cli/fixtures/vm-threads/src/external/package-null/package-null.js: -------------------------------------------------------------------------------- 1 | module.exports = 42 2 | -------------------------------------------------------------------------------- /test/cli/fixtures/vm-threads/src/external/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test/cli/fixtures/vm-threads/src/external/primitive-cjs.cjs: -------------------------------------------------------------------------------- 1 | module.exports = 'string' 2 | -------------------------------------------------------------------------------- /test/cli/fixtures/windows-drive-case/basic.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('basic test', () => { 4 | expect(1).toBe(1) 5 | }) 6 | -------------------------------------------------------------------------------- /test/cli/fixtures/ws-server-url/basic.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from "vitest"; 2 | 3 | test("basic", () => { 4 | expect(1).toBe(1); 5 | }) 6 | -------------------------------------------------------------------------------- /test/config/deps/test-dep-conditions-indirect/false.js: -------------------------------------------------------------------------------- 1 | export default false 2 | -------------------------------------------------------------------------------- /test/config/deps/test-dep-conditions-indirect/true.js: -------------------------------------------------------------------------------- 1 | export default true 2 | -------------------------------------------------------------------------------- /test/config/deps/test-dep-conditions/false.js: -------------------------------------------------------------------------------- 1 | export default false 2 | -------------------------------------------------------------------------------- /test/config/deps/test-dep-conditions/inline.js: -------------------------------------------------------------------------------- 1 | export default !!import.meta.__IS_INLINE__ 2 | -------------------------------------------------------------------------------- /test/config/deps/test-dep-conditions/true.js: -------------------------------------------------------------------------------- 1 | export default true 2 | -------------------------------------------------------------------------------- /test/config/fixtures/allowed-exec-args-fixtures/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({}) 4 | -------------------------------------------------------------------------------- /test/config/fixtures/base-path/src/index.ts: -------------------------------------------------------------------------------- 1 | export const foo = 'foo' 2 | -------------------------------------------------------------------------------- /test/config/fixtures/browser-no-config/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config'; 2 | 3 | export default defineConfig({ 4 | test: { 5 | browser: { 6 | headless: true, 7 | }, 8 | }, 9 | }) -------------------------------------------------------------------------------- /test/config/fixtures/cache/basic.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from "vitest"; 2 | 3 | test('', () => { 4 | expect(true).toBe(true) 5 | }) 6 | -------------------------------------------------------------------------------- /test/config/fixtures/cache/second.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from "vitest"; 2 | 3 | test('', () => { 4 | expect(true).toBe(true) 5 | }) 6 | -------------------------------------------------------------------------------- /test/config/fixtures/chai-config/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({}) 4 | -------------------------------------------------------------------------------- /test/config/fixtures/conditions-pkg/index.js: -------------------------------------------------------------------------------- 1 | export { default as condition } from 'subpackage' 2 | -------------------------------------------------------------------------------- /test/config/fixtures/conditions-pkg/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "conditions", 3 | "private": true, 4 | "type": "module", 5 | "main": "index.js", 6 | "dependencies": { 7 | "subpackage": "file:../conditions-subpackage" 8 | } 9 | } -------------------------------------------------------------------------------- /test/config/fixtures/conditions-subpackage/custom.js: -------------------------------------------------------------------------------- 1 | export default 'custom' 2 | -------------------------------------------------------------------------------- /test/config/fixtures/conditions-subpackage/default.js: -------------------------------------------------------------------------------- 1 | throw new Error('Should not be imported') 2 | -------------------------------------------------------------------------------- /test/config/fixtures/conditions-subpackage/development.js: -------------------------------------------------------------------------------- 1 | export default 'development' 2 | -------------------------------------------------------------------------------- /test/config/fixtures/conditions-subpackage/production.js: -------------------------------------------------------------------------------- 1 | export default 'production' 2 | -------------------------------------------------------------------------------- /test/config/fixtures/conditions-test/conditions.test.js: -------------------------------------------------------------------------------- 1 | import { test, expect } from 'vitest'; 2 | import { condition } from '../conditions-pkg'; 3 | 4 | test('condition is correct', () => { 5 | expect(condition).toBe(TEST_CONDITION) 6 | }) 7 | -------------------------------------------------------------------------------- /test/config/fixtures/conditions-test/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({}) 4 | -------------------------------------------------------------------------------- /test/config/fixtures/console-color/basic.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from 'vitest' 2 | 3 | test("console color", () => { 4 | console.log(true) // node console highlights primitive 5 | }) 6 | -------------------------------------------------------------------------------- /test/config/fixtures/console-color/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({}) 4 | -------------------------------------------------------------------------------- /test/config/fixtures/console/basic.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from 'vitest' 2 | 3 | test('basic', () => { 4 | console.error("__test_console__"); 5 | }) 6 | -------------------------------------------------------------------------------- /test/config/fixtures/console/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({}) 4 | -------------------------------------------------------------------------------- /test/config/fixtures/css/App.css: -------------------------------------------------------------------------------- 1 | .main { 2 | display: flex; 3 | width: 100px; 4 | } 5 | -------------------------------------------------------------------------------- /test/config/fixtures/css/App.module.css: -------------------------------------------------------------------------------- 1 | .main { 2 | display: flex; 3 | } 4 | 5 | .module { 6 | width: 100px; 7 | } -------------------------------------------------------------------------------- /test/config/fixtures/dangerously-ignore-unhandled-errors/tests/throw-errors.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from "vitest" 2 | 3 | test("Some test", () => { 4 | // 5 | }) 6 | 7 | new Promise((_, reject) => reject(new Error("intentional unhandled error"))) -------------------------------------------------------------------------------- /test/config/fixtures/diff/vite.config.ts: -------------------------------------------------------------------------------- 1 | import {defineConfig} from 'vitest/config' 2 | 3 | export default defineConfig({ 4 | test: { 5 | diff: { 6 | // expand: false, 7 | // printBasicPrototype: false, 8 | } 9 | } 10 | }) 11 | -------------------------------------------------------------------------------- /test/config/fixtures/exclude/math.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | import { add } from './math' 4 | 5 | test('should add two numbers correctly', () => { 6 | expect(add(1, 2)).toBe(3) 7 | }) 8 | -------------------------------------------------------------------------------- /test/config/fixtures/exclude/math.ts: -------------------------------------------------------------------------------- 1 | export function add(a: number, b: number): number { 2 | return a + b 3 | } 4 | -------------------------------------------------------------------------------- /test/config/fixtures/exclude/string.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | import { capitalize } from './string' 4 | 5 | test('should capitalize strings correctly', () => { 6 | expect(capitalize('i Love Vitest')).toBe('I love vitest') 7 | }) 8 | -------------------------------------------------------------------------------- /test/config/fixtures/exclude/string.ts: -------------------------------------------------------------------------------- 1 | export function capitalize(str: string): string { 2 | return str.slice(0, 1).toUpperCase() + str.slice(1).toLowerCase() 3 | } 4 | -------------------------------------------------------------------------------- /test/config/fixtures/exclude/vitest.exclude.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({ 4 | test: { 5 | include: ['fixtures/exclude/*.test.ts'], 6 | }, 7 | }) 8 | -------------------------------------------------------------------------------- /test/config/fixtures/filters-slash/test/basic-foo/a.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from 'vitest' 2 | 3 | test('example', () => {}) 4 | -------------------------------------------------------------------------------- /test/config/fixtures/filters-slash/test/basic.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from 'vitest' 2 | 3 | test('example', () => {}) 4 | -------------------------------------------------------------------------------- /test/config/fixtures/filters-slash/test/basic/a.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from 'vitest' 2 | 3 | test('example', () => {}) 4 | -------------------------------------------------------------------------------- /test/config/fixtures/filters-slash/test/foo-basic/a.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from 'vitest' 2 | 3 | test('example', () => {}) 4 | -------------------------------------------------------------------------------- /test/config/fixtures/filters-slash/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({}) 4 | -------------------------------------------------------------------------------- /test/config/fixtures/filters/test/config.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('this will pass', () => { 4 | expect('This test should be run').toBeTruthy() 5 | }) 6 | -------------------------------------------------------------------------------- /test/config/fixtures/filters/test/dont-run-this.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('this will fail', () => { 4 | expect('This test should not be run').toBeFalsy() 5 | }) 6 | -------------------------------------------------------------------------------- /test/config/fixtures/filters/test/example.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('this will pass', () => { 4 | expect(1 + 1).toBe(2) 5 | }) 6 | -------------------------------------------------------------------------------- /test/config/fixtures/fixture-no-async/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "vitest/config"; 2 | 3 | export default defineConfig({ 4 | esbuild: { 5 | supported: { 6 | "async-await": false, 7 | }, 8 | }, 9 | }); 10 | -------------------------------------------------------------------------------- /test/config/fixtures/get-state/a.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | const testPath = expect.getState().testPath; 4 | 5 | test("a", () => { 6 | expect(testPath).toContain('a.test.ts') 7 | }) 8 | -------------------------------------------------------------------------------- /test/config/fixtures/get-state/b.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | const testPath = expect.getState().testPath; 4 | 5 | test("b", () => { 6 | expect(testPath).toContain('b.test.ts') 7 | }) 8 | -------------------------------------------------------------------------------- /test/config/fixtures/get-state/c.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | const testPath = expect.getState().testPath; 4 | 5 | test("c", () => { 6 | expect(testPath).toContain('c.test.ts') 7 | }) 8 | -------------------------------------------------------------------------------- /test/config/fixtures/get-state/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "vitest/config"; 2 | 3 | export default defineConfig({ 4 | test: { 5 | isolate: false, 6 | minWorkers: 1, 7 | maxWorkers: 1, 8 | } 9 | }) 10 | -------------------------------------------------------------------------------- /test/config/fixtures/inline-setup-file/file-setup.js: -------------------------------------------------------------------------------- 1 | if (typeof __vite_ssr_import__ === 'undefined') { 2 | throw new Error('Setup file was externalized') 3 | } 4 | -------------------------------------------------------------------------------- /test/config/fixtures/inline-setup-file/test.test.js: -------------------------------------------------------------------------------- 1 | import { test } from 'vitest' 2 | 3 | test('test', () => {}) 4 | -------------------------------------------------------------------------------- /test/config/fixtures/mode/example.benchmark.ts: -------------------------------------------------------------------------------- 1 | import { bench, describe } from 'vitest' 2 | 3 | describe('example', () => { 4 | bench('simple', () => { 5 | let _ = 0 6 | _ += 1 7 | }, { iterations: 1, time: 1, warmupIterations: 0, warmupTime: 0 }) 8 | }) 9 | -------------------------------------------------------------------------------- /test/config/fixtures/mode/example.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('should pass', () => { 4 | expect(1).toBe(1) 5 | }) 6 | -------------------------------------------------------------------------------- /test/config/fixtures/no-exec-args-fixtures/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({}) 4 | -------------------------------------------------------------------------------- /test/config/fixtures/pass-empty-files/empty.test.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/test/config/fixtures/pass-empty-files/empty.test.ts -------------------------------------------------------------------------------- /test/config/fixtures/project/packages/project_1/base.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from "vitest"; 2 | 3 | test("", () => { 4 | expect(1).toBe(1); 5 | }) 6 | -------------------------------------------------------------------------------- /test/config/fixtures/project/packages/project_2/base.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from "vitest"; 2 | 3 | test("", () => { 4 | expect(1).toBe(1); 5 | }) 6 | -------------------------------------------------------------------------------- /test/config/fixtures/project/packages/space_1/base.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from "vitest"; 2 | 3 | test("", () => { 4 | expect(1).toBe(1); 5 | }) 6 | -------------------------------------------------------------------------------- /test/config/fixtures/project/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "vitest/config"; 2 | 3 | export default defineConfig({ 4 | test: { 5 | projects: [ 6 | 'packages/*' 7 | ] 8 | } 9 | }) 10 | -------------------------------------------------------------------------------- /test/config/fixtures/public-config/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config'; 2 | 3 | export default defineConfig({ 4 | test: { 5 | name: 'root config' 6 | } 7 | }) -------------------------------------------------------------------------------- /test/config/fixtures/public-config/vitest.custom.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config'; 2 | 3 | export default defineConfig({ 4 | test: { 5 | name: 'custom config' 6 | } 7 | }) -------------------------------------------------------------------------------- /test/config/fixtures/retry/retry.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | let number = 0 4 | test('should passed', () => { 5 | expect(number++).toBe(3) 6 | }) 7 | 8 | test('retry but still failed', () => { 9 | expect(number++).toBe(4) 10 | }) 11 | -------------------------------------------------------------------------------- /test/config/fixtures/retry/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({ 4 | test: { 5 | retry: 3, 6 | }, 7 | }) 8 | -------------------------------------------------------------------------------- /test/config/fixtures/rollup-error/not-found-export.test.ts: -------------------------------------------------------------------------------- 1 | import "vite/no-such-export" 2 | -------------------------------------------------------------------------------- /test/config/fixtures/rollup-error/not-found-package.test.ts: -------------------------------------------------------------------------------- 1 | import '@vitejs/no-such-package' 2 | -------------------------------------------------------------------------------- /test/config/fixtures/shard/test/1.test.js: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('1', () => expect(1).toBe(1)) 4 | -------------------------------------------------------------------------------- /test/config/fixtures/shard/test/2.test.js: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('2', () => expect(1).toBe(1)) 4 | -------------------------------------------------------------------------------- /test/config/fixtures/shard/test/3.test.js: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('3', () => expect(1).toBe(1)) 4 | -------------------------------------------------------------------------------- /test/config/fixtures/shard/vitest.config.js: -------------------------------------------------------------------------------- 1 | export default {} -------------------------------------------------------------------------------- /test/config/fixtures/shuffle/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({ 4 | test: { 5 | sequence: { 6 | seed: 101, 7 | shuffle: true, 8 | } 9 | } 10 | }) 11 | -------------------------------------------------------------------------------- /test/config/fixtures/snapshot-path-context/__snapshots__/project1/basic.test.ts.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html 2 | 3 | exports[`basic 1`] = `"hello"`; 4 | -------------------------------------------------------------------------------- /test/config/fixtures/snapshot-path-context/__snapshots__/project2/basic.test.ts.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html 2 | 3 | exports[`basic 1`] = `"hello"`; 4 | -------------------------------------------------------------------------------- /test/config/fixtures/snapshot-path-context/basic.test.ts: -------------------------------------------------------------------------------- 1 | import { test, expect } from 'vitest' 2 | 3 | test('basic', () => { 4 | expect('hello').toMatchSnapshot() 5 | }) 6 | -------------------------------------------------------------------------------- /test/config/fixtures/test/example.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('it works', () => { 4 | expect(true).toBe(true) 5 | }) 6 | -------------------------------------------------------------------------------- /test/config/fixtures/test/fake-timers.test.ts: -------------------------------------------------------------------------------- 1 | import { test, vi } from 'vitest' 2 | 3 | test('uses fake timers', () => { 4 | vi.useFakeTimers() 5 | 6 | vi.useRealTimers() 7 | }) 8 | -------------------------------------------------------------------------------- /test/config/fixtures/test/vitest.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | test: { 3 | coverage: { 4 | reporter: [], 5 | }, 6 | } 7 | } -------------------------------------------------------------------------------- /test/config/fixtures/unhandled-rejections/setup-unhandled-rejections.ts: -------------------------------------------------------------------------------- 1 | export function setup() { 2 | void new Promise((_, reject) => reject(new Error('intentional unhandled rejection'))) 3 | } 4 | -------------------------------------------------------------------------------- /test/config/fixtures/unhandled-rejections/tests/example.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from "vitest" 2 | 3 | test("Some test", () => {}) 4 | 5 | -------------------------------------------------------------------------------- /test/config/fixtures/vitest.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | test: {} 3 | } -------------------------------------------------------------------------------- /test/config/fixtures/watch-trigger-pattern/folder/fs/text.txt: -------------------------------------------------------------------------------- 1 | hello world 2 | -------------------------------------------------------------------------------- /test/config/fixtures/workers-option/example.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('it works', () => { 4 | expect(true).toBe(true) 5 | }) 6 | -------------------------------------------------------------------------------- /test/config/fixtures/workers-option/vitest.config.js: -------------------------------------------------------------------------------- 1 | export default {} -------------------------------------------------------------------------------- /test/config/fixtures/workspace-flags/projects/cli-config.test.ts: -------------------------------------------------------------------------------- 1 | import { it, expect } from 'vitest'; 2 | 3 | it('math', () => { 4 | expect(1).toBe(1) 5 | }) 6 | -------------------------------------------------------------------------------- /test/config/fixtures/workspace-flags/projects/vitest.config.js: -------------------------------------------------------------------------------- 1 | export default {} -------------------------------------------------------------------------------- /test/config/fixtures/workspace-flags/vitest.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({ 4 | test: { 5 | projects: ['projects'], 6 | }, 7 | }) -------------------------------------------------------------------------------- /test/config/fixtures/workspace/api/vite.custom.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | test: { 3 | env: { 4 | TEST_PROJECT: 'project-3', 5 | }, 6 | }, 7 | } -------------------------------------------------------------------------------- /test/config/fixtures/workspace/config-empty/vitest.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config'; 2 | 3 | export default defineConfig({}) 4 | -------------------------------------------------------------------------------- /test/config/fixtures/workspace/config-extends/repro.test.js: -------------------------------------------------------------------------------- 1 | import { test, expect } from 'vitest'; 2 | import repro from 'virtual:repro'; 3 | 4 | test('importing a virtual module', () => { 5 | expect(repro).toBe('Hello, world!'); 6 | }); 7 | -------------------------------------------------------------------------------- /test/config/fixtures/workspace/config-import-analysis/dep.ts: -------------------------------------------------------------------------------- 1 | export default [] satisfies string[]; 2 | -------------------------------------------------------------------------------- /test/config/fixtures/workspace/config-import-analysis/packages/a/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "a" 3 | } 4 | -------------------------------------------------------------------------------- /test/config/fixtures/workspace/config-import-analysis/packages/a/test.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from 'vitest'; 2 | 3 | test('test - a') 4 | -------------------------------------------------------------------------------- /test/config/fixtures/workspace/invalid-duplicate-configs/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({ 4 | test: { 5 | projects: [ 6 | './vitest1.config.js', 7 | './vitest2.config.js', 8 | ], 9 | } 10 | }) -------------------------------------------------------------------------------- /test/config/fixtures/workspace/invalid-duplicate-configs/vitest1.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | test: { 3 | name: 'test', 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/config/fixtures/workspace/invalid-duplicate-configs/vitest2.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | test: { 3 | name: 'test', 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/config/fixtures/workspace/invalid-non-existing-config/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({ 4 | test: { 5 | projects: [ 6 | './vitest.config.js' 7 | ], 8 | }, 9 | }) -------------------------------------------------------------------------------- /test/config/fixtures/workspace/negated/packages/a/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "a" 3 | } 4 | -------------------------------------------------------------------------------- /test/config/fixtures/workspace/negated/packages/a/test.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from 'vitest'; 2 | 3 | test('test - a') 4 | -------------------------------------------------------------------------------- /test/config/fixtures/workspace/negated/packages/b/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "b" 3 | } 4 | -------------------------------------------------------------------------------- /test/config/fixtures/workspace/negated/packages/b/test.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from 'vitest'; 2 | 3 | test('test - b') 4 | -------------------------------------------------------------------------------- /test/config/fixtures/workspace/negated/packages/c/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "c" 3 | } 4 | -------------------------------------------------------------------------------- /test/config/fixtures/workspace/negated/packages/c/test.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from 'vitest'; 2 | 3 | test('test - c') 4 | -------------------------------------------------------------------------------- /test/config/fixtures/workspace/negated/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config'; 2 | 3 | export default defineConfig({ 4 | test: { 5 | projects: [ 6 | 'packages/*', 7 | '!packages/b' 8 | ], 9 | }, 10 | }) 11 | -------------------------------------------------------------------------------- /test/config/fixtures/workspace/nested/e2e.projects.js: -------------------------------------------------------------------------------- 1 | export default ['project-1'] -------------------------------------------------------------------------------- /test/config/fixtures/workspace/project-1/calculator-1.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, it } from 'vitest'; 2 | 3 | it('1 + 1 = 2', () => { 4 | expect(1 + 1).toBe(2); 5 | }) 6 | -------------------------------------------------------------------------------- /test/config/fixtures/workspace/project-2/calculator-2.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, it } from 'vitest'; 2 | 3 | it('2 + 2 = 4', () => { 4 | expect(2 + 2).toBe(4); 5 | }) 6 | -------------------------------------------------------------------------------- /test/config/fixtures/workspace/several-configs/test/1_test.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest'; 2 | 3 | test('1 + 1 = 2', () => { 4 | expect(1 + 1).toBe(2); 5 | }) 6 | -------------------------------------------------------------------------------- /test/config/fixtures/workspace/several-configs/test/2_test.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest'; 2 | 3 | test('2 + 2 = 4', () => { 4 | expect(2 + 2).toBe(4); 5 | }) 6 | -------------------------------------------------------------------------------- /test/config/fixtures/workspace/several-configs/test/vitest.config.one.ts: -------------------------------------------------------------------------------- 1 | import { defineProject } from 'vitest/config'; 2 | 3 | export default defineProject({ 4 | test: { 5 | name: '1_test', 6 | include: ['./1_test.test.ts'], 7 | } 8 | }) 9 | -------------------------------------------------------------------------------- /test/config/fixtures/workspace/several-configs/test/vitest.config.two.ts: -------------------------------------------------------------------------------- 1 | import { defineProject } from 'vitest/config'; 2 | 3 | export default defineProject({ 4 | test: { 5 | name: '2_test', 6 | include: ['./2_test.test.ts'], 7 | } 8 | }) 9 | -------------------------------------------------------------------------------- /test/config/fixtures/workspace/several-configs/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({ 4 | test: { 5 | projects: [ 6 | './test/*.config.*.ts', 7 | ], 8 | }, 9 | }) -------------------------------------------------------------------------------- /test/config/fixtures/workspace/several-folders/apps/b/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "b" 3 | } -------------------------------------------------------------------------------- /test/config/fixtures/workspace/several-folders/apps/b/test.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from 'vitest'; 2 | 3 | test('test - b') -------------------------------------------------------------------------------- /test/config/fixtures/workspace/several-folders/projects/a/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "a" 3 | } -------------------------------------------------------------------------------- /test/config/fixtures/workspace/several-folders/projects/a/test.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from 'vitest'; 2 | 3 | test('test - a') -------------------------------------------------------------------------------- /test/config/fixtures/workspace/several-folders/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config'; 2 | 3 | export default defineConfig({ 4 | test: { 5 | projects: [ 6 | 'projects/*', 7 | 'apps/*' 8 | ], 9 | }, 10 | }) -------------------------------------------------------------------------------- /test/config/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "lib": ["DOM", "ESNext"], 5 | "types": ["vite/client"] 6 | }, 7 | "exclude": [ 8 | "**/dist/**" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /test/core/.env.local: -------------------------------------------------------------------------------- 1 | VITE_TEST_ENV=local -------------------------------------------------------------------------------- /test/core/__mocks__/axios/index.ts: -------------------------------------------------------------------------------- 1 | import { vi } from 'vitest' 2 | 3 | export default { 4 | get: vi.fn(), 5 | } 6 | -------------------------------------------------------------------------------- /test/core/__mocks__/custom-lib.ts: -------------------------------------------------------------------------------- 1 | export default function () { 2 | return 'mocked' 3 | } 4 | -------------------------------------------------------------------------------- /test/core/__mocks__/extension.js.ts: -------------------------------------------------------------------------------- 1 | export const mocked = true 2 | -------------------------------------------------------------------------------- /test/core/__mocks__/fs.cjs: -------------------------------------------------------------------------------- 1 | // we can also use `import`, but then 2 | // every export should be explicitly defined 3 | 4 | const { fs } = require('memfs') 5 | 6 | module.exports = fs 7 | -------------------------------------------------------------------------------- /test/core/__mocks__/fs/promises.cjs: -------------------------------------------------------------------------------- 1 | // we can also use `import`, but then 2 | // every export should be explicitly defined 3 | 4 | const { fs } = require('memfs') 5 | 6 | module.exports = fs.promises 7 | -------------------------------------------------------------------------------- /test/core/__mocks__/timers.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | clearInterval: () => 'foo', 3 | } 4 | -------------------------------------------------------------------------------- /test/core/__mocks__/virtual-module.ts: -------------------------------------------------------------------------------- 1 | export const value = 'folder' 2 | -------------------------------------------------------------------------------- /test/core/__mocks__/vscode-mocks.ts: -------------------------------------------------------------------------------- 1 | export const folder = true 2 | -------------------------------------------------------------------------------- /test/core/cute-puppy.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/test/core/cute-puppy.jpg -------------------------------------------------------------------------------- /test/core/deps/dep-cjs/esm-comment.js: -------------------------------------------------------------------------------- 1 | // import x from "x" 2 | /** import x from "x" */ 3 | /** 4 | * import x from "x" 5 | */ 6 | module.exports = { test: 'ok' } 7 | -------------------------------------------------------------------------------- /test/core/deps/dep-cjs/esm-string.js: -------------------------------------------------------------------------------- 1 | module.exports = { test: ' import.meta' } 2 | -------------------------------------------------------------------------------- /test/core/deps/dep-cjs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@vitest/test-dep-cjs", 3 | "type": "commonjs", 4 | "exports": { 5 | "./esm-comment": "./esm-comment.js", 6 | "./esm-string": "./esm-string.js" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/core/deps/dep1/esm/index.js: -------------------------------------------------------------------------------- 1 | // esm/index.js was detected as isValidNodeImport(id) = false 2 | // event if package.json has type = module, 3 | // which causes dual package hazard when other external esm import esm/index.js. 4 | export const data = {} 5 | -------------------------------------------------------------------------------- /test/core/deps/dep1/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@vitest/test-dep1", 3 | "type": "module", 4 | "exports": "./esm/index.js" 5 | } 6 | -------------------------------------------------------------------------------- /test/core/deps/dep2/index.js: -------------------------------------------------------------------------------- 1 | export { data } from '@vitest/test-dep1' 2 | -------------------------------------------------------------------------------- /test/core/deps/dep2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@vitest/test-dep2", 3 | "type": "module", 4 | "exports": "./index.js", 5 | "dependencies": { 6 | "@vitest/test-dep1": "file:../dep1" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/core/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Core Tests 7 | 8 | 9 | Nothing is rendered 10 | 11 | -------------------------------------------------------------------------------- /test/core/projects/custom-lib/index.js: -------------------------------------------------------------------------------- 1 | export default function () { 2 | // module doesn't exist in Node.js ESM, but exists in vite-node 3 | return typeof module 4 | } 5 | -------------------------------------------------------------------------------- /test/core/projects/custom-lib/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test/core/projects/inline-lib/index.js: -------------------------------------------------------------------------------- 1 | export default function () { 2 | // module doesn't exist in Node.js ESM, but exists in vite-node 3 | return typeof module 4 | } 5 | -------------------------------------------------------------------------------- /test/core/projects/inline-lib/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "main": "index.js" 4 | } 5 | -------------------------------------------------------------------------------- /test/core/src/__mocks__/submodule.ts: -------------------------------------------------------------------------------- 1 | export const two = 1 + 1 + 1 2 | -------------------------------------------------------------------------------- /test/core/src/aliased-mod.ts: -------------------------------------------------------------------------------- 1 | export const isAliased = true 2 | -------------------------------------------------------------------------------- /test/core/src/circularA.ts: -------------------------------------------------------------------------------- 1 | import { circularB } from './circularB' 2 | 3 | export const CalledB: number[] = [] 4 | 5 | export function circularA() { 6 | return circularB() 7 | } 8 | -------------------------------------------------------------------------------- /test/core/src/circularB.ts: -------------------------------------------------------------------------------- 1 | import { CalledB } from './circularA' 2 | 3 | export function circularB() { 4 | return CalledB.push(CalledB.length) 5 | } 6 | -------------------------------------------------------------------------------- /test/core/src/cjs/array-cjs.js: -------------------------------------------------------------------------------- 1 | module.exports = [1, '2'] 2 | -------------------------------------------------------------------------------- /test/core/src/cjs/bare-cjs.js: -------------------------------------------------------------------------------- 1 | module.exports = { c: 'c' } 2 | exports.a = 'a' 3 | exports.b = 'b' 4 | -------------------------------------------------------------------------------- /test/core/src/cjs/class-cjs.js: -------------------------------------------------------------------------------- 1 | class Test { 2 | variable = 1 3 | } 4 | 5 | module.exports = new Test() 6 | module.exports.Test = Test 7 | -------------------------------------------------------------------------------- /test/core/src/cjs/default-function.d.ts: -------------------------------------------------------------------------------- 1 | declare function format(): string 2 | 3 | export default format 4 | -------------------------------------------------------------------------------- /test/core/src/cjs/default-function.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | function format() { 4 | return '' 5 | } 6 | 7 | module.exports = format 8 | module.exports.default = format 9 | -------------------------------------------------------------------------------- /test/core/src/cjs/module-cjs.ts: -------------------------------------------------------------------------------- 1 | module.exports.a = 1 2 | module.exports.b = 2 3 | -------------------------------------------------------------------------------- /test/core/src/cjs/nested-default-cjs.js: -------------------------------------------------------------------------------- 1 | exports.default = { 2 | a: 'a', 3 | b: 'b', 4 | object: { 5 | h: 'h', 6 | }, 7 | } 8 | Object.defineProperty(exports, '__esModule', { value: true, enumerable: false }) 9 | -------------------------------------------------------------------------------- /test/core/src/cjs/primitive-cjs.js: -------------------------------------------------------------------------------- 1 | module.exports = 'string' 2 | exports.a = 'a' 3 | -------------------------------------------------------------------------------- /test/core/src/cjs/promise-export.js: -------------------------------------------------------------------------------- 1 | module.exports = Promise.resolve({ value: 42 }) 2 | -------------------------------------------------------------------------------- /test/core/src/cjs/prototype-cjs.js: -------------------------------------------------------------------------------- 1 | exports.test = () => { 2 | // eslint-disable-next-line no-prototype-builtins 3 | return exports.hasOwnProperty('test') 4 | } 5 | exports.getPrototype = () => { 6 | return Object.getPrototypeOf(exports) 7 | } 8 | -------------------------------------------------------------------------------- /test/core/src/dynamic-import.ts: -------------------------------------------------------------------------------- 1 | export async function dynamicImport(name: string) { 2 | const pkg = await import(name) 3 | return pkg 4 | } 5 | -------------------------------------------------------------------------------- /test/core/src/env.ts: -------------------------------------------------------------------------------- 1 | export function getAuthToken() { 2 | return import.meta.env.AUTH_TOKEN 3 | } 4 | -------------------------------------------------------------------------------- /test/core/src/esm/esm.js: -------------------------------------------------------------------------------- 1 | export const test = 1 2 | -------------------------------------------------------------------------------- /test/core/src/esm/internal-esm.mjs: -------------------------------------------------------------------------------- 1 | export * from 'tinyspy' 2 | -------------------------------------------------------------------------------- /test/core/src/esm/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test/core/src/external/default-cjs.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | a: 'a', 3 | b: 'b', 4 | object: { 5 | h: 'h', 6 | }, 7 | } 8 | -------------------------------------------------------------------------------- /test/core/src/external/nested-default-cjs.js: -------------------------------------------------------------------------------- 1 | exports.default = { 2 | a: 'a', 3 | b: 'b', 4 | object: { 5 | h: 'h', 6 | }, 7 | } 8 | Object.defineProperty(exports, '__esModule', { value: true, enumerable: false }) 9 | -------------------------------------------------------------------------------- /test/core/src/external/package.json: -------------------------------------------------------------------------------- 1 | { "type": "commonjs" } 2 | -------------------------------------------------------------------------------- /test/core/src/external/pkg-browser/index.d.ts: -------------------------------------------------------------------------------- 1 | export default '' 2 | -------------------------------------------------------------------------------- /test/core/src/external/pkg-browser/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "exports": { 4 | "types": "./index.d.ts", 5 | "browser": "./web.js", 6 | "node": "./ssr.js" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/core/src/external/pkg-browser/ssr.js: -------------------------------------------------------------------------------- 1 | export default 'ssr' 2 | -------------------------------------------------------------------------------- /test/core/src/external/pkg-browser/web.js: -------------------------------------------------------------------------------- 1 | export default 'web' 2 | -------------------------------------------------------------------------------- /test/core/src/external/pkg-node/index.d.ts: -------------------------------------------------------------------------------- 1 | export default '' 2 | -------------------------------------------------------------------------------- /test/core/src/external/pkg-node/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "exports": { 4 | "types": "./index.d.ts", 5 | "node": "./ssr.js", 6 | "browser": "./web.js" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/core/src/external/pkg-node/ssr.js: -------------------------------------------------------------------------------- 1 | export default 'ssr' 2 | -------------------------------------------------------------------------------- /test/core/src/external/pkg-node/web.js: -------------------------------------------------------------------------------- 1 | export default 'web' 2 | -------------------------------------------------------------------------------- /test/core/src/file-css.css: -------------------------------------------------------------------------------- 1 | .red { 2 | color: red; 3 | } 4 | -------------------------------------------------------------------------------- /test/core/src/file-less.less: -------------------------------------------------------------------------------- 1 | @color: red; 2 | 3 | .red { 4 | color: @color; 5 | } -------------------------------------------------------------------------------- /test/core/src/file-sass.sass: -------------------------------------------------------------------------------- 1 | .red 2 | color: red; 3 | -------------------------------------------------------------------------------- /test/core/src/file-scss.scss: -------------------------------------------------------------------------------- 1 | .red { 2 | color: red; 3 | } 4 | -------------------------------------------------------------------------------- /test/core/src/file-txt.txt: -------------------------------------------------------------------------------- 1 | text 2 | -------------------------------------------------------------------------------- /test/core/src/global-mock.ts: -------------------------------------------------------------------------------- 1 | export const mocked = false 2 | -------------------------------------------------------------------------------- /test/core/src/in-source/index.ts: -------------------------------------------------------------------------------- 1 | export * from './add' 2 | export * from './fibonacci' 3 | -------------------------------------------------------------------------------- /test/core/src/mockedA.ts: -------------------------------------------------------------------------------- 1 | export function mockedA() { 2 | return 'A' 3 | } 4 | -------------------------------------------------------------------------------- /test/core/src/mockedB.ts: -------------------------------------------------------------------------------- 1 | import { mockedA } from './mockedA' 2 | 3 | export function mockedB() { 4 | return mockedA() 5 | } 6 | -------------------------------------------------------------------------------- /test/core/src/mockedD.ts: -------------------------------------------------------------------------------- 1 | import { MockedC } from './mockedC' 2 | 3 | export default MockedC 4 | export * from './mockedC' 5 | -------------------------------------------------------------------------------- /test/core/src/mockedE.ts: -------------------------------------------------------------------------------- 1 | export const symbolFn = Symbol.for('symbolFn') 2 | 3 | export class MockedE { 4 | public testFn(arg: string) { 5 | return arg.repeat(2) 6 | } 7 | 8 | public [symbolFn](arg: string) { 9 | return arg.repeat(2) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /test/core/src/mocks/A.ts: -------------------------------------------------------------------------------- 1 | import { funcB } from './B.js' 2 | 3 | export function funcA() { 4 | return funcB 5 | } 6 | -------------------------------------------------------------------------------- /test/core/src/mocks/B.ts: -------------------------------------------------------------------------------- 1 | import { funcA } from './A.js' 2 | 3 | export function funcB() { 4 | return funcA 5 | } 6 | -------------------------------------------------------------------------------- /test/core/src/mocks/cyclic-deps/module-1.mjs: -------------------------------------------------------------------------------- 1 | import './module-2' 2 | -------------------------------------------------------------------------------- /test/core/src/mocks/cyclic-deps/module-2.mjs: -------------------------------------------------------------------------------- 1 | import './module-3' 2 | -------------------------------------------------------------------------------- /test/core/src/mocks/cyclic-deps/module-3.mjs: -------------------------------------------------------------------------------- 1 | import './module-4' 2 | -------------------------------------------------------------------------------- /test/core/src/mocks/cyclic-deps/module-4.mjs: -------------------------------------------------------------------------------- 1 | import './module-1' 2 | -------------------------------------------------------------------------------- /test/core/src/mocks/default.ts: -------------------------------------------------------------------------------- 1 | export default 'a default' 2 | -------------------------------------------------------------------------------- /test/core/src/mocks/dynamic-module.d.ts: -------------------------------------------------------------------------------- 1 | export {} 2 | -------------------------------------------------------------------------------- /test/core/src/mocks/dynamic-module.js: -------------------------------------------------------------------------------- 1 | export {} 2 | -------------------------------------------------------------------------------- /test/core/src/mocks/export-default-circle-b.ts: -------------------------------------------------------------------------------- 1 | import b from './export-default-circle-index.js' 2 | 3 | export default function (): any { 4 | return b() 5 | } 6 | -------------------------------------------------------------------------------- /test/core/src/mocks/export-default-circle-index.ts: -------------------------------------------------------------------------------- 1 | import b from './export-default-circle-b.js' 2 | 3 | export default function (): any { 4 | return b() 5 | } 6 | -------------------------------------------------------------------------------- /test/core/src/mocks/external/cjs-pseudoesm.cjs: -------------------------------------------------------------------------------- 1 | function fn() {} 2 | 3 | exports.fn = fn 4 | Object.defineProperty(exports, '__esModule', { value: true, enumerable: false }) 5 | -------------------------------------------------------------------------------- /test/core/src/mocks/external/default-cjs.cjs: -------------------------------------------------------------------------------- 1 | module.exports = require('./cjs-pseudoesm.cjs') 2 | -------------------------------------------------------------------------------- /test/core/src/mocks/external/default-function.cjs: -------------------------------------------------------------------------------- 1 | module.exports = function () { 2 | return true 3 | } 4 | -------------------------------------------------------------------------------- /test/core/src/mocks/external/external.mjs: -------------------------------------------------------------------------------- 1 | import { vi } from 'vitest' 2 | 3 | vi.doMock('axios') 4 | -------------------------------------------------------------------------------- /test/core/src/mocks/has space in path.ts: -------------------------------------------------------------------------------- 1 | export const thisIsOk = false 2 | -------------------------------------------------------------------------------- /test/core/src/mocks/integration.ts: -------------------------------------------------------------------------------- 1 | import { useJwt } from '@vueuse/integrations/useJwt' 2 | import { ref } from 'vue' 3 | 4 | export function createStore() { 5 | const encoded = ref('123') 6 | const { payload } = useJwt(encoded) 7 | 8 | return { payload } 9 | } 10 | -------------------------------------------------------------------------------- /test/core/src/mocks/main.js: -------------------------------------------------------------------------------- 1 | import { funcA } from './A' 2 | import { funcB } from './B' 3 | 4 | export function main() { 5 | return funcA() 6 | } 7 | 8 | export function mainB() { 9 | return funcB() 10 | } 11 | -------------------------------------------------------------------------------- /test/core/src/mocks/moduleA.ts: -------------------------------------------------------------------------------- 1 | export const A = 'A' 2 | -------------------------------------------------------------------------------- /test/core/src/mocks/moduleB.ts: -------------------------------------------------------------------------------- 1 | export const A = 'A' 2 | export const B = 'B' 3 | -------------------------------------------------------------------------------- /test/core/src/mocks/set-foo.ts: -------------------------------------------------------------------------------- 1 | import { afterEach, beforeEach } from 'vitest' 2 | 3 | // eslint-disable-next-line import/no-mutable-exports 4 | export let foo: number 5 | 6 | beforeEach(() => { 7 | foo = 1 8 | }) 9 | 10 | afterEach(() => { 11 | foo = 2 12 | }) 13 | -------------------------------------------------------------------------------- /test/core/src/mocks/squared.js: -------------------------------------------------------------------------------- 1 | export function squared() { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /test/core/src/mocks/zustand-magic.ts: -------------------------------------------------------------------------------- 1 | import zustand from 'zustand' 2 | 3 | export function magic() { 4 | return zustand() 5 | } 6 | -------------------------------------------------------------------------------- /test/core/src/module-esm.ts: -------------------------------------------------------------------------------- 1 | const c = 1 2 | export default c 3 | export const d = 2 4 | -------------------------------------------------------------------------------- /test/core/src/read-hello-world.ts: -------------------------------------------------------------------------------- 1 | // hello-world.js 2 | import { readFileSync } from 'node:fs' 3 | 4 | export function readHelloWorld(path: string) { 5 | return readFileSync(path, 'utf-8') 6 | } 7 | -------------------------------------------------------------------------------- /test/core/src/relative-import.ts: -------------------------------------------------------------------------------- 1 | export function dynamicRelativeImport(file: string) { 2 | return import(/* @vite-ignore */ `./${file}.ts`) 3 | } 4 | -------------------------------------------------------------------------------- /test/core/src/rely-on-hoisted.ts: -------------------------------------------------------------------------------- 1 | // @ts-expect-error not typed global 2 | export const value = globalThis.someGlobalValue 3 | -------------------------------------------------------------------------------- /test/core/src/self/foo.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | 3 | export function foo(): true { 4 | return true; 5 | } -------------------------------------------------------------------------------- /test/core/src/self/index.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | 3 | export * from './foo'; 4 | export * from './index'; // <-- wrong -------------------------------------------------------------------------------- /test/core/src/submodule.ts: -------------------------------------------------------------------------------- 1 | export const two = 1 + 1 2 | -------------------------------------------------------------------------------- /test/core/src/timeout.ts: -------------------------------------------------------------------------------- 1 | export const timeout = 100 2 | -------------------------------------------------------------------------------- /test/core/src/wasm/add.wasm: -------------------------------------------------------------------------------- 1 | asm`add 2 |  j -------------------------------------------------------------------------------- /test/core/src/wasm/wasm-bindgen-no-cyclic/index.d.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable */ 2 | /* eslint-disable */ 3 | /** 4 | * @param {string} name 5 | */ 6 | export function greet(name: string): void; 7 | -------------------------------------------------------------------------------- /test/core/src/wasm/wasm-bindgen-no-cyclic/index.js: -------------------------------------------------------------------------------- 1 | import * as wasm from "./index_bg.wasm"; 2 | import { __wbg_set_wasm } from "./index_bg.js"; 3 | __wbg_set_wasm(wasm); 4 | export * from "./index_bg.js"; 5 | -------------------------------------------------------------------------------- /test/core/src/wasm/wasm-bindgen-no-cyclic/index_bg.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/test/core/src/wasm/wasm-bindgen-no-cyclic/index_bg.wasm -------------------------------------------------------------------------------- /test/core/src/wasm/wasm-bindgen/README.md: -------------------------------------------------------------------------------- 1 | copied from https://github.com/jestjs/jest/tree/28d32c6a1e48f1e4c946a8e6adbe2ae9af4103e3/e2e/native-esm/wasm-bindgen 2 | -------------------------------------------------------------------------------- /test/core/src/wasm/wasm-bindgen/index_bg.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/test/core/src/wasm/wasm-bindgen/index_bg.wasm -------------------------------------------------------------------------------- /test/core/src/wasm/wasm-bindgen/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test/core/src/web-worker/eventListenerWorker.ts: -------------------------------------------------------------------------------- 1 | function callback(e: MessageEvent) { 2 | self.postMessage(`${e.data} world`) 3 | self.removeEventListener('message', callback) 4 | } 5 | 6 | self.addEventListener('message', callback) 7 | -------------------------------------------------------------------------------- /test/core/src/web-worker/mock/worker-dep.ts: -------------------------------------------------------------------------------- 1 | export function workerDep() { 2 | return 'workerDep' 3 | } 4 | -------------------------------------------------------------------------------- /test/core/src/web-worker/mock/worker.ts: -------------------------------------------------------------------------------- 1 | import { workerDep } from './worker-dep' 2 | 3 | self.postMessage(workerDep()) 4 | -------------------------------------------------------------------------------- /test/core/src/web-worker/objectWorker.ts: -------------------------------------------------------------------------------- 1 | self.onmessage = (e) => { 2 | self.postMessage(e.data) 3 | } 4 | -------------------------------------------------------------------------------- /test/core/src/web-worker/selfWorker.ts: -------------------------------------------------------------------------------- 1 | import subSelf from './selfWorkerDep' 2 | 3 | self.postMessage(subSelf === self) 4 | -------------------------------------------------------------------------------- /test/core/src/web-worker/selfWorkerDep.ts: -------------------------------------------------------------------------------- 1 | export default self 2 | -------------------------------------------------------------------------------- /test/core/src/web-worker/sharedWorker.ts: -------------------------------------------------------------------------------- 1 | self.addEventListener('connect', (event) => { 2 | const e = event as MessageEvent 3 | const port = e.ports[0] 4 | 5 | port.onmessage = (e) => { 6 | port.postMessage(e.data) 7 | } 8 | 9 | port.start() 10 | }) 11 | -------------------------------------------------------------------------------- /test/core/src/web-worker/worker-globals.ts: -------------------------------------------------------------------------------- 1 | self.onmessage = () => { 2 | self.postMessage({ 3 | crypto: !!self.crypto, 4 | caches: !!self.caches, 5 | location: !!self.location, 6 | origin: self.origin, 7 | }) 8 | } 9 | -------------------------------------------------------------------------------- /test/core/src/web-worker/worker.ts: -------------------------------------------------------------------------------- 1 | self.onmessage = (e) => { 2 | self.postMessage(`${e.data} world`) 3 | } 4 | -------------------------------------------------------------------------------- /test/core/test/__snapshots__/nested-suite.test.ts.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html 2 | 3 | exports[`a > b > c > d > e > very deep > msg 1`] = `"hi"`; 4 | -------------------------------------------------------------------------------- /test/core/test/__snapshots__/snapshot-concurrent-sync.test.ts.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html 2 | 3 | exports[`concurrent suite > snapshot 1`] = ` 4 | { 5 | "foo": "bar", 6 | } 7 | `; 8 | -------------------------------------------------------------------------------- /test/core/test/__snapshots__/suite.test.tsx.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html 2 | 3 | exports[`suite name > snapshot 1`] = ` 4 | { 5 | "foo": "bar", 6 | } 7 | `; 8 | -------------------------------------------------------------------------------- /test/core/test/alias.test.ts: -------------------------------------------------------------------------------- 1 | // @ts-expect-error aliased to ../src/aliased-mod.ts 2 | import { isAliased } from 'test-alias' 3 | import { expect, test } from 'vitest' 4 | 5 | test('check that test.alias works', () => { 6 | expect(isAliased).toBe(true) 7 | }) 8 | -------------------------------------------------------------------------------- /test/core/test/env-glob-dom/env-glob.spec.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('glob on folder', () => { 4 | expect(typeof window).not.toBe('undefined') 5 | expect(expect.getState().environment).toBe('jsdom') 6 | }) 7 | -------------------------------------------------------------------------------- /test/core/test/env-glob.dom.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('glob on extension', () => { 4 | expect(typeof window).not.toBe('undefined') 5 | expect(expect.getState().environment).toBe('happy-dom') 6 | }) 7 | -------------------------------------------------------------------------------- /test/core/test/env-glob.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('default', () => { 4 | expect(typeof window).toBe('undefined') 5 | expect(expect.getState().environment).toBe('node') 6 | }) 7 | -------------------------------------------------------------------------------- /test/core/test/fixtures/hello-mock.ts: -------------------------------------------------------------------------------- 1 | export class HelloWorld { 2 | hello() { 3 | return 'Hello World!' 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/core/test/fixtures/hi.txt: -------------------------------------------------------------------------------- 1 | Hello, World! 2 | -------------------------------------------------------------------------------- /test/core/test/fixtures/increment.ts: -------------------------------------------------------------------------------- 1 | export function increment(num: number) { 2 | return num + 1 3 | } 4 | -------------------------------------------------------------------------------- /test/core/test/fixtures/mocked-dependency.ts: -------------------------------------------------------------------------------- 1 | export function helloWorld(): void { 2 | throw new Error('not implemented') 3 | } 4 | -------------------------------------------------------------------------------- /test/core/test/fixtures/named-overwrite-all/dep1.js: -------------------------------------------------------------------------------- 1 | export const a = 'dep1-a' 2 | export const b = 'dep1-b' 3 | export const c = 'dep1-c' 4 | export const d = 'dep1-d' 5 | -------------------------------------------------------------------------------- /test/core/test/fixtures/named-overwrite-all/dep2.js: -------------------------------------------------------------------------------- 1 | export const d = 'dep2-d' 2 | -------------------------------------------------------------------------------- /test/core/test/fixtures/named-overwrite-all/main.js: -------------------------------------------------------------------------------- 1 | export const a = 'main-a' 2 | export * from './dep1.js' 3 | export const c = 'main-c' 4 | export * from './dep2.js' 5 | -------------------------------------------------------------------------------- /test/core/test/fixtures/snapshot-empty.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/test/core/test/fixtures/snapshot-empty.txt -------------------------------------------------------------------------------- /test/core/test/fixtures/snapshots/basic/input.json: -------------------------------------------------------------------------------- 1 | [ 2 | [ 3 | ".name", 4 | { 5 | "color": "red" 6 | } 7 | ] 8 | ] 9 | -------------------------------------------------------------------------------- /test/core/test/fixtures/snapshots/basic/output.css: -------------------------------------------------------------------------------- 1 | .name { 2 | color: red; 3 | } -------------------------------------------------------------------------------- /test/core/test/fixtures/snapshots/multiple/output.css: -------------------------------------------------------------------------------- 1 | .text-red { 2 | color: red; 3 | } 4 | .text-lg { 5 | font-size: 1.25rem; 6 | line-height: 1.75rem; 7 | } -------------------------------------------------------------------------------- /test/core/test/inlined.test.ts: -------------------------------------------------------------------------------- 1 | // @ts-expect-error not typed lib 2 | import typeOfModule from 'inline-lib' 3 | import { expect, test } from 'vitest' 4 | 5 | test('inline lib has exports injected even though it is ESM', () => { 6 | expect(typeOfModule()).toBe('object') 7 | }) 8 | -------------------------------------------------------------------------------- /test/core/test/moved-snapshot.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('snapshot is stored close to file', () => { 4 | expect('moved snapshot').toMatchSnapshot() 5 | }) 6 | -------------------------------------------------------------------------------- /test/core/test/moved-snapshot.test.ts.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html 2 | 3 | exports[`snapshot is stored close to file 1`] = `"moved snapshot"`; 4 | -------------------------------------------------------------------------------- /test/core/test/resolve-file-url~dep.js: -------------------------------------------------------------------------------- 1 | export default '[ok]' 2 | -------------------------------------------------------------------------------- /test/core/test/self.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, it } from 'vitest' 2 | import { foo } from '../src/self' 3 | 4 | // #1220 self export module 5 | it('self export', () => { 6 | expect(foo()).toBe(true) 7 | }) 8 | -------------------------------------------------------------------------------- /test/core/test/setup.ts: -------------------------------------------------------------------------------- 1 | import { vi } from 'vitest' 2 | 3 | vi.mock('../src/global-mock', () => ({ mocked: true })) 4 | -------------------------------------------------------------------------------- /test/core/test/snapshot-1.txt: -------------------------------------------------------------------------------- 1 | 2 | white space 3 | -------------------------------------------------------------------------------- /test/core/test/snapshot-2.txt: -------------------------------------------------------------------------------- 1 | example: | 2 | { 3 | echo "hello" 4 | } 5 | some: 6 | nesting: 7 | - "hello world" 8 | even: 9 | more: 10 | nesting: true 11 | -------------------------------------------------------------------------------- /test/core/test/snapshots-outside.ts: -------------------------------------------------------------------------------- 1 | import { expect } from 'vitest' 2 | 3 | export function testOutsideInlineSnapshot() { 4 | return (() => { 5 | expect({ foo: 'bar' }).toMatchInlineSnapshot(` 6 | { 7 | "foo": "bar", 8 | } 9 | `) 10 | })() 11 | } 12 | -------------------------------------------------------------------------------- /test/core/test/stubbed-process.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, it, vi } from 'vitest' 2 | 3 | vi.stubGlobal('process', { badMock: true }) 4 | 5 | it('should not hang', () => { 6 | expect(1).toBe(1) 7 | }) 8 | -------------------------------------------------------------------------------- /test/core/test/timers-jsdom.test.ts: -------------------------------------------------------------------------------- 1 | // @vitest-environment jsdom 2 | 3 | import './fixtures/timers.suite' 4 | -------------------------------------------------------------------------------- /test/core/test/timers-node.test.ts: -------------------------------------------------------------------------------- 1 | // @vitest-environment node 2 | 3 | import './fixtures/timers.suite' 4 | -------------------------------------------------------------------------------- /test/core/tsconfig.typecheck.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "include": ["./**/*.test-d.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /test/core/vitest-environment-custom/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vitest-environment-custom", 3 | "private": true, 4 | "exports": { 5 | ".": "./index.ts" 6 | }, 7 | "main": "index.ts" 8 | } 9 | -------------------------------------------------------------------------------- /test/coverage-test/fixtures/configs/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import vue from "@vitejs/plugin-vue"; 2 | import { defineConfig } from 'vitest/config' 3 | 4 | export default defineConfig({ 5 | plugins: [vue()], 6 | optimizeDeps: { 7 | include: ["vue"] 8 | } 9 | }) 10 | -------------------------------------------------------------------------------- /test/coverage-test/fixtures/setup.isolation.ts: -------------------------------------------------------------------------------- 1 | import { beforeAll } from "vitest"; 2 | import { branch } from "./src/branch"; 3 | 4 | beforeAll(() => { 5 | branch(1); 6 | }); 7 | -------------------------------------------------------------------------------- /test/coverage-test/fixtures/setup.ts: -------------------------------------------------------------------------------- 1 | console.log('Running setup in fixtures root') 2 | -------------------------------------------------------------------------------- /test/coverage-test/fixtures/src/.should-be-excluded-from-coverage/excluded-from-coverage.ts: -------------------------------------------------------------------------------- 1 | // This file should be excluded from coverage report 2 | 3 | export function uncoveredFile() { 4 | return 0 5 | } 6 | -------------------------------------------------------------------------------- /test/coverage-test/fixtures/src/Vue/Counter/index.ts: -------------------------------------------------------------------------------- 1 | import CounterVue from './Counter.vue' 2 | 3 | export { CounterVue } 4 | -------------------------------------------------------------------------------- /test/coverage-test/fixtures/src/Vue/vue.shim.d.ts: -------------------------------------------------------------------------------- 1 | declare const MY_CONSTANT: string 2 | 3 | declare module '*.vue' { 4 | import type { DefineComponent } from 'vue' 5 | 6 | const component: DefineComponent<{}, {}, any> 7 | export default component 8 | } 9 | -------------------------------------------------------------------------------- /test/coverage-test/fixtures/src/another-setup.ts: -------------------------------------------------------------------------------- 1 | console.log('Running another setup in fixtures src') 2 | -------------------------------------------------------------------------------- /test/coverage-test/fixtures/src/branch.ts: -------------------------------------------------------------------------------- 1 | export const branch = async (a: number) => { 2 | if (a === 15) { 3 | return true; 4 | } 5 | 6 | return false; 7 | }; 8 | -------------------------------------------------------------------------------- /test/coverage-test/fixtures/src/conditional/browser.ts: -------------------------------------------------------------------------------- 1 | export function browser() { 2 | return "This is for browsers only" 3 | } -------------------------------------------------------------------------------- /test/coverage-test/fixtures/src/conditional/node.ts: -------------------------------------------------------------------------------- 1 | export function node() { 2 | return "This is for node only" 3 | } -------------------------------------------------------------------------------- /test/coverage-test/fixtures/src/covered.custom-1: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/coverage-test/fixtures/src/even.ts: -------------------------------------------------------------------------------- 1 | export function isEven(a: number) { 2 | return a % 2 === 0 3 | } 4 | 5 | export function isOdd(a: number) { 6 | return !isEven(a) 7 | } -------------------------------------------------------------------------------- /test/coverage-test/fixtures/src/file-to-change.ts: -------------------------------------------------------------------------------- 1 | export function run() { 2 | return 'This file will be modified by test cases' 3 | } 4 | 5 | export function uncoveredFunction() { 6 | return 1 + 2 7 | } 8 | -------------------------------------------------------------------------------- /test/coverage-test/fixtures/src/implicit-else.ts: -------------------------------------------------------------------------------- 1 | export function implicitElse(condition: boolean) { 2 | let a = 1 3 | 4 | if (condition) { 5 | a = 2 6 | } 7 | 8 | return a 9 | } 10 | -------------------------------------------------------------------------------- /test/coverage-test/fixtures/src/import-meta-env.ts: -------------------------------------------------------------------------------- 1 | // @ts-nocheck -- untyped 2 | export function useImportEnv() { 3 | return import.meta.env.SOME_VARIABLE 4 | } 5 | -------------------------------------------------------------------------------- /test/coverage-test/fixtures/src/json-data-import.ts: -------------------------------------------------------------------------------- 1 | import data from "./json-data.json" with { "type": "json" }; 2 | 3 | export function getJSON() { 4 | return data 5 | }; 6 | -------------------------------------------------------------------------------- /test/coverage-test/fixtures/src/json-data.json: -------------------------------------------------------------------------------- 1 | { 2 | "foo": false, 3 | "bar": "baz" 4 | } 5 | -------------------------------------------------------------------------------- /test/coverage-test/fixtures/src/load-outside-vite.cjs: -------------------------------------------------------------------------------- 1 | module.exports = function noop() {} 2 | -------------------------------------------------------------------------------- /test/coverage-test/fixtures/src/multi-suite.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | func1(data: any[]) { 3 | return data 4 | }, 5 | 6 | func2(data: any[]) { 7 | return data 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /test/coverage-test/fixtures/src/pre-bundle/bundle.ts: -------------------------------------------------------------------------------- 1 | export * as first from "./first"; 2 | export * as second from "./second"; 3 | -------------------------------------------------------------------------------- /test/coverage-test/fixtures/src/pre-bundle/first.ts: -------------------------------------------------------------------------------- 1 | export function covered() { 2 | return "First"; 3 | } 4 | 5 | export function uncovered() { 6 | return "Uncovered"; 7 | } 8 | -------------------------------------------------------------------------------- /test/coverage-test/fixtures/src/pre-bundle/second.ts: -------------------------------------------------------------------------------- 1 | export function covered() { 2 | return "Second"; 3 | } 4 | 5 | export function uncovered() { 6 | return "Uncovered"; 7 | } 8 | -------------------------------------------------------------------------------- /test/coverage-test/fixtures/src/pre-transpiled/transpiled.d.ts: -------------------------------------------------------------------------------- 1 | export * from './original' 2 | -------------------------------------------------------------------------------- /test/coverage-test/fixtures/src/should-be-excluded-by-default.cts: -------------------------------------------------------------------------------- 1 | /* 2 | * Vite does not transform `*.cts` files. 3 | * If this file is picked by Istanbul provider, it will make Babel crash on TS syntax. 4 | */ 5 | interface Props { 6 | name: string; 7 | } 8 | -------------------------------------------------------------------------------- /test/coverage-test/fixtures/src/test-that-looks-like-source-file.ts: -------------------------------------------------------------------------------- 1 | import { test, expect } from 'vitest' 2 | import { sum } from "./math" 3 | 4 | test("run tests on file that looks like source file", () => { 5 | expect(sum(1,2)).toBe(3) 6 | }) -------------------------------------------------------------------------------- /test/coverage-test/fixtures/src/types-only.ts: -------------------------------------------------------------------------------- 1 | export type First = 'This' | 'file' | 'should' 2 | 3 | export type Second = 'be' | 'excluded' | 'from' | 'report' 4 | -------------------------------------------------------------------------------- /test/coverage-test/fixtures/src/uncovered.custom-1: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /test/coverage-test/fixtures/test/even.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | import { isEven } from '../src/even' 3 | 4 | test('isEven', () => { 5 | expect(isEven(6)).toBe(true) 6 | }) 7 | -------------------------------------------------------------------------------- /test/coverage-test/fixtures/test/file-to-change.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from 'vitest' 2 | import { run } from '../src/file-to-change' 3 | 4 | test('test case for changed file', () => { 5 | run() 6 | }) 7 | -------------------------------------------------------------------------------- /test/coverage-test/fixtures/test/ignore-hints-fixture.test.ts: -------------------------------------------------------------------------------- 1 | import { test, expect} from "vitest"; 2 | import { first, second } from '../src/ignore-hints'; 3 | 4 | test("cover some lines", () => { 5 | expect(first()).toBe("First") 6 | expect(second()).toBe("Second") 7 | }) -------------------------------------------------------------------------------- /test/coverage-test/fixtures/test/math.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | import { sum } from '../src/math' 3 | 4 | test('sum', () => { 5 | expect(sum(1, 2)).toBe(3) 6 | }) 7 | -------------------------------------------------------------------------------- /test/coverage-test/fixtures/test/merge-fixture-1.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | import { sum } from '../src/math' 3 | 4 | test('cover sum', () => { 5 | expect(sum(1, 2)).toBe(3) 6 | }) 7 | -------------------------------------------------------------------------------- /test/coverage-test/fixtures/test/merge-fixture-2.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | import { multiply } from '../src/math' 3 | 4 | test('cover multiply', () => { 5 | expect(multiply(3, 2)).toBe(6) 6 | }) 7 | -------------------------------------------------------------------------------- /test/coverage-test/fixtures/workspaces/custom-2/src/covered.custom-2: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/coverage-test/fixtures/workspaces/custom-2/src/uncovered.custom-2: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /test/coverage-test/test/multi-transform.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from '../utils' 2 | 3 | test('files transformed with multiple transform modes work (#3251)', async () => { 4 | // TODO 5 | }) 6 | -------------------------------------------------------------------------------- /test/coverage-test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "experimentalDecorators": true 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/dts-config/happy-dom-patch.ts: -------------------------------------------------------------------------------- 1 | // happy-dom's dts will break `skipLibCheck: false`. 2 | // for now, override happy-dom type for the sake of testing other packages. 3 | export const Window = {} as any 4 | -------------------------------------------------------------------------------- /test/dts-config/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@vitest/test-dts-config", 3 | "type": "module", 4 | "private": true, 5 | "scripts": { 6 | "test": "tsc -b" 7 | }, 8 | "devDependencies": { 9 | "vitest": "workspace:*" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /test/dts-config/tsconfig.patch.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "paths": { 4 | "happy-dom": ["./happy-dom-patch.ts"] 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/dts-config/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({}) 4 | -------------------------------------------------------------------------------- /test/dts-fixture/src/repro.ts: -------------------------------------------------------------------------------- 1 | import { test } from 'vitest' 2 | 3 | export const myTest = test.extend<{ now: number }>({ 4 | now: async ({}, use) => { 5 | await use(Date.now()) 6 | }, 7 | }) 8 | -------------------------------------------------------------------------------- /test/global-setup/index.html: -------------------------------------------------------------------------------- 1 | Hello Vitest 2 | -------------------------------------------------------------------------------- /test/optimize-deps/dep-url/index.js: -------------------------------------------------------------------------------- 1 | export const importMetaUrl = import.meta.url 2 | -------------------------------------------------------------------------------- /test/optimize-deps/dep-url/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@vitest/test-deps-url", 3 | "type": "module", 4 | "exports": "./index.js" 5 | } 6 | -------------------------------------------------------------------------------- /test/public-mocker/fixtures/automock/test.js: -------------------------------------------------------------------------------- 1 | export function calculate (a, b) { 2 | return a + b 3 | } 4 | -------------------------------------------------------------------------------- /test/public-mocker/fixtures/autospy/test.js: -------------------------------------------------------------------------------- 1 | export function calculate (a, b) { 2 | return a + b 3 | } 4 | -------------------------------------------------------------------------------- /test/public-mocker/fixtures/manual-mock/index.js: -------------------------------------------------------------------------------- 1 | import { mocker } from 'virtual:mocker' 2 | import { mocked } from './test' 3 | 4 | mocker.customMock(import('./test'), () => { 5 | return { mocked: true } 6 | }) 7 | 8 | document.querySelector('#mocked').textContent = mocked 9 | -------------------------------------------------------------------------------- /test/public-mocker/fixtures/manual-mock/test.js: -------------------------------------------------------------------------------- 1 | export const mocked = false 2 | -------------------------------------------------------------------------------- /test/public-mocker/fixtures/redirect/__mocks__/test.js: -------------------------------------------------------------------------------- 1 | export function calculate() { 2 | return 42 3 | } -------------------------------------------------------------------------------- /test/public-mocker/fixtures/redirect/index.js: -------------------------------------------------------------------------------- 1 | import { mocker } from 'virtual:mocker' 2 | import { calculate } from './test' 3 | 4 | mocker.customMock(import('./test')) 5 | 6 | document.querySelector('#mocked').textContent = calculate(1, 2) 7 | -------------------------------------------------------------------------------- /test/public-mocker/fixtures/redirect/test.js: -------------------------------------------------------------------------------- 1 | export function calculate (a, b) { 2 | return a + b 3 | } 4 | -------------------------------------------------------------------------------- /test/reporters/.gitignore: -------------------------------------------------------------------------------- 1 | sonar-config.xml -------------------------------------------------------------------------------- /test/reporters/fixtures/.gitignore: -------------------------------------------------------------------------------- 1 | html 2 | -------------------------------------------------------------------------------- /test/reporters/fixtures/all-passing-or-skipped.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('2 + 3 = 5', () => { 4 | expect(2 + 3).toBe(5) 5 | }) 6 | 7 | test.skip('3 + 3 = 6', () => { 8 | expect(3 + 3).toBe(6) 9 | }) 10 | -------------------------------------------------------------------------------- /test/reporters/fixtures/all-skipped.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test.todo('2 + 3 = 5', () => { 4 | expect(2 + 3).toBe(5) 5 | }) 6 | 7 | test.skip('3 + 3 = 6', () => { 8 | expect(3 + 3).toBe(6) 9 | }) 10 | -------------------------------------------------------------------------------- /test/reporters/fixtures/better-testsuite-name/space-1/test/base.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, test } from "vitest"; 2 | 3 | describe('space 1', () => { 4 | test('base', () => {}) 5 | }) 6 | -------------------------------------------------------------------------------- /test/reporters/fixtures/better-testsuite-name/space-2/test/base.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, test } from "vitest"; 2 | 3 | describe('space 2', () => { 4 | test('base', () => {}) 5 | }) 6 | -------------------------------------------------------------------------------- /test/reporters/fixtures/better-testsuite-name/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({ 4 | test: { 5 | projects: ['space-1', 'space-2'], 6 | }, 7 | }) 8 | -------------------------------------------------------------------------------- /test/reporters/fixtures/console-simple.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, expect, test } from 'vitest' 2 | 3 | test('test', () => { 4 | console.log('__test_stdout__') 5 | console.error('__test_stderr__') 6 | expect(0).toBe(0) 7 | }) 8 | -------------------------------------------------------------------------------- /test/reporters/fixtures/custom-diff-config.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('', () => { 4 | expect({ foo: 1 }).toMatchInlineSnapshot('xxx') 5 | }) 6 | -------------------------------------------------------------------------------- /test/reporters/fixtures/custom-diff-config.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | aAnnotation: 'Expected to be', 3 | bAnnotation: 'But got', 4 | } 5 | -------------------------------------------------------------------------------- /test/reporters/fixtures/custom-error/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({}) 4 | -------------------------------------------------------------------------------- /test/reporters/fixtures/default/MockReporter.ts: -------------------------------------------------------------------------------- 1 | import { DefaultReporter } from '../../../../packages/vitest/src/node/reporters/default' 2 | 3 | export default class MockDefaultReporter extends DefaultReporter { 4 | isTTY = true 5 | } 6 | -------------------------------------------------------------------------------- /test/reporters/fixtures/duration/basic.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from 'vitest'; 2 | 3 | test('fast', () => { 4 | }); 5 | 6 | test('slow', async () => { 7 | await sleep(300) 8 | }); 9 | 10 | const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms)) 11 | -------------------------------------------------------------------------------- /test/reporters/fixtures/duration/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({ 4 | test: { 5 | slowTestThreshold: 290 6 | } 7 | }) 8 | -------------------------------------------------------------------------------- /test/reporters/fixtures/error-to-json.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from "vitest"; 2 | 3 | test("error serialization with toJSON", () => { 4 | throw Object.assign(new Error("hello"), { date: new Date(0) }) 5 | }) 6 | -------------------------------------------------------------------------------- /test/reporters/fixtures/import-durations-25ms-throws.ts: -------------------------------------------------------------------------------- 1 | await new Promise(resolve => setTimeout(resolve, 25)) 2 | 3 | throw new Error('test') 4 | 5 | export {} 6 | -------------------------------------------------------------------------------- /test/reporters/fixtures/import-durations-25ms.ts: -------------------------------------------------------------------------------- 1 | await new Promise(resolve => setTimeout(resolve, 25)) 2 | 3 | export {} 4 | -------------------------------------------------------------------------------- /test/reporters/fixtures/import-durations-50ms.ts: -------------------------------------------------------------------------------- 1 | import './import-durations-25ms' 2 | 3 | await new Promise(resolve => setTimeout(resolve, 50)) 4 | -------------------------------------------------------------------------------- /test/reporters/fixtures/import-durations-throws.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | import './import-durations-25ms-throws' 3 | 4 | test('works', async () => { 5 | expect(true).toBe(true) 6 | }) 7 | -------------------------------------------------------------------------------- /test/reporters/fixtures/import-durations.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | import './import-durations-50ms' 3 | 4 | test('works', async () => { 5 | expect(true).toBe(true) 6 | }) 7 | -------------------------------------------------------------------------------- /test/reporters/fixtures/invalid-diff-config.ts: -------------------------------------------------------------------------------- 1 | export const diffOptions = {} 2 | -------------------------------------------------------------------------------- /test/reporters/fixtures/json-fail-import.test.ts: -------------------------------------------------------------------------------- 1 | throw new Error('failed test suite') 2 | -------------------------------------------------------------------------------- /test/reporters/fixtures/long-loading-task.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from 'vitest' 2 | 3 | await new Promise(r => setTimeout(r, 500)) 4 | 5 | test('works') 6 | -------------------------------------------------------------------------------- /test/reporters/fixtures/many-errors/basic.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from "vitest" 2 | 3 | test.for([...Array(20)].map((_, j) => j))('%i', (i) => { 4 | throw new Error(`error-${i}`) 5 | }) 6 | -------------------------------------------------------------------------------- /test/reporters/fixtures/merge-reports/vitest.config.js: -------------------------------------------------------------------------------- 1 | export default {} 2 | -------------------------------------------------------------------------------- /test/reporters/fixtures/ok.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from "vitest" 2 | 3 | test("ok", () => {}); 4 | -------------------------------------------------------------------------------- /test/reporters/fixtures/project-name/example.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from "vitest"; 2 | 3 | test("example test", () => { 4 | // 5 | }) -------------------------------------------------------------------------------- /test/reporters/fixtures/repeats.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('repeat couple of times',{ repeats: 3 }, () => { 4 | expect(true).toBe(true) 5 | }) 6 | -------------------------------------------------------------------------------- /test/reporters/fixtures/retry.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | let number = 0 4 | 5 | test('pass after retries', () => { 6 | expect(number++).toBe(3) 7 | }) 8 | -------------------------------------------------------------------------------- /test/reporters/fixtures/some-failing.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('2 + 3 = 5', () => { 4 | expect(2 + 3).toBe(5) 5 | }) 6 | 7 | test('3 + 3 = 7', () => { 8 | expect(3 + 3).toBe(7) 9 | }) 10 | -------------------------------------------------------------------------------- /test/reporters/fixtures/suite-hook-failure/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({}) 4 | -------------------------------------------------------------------------------- /test/reporters/fixtures/verbose/example-2.test.ts: -------------------------------------------------------------------------------- 1 | import { test, describe } from "vitest"; 2 | 3 | test("test 0.1", () => {}); 4 | 5 | test.skip("test 0.2", () => {}); 6 | 7 | describe("suite 1.1", () => { 8 | test("test 1.1", () => {}); 9 | }); 10 | -------------------------------------------------------------------------------- /test/reporters/fixtures/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({ 4 | }) 5 | -------------------------------------------------------------------------------- /test/reporters/fixtures/with-syntax-error.test.js: -------------------------------------------------------------------------------- 1 | // NOTE: This file is intentionally not valid JavaScript. 2 | 3 | it('should fail', () => { 4 | ) 5 | -------------------------------------------------------------------------------- /test/reporters/reportPkg/index.js: -------------------------------------------------------------------------------- 1 | export default class PackageReporter { 2 | onInit(ctx) { 3 | this.ctx = ctx 4 | } 5 | 6 | onFinished() { 7 | this.ctx.logger.log('hello from package reporter') 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/reporters/reportPkg/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pkg-reporter", 3 | "main": "./index.js" 4 | } 5 | -------------------------------------------------------------------------------- /test/reporters/src/custom-reporter.js: -------------------------------------------------------------------------------- 1 | export default class TestReporter { 2 | onInit(ctx) { 3 | this.ctx = ctx 4 | } 5 | 6 | onFinished() { 7 | this.ctx.logger.log('hello from custom reporter') 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/reporters/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "include": ["./tests/**/*.test-d.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /test/reporters/without-custom-reporter.vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({ 4 | test: { 5 | include: ['tests/reporters.spec.ts'], 6 | }, 7 | }) 8 | -------------------------------------------------------------------------------- /test/snapshots/test/fixtures/custom-serializers/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "vitest/config"; 2 | 3 | export default defineConfig({ 4 | test: { 5 | snapshotSerializers: ['./serializer-1.js', './serializer-2.ts'] 6 | } 7 | }) 8 | -------------------------------------------------------------------------------- /test/snapshots/test/fixtures/custom-snapshot-environment/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config'; 2 | 3 | export default defineConfig({ 4 | test: { 5 | snapshotEnvironment: './snapshot-environment.ts' 6 | } 7 | }) -------------------------------------------------------------------------------- /test/snapshots/test/fixtures/file/snapshot-1.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | white space 4 | -------------------------------------------------------------------------------- /test/snapshots/test/fixtures/file/snapshot-2.txt: -------------------------------------------------------------------------------- 1 | example: | 2 | { 3 | echo "hello" 4 | } 5 | some: 6 | nesting: 7 | - "hello world" 8 | even: 9 | more: 10 | nesting: true 11 | -------------------------------------------------------------------------------- /test/snapshots/test/fixtures/indent/__snapshots__/basic.test.ts.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html 2 | 3 | exports[`toMatchSnapshot string 1`] = ` 4 | " 5 | 1111 6 | xxxx { 7 | } 8 | 9 | " 10 | `; 11 | -------------------------------------------------------------------------------- /test/snapshots/test/fixtures/inline-multiple-calls/different.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('single', () => { 4 | for (const value of ["test1", "test2"]) { 5 | expect(value).toMatchInlineSnapshot() 6 | } 7 | }) 8 | -------------------------------------------------------------------------------- /test/snapshots/test/fixtures/inline-multiple-calls/same.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('single', () => { 4 | for (const value of ["test1", "test1"]) { 5 | expect(value).toMatchInlineSnapshot(`"test1"`) 6 | } 7 | }) 8 | -------------------------------------------------------------------------------- /test/snapshots/test/fixtures/jest-image-snapshot/test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/test/snapshots/test/fixtures/jest-image-snapshot/test.png -------------------------------------------------------------------------------- /test/snapshots/test/fixtures/skip-test/__snapshots__/repro.test.ts.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html 2 | 3 | exports[`repro suite > inner case 1`] = `"hi-1"`; 4 | 5 | exports[`top-level case 1`] = `"hi-2"`; 6 | -------------------------------------------------------------------------------- /test/snapshots/test/fixtures/skip-test/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({}) 4 | -------------------------------------------------------------------------------- /test/snapshots/test/fixtures/summary-removed/.gitignore: -------------------------------------------------------------------------------- 1 | __snapshots__ 2 | -------------------------------------------------------------------------------- /test/snapshots/test/fixtures/summary-removed/basic.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('x', () => { 4 | expect(0).toMatchSnapshot() 5 | }) 6 | 7 | // REMOVE-START 8 | test('y', () => { 9 | expect(0).toMatchSnapshot() 10 | }) 11 | // REMOVE-END 12 | -------------------------------------------------------------------------------- /test/snapshots/test/fixtures/summary/vitest.config.ts: -------------------------------------------------------------------------------- 1 | export default {} 2 | -------------------------------------------------------------------------------- /test/snapshots/test/fixtures/test-update/__snapshots__/same-title-file.test.js.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html 2 | 3 | exports[`same title exist 1`] = `"a"`; 4 | 5 | exports[`same title exist 2`] = `"wrong"`; 6 | -------------------------------------------------------------------------------- /test/snapshots/test/fixtures/workspace/packages/space/test/__snapshots__/basic.test.ts.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html 2 | 3 | exports[`basic 1`] = `1`; 4 | -------------------------------------------------------------------------------- /test/snapshots/test/fixtures/workspace/packages/space/test/basic.test.ts: -------------------------------------------------------------------------------- 1 | import { test, expect } from "vitest" 2 | 3 | test("basic", () => { 4 | expect(1).toMatchSnapshot() 5 | }) 6 | -------------------------------------------------------------------------------- /test/snapshots/test/fixtures/workspace/packages/space/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineProject } from 'vitest/config' 2 | 3 | export default defineProject({ 4 | test: {}, 5 | }) 6 | -------------------------------------------------------------------------------- /test/snapshots/test/fixtures/workspace/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig, defineWorkspace } from 'vitest/config' 2 | 3 | export default defineConfig({ 4 | test: { 5 | projects: ['packages/*'], 6 | }, 7 | }) 8 | -------------------------------------------------------------------------------- /test/test-utils/fixtures/external-math.ts: -------------------------------------------------------------------------------- 1 | export function sum(a: number, b: number) { 2 | return a + b 3 | } 4 | 5 | export function multiply(a: number, b: number) { 6 | return a * b 7 | } 8 | -------------------------------------------------------------------------------- /test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.base.json", 3 | "compilerOptions": { 4 | "types": [ 5 | "node", 6 | "vite/client" 7 | ] 8 | }, 9 | "include": [ 10 | "./**/*.ts" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /test/typescript/failing/expect-error.test-d.ts: -------------------------------------------------------------------------------- 1 | import { expectTypeOf, test } from 'vitest' 2 | 3 | // 4 | test('failing test with expect-error', () => { 5 | // @ts-expect-error expect nothing 6 | expectTypeOf(1).toEqualTypeOf() 7 | }) 8 | -------------------------------------------------------------------------------- /test/typescript/failing/js-fail.test-d.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | 3 | import { expectTypeOf, test } from 'vitest' 4 | 5 | test('js test fails', () => { 6 | expectTypeOf(1).toBeArray() 7 | }) 8 | -------------------------------------------------------------------------------- /test/typescript/failing/only.test-d.ts: -------------------------------------------------------------------------------- 1 | import { expectTypeOf, test } from 'vitest' 2 | 3 | test.only('failing test', () => { 4 | expectTypeOf(1).toEqualTypeOf() 5 | }) 6 | -------------------------------------------------------------------------------- /test/typescript/fixtures/dynamic-title/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({ 4 | test: { 5 | typecheck: { 6 | enabled: true, 7 | tsconfig: './tsconfig.json', 8 | }, 9 | }, 10 | }) 11 | -------------------------------------------------------------------------------- /test/typescript/fixtures/source-error/src/not-ok.ts: -------------------------------------------------------------------------------- 1 | thisIsSourceError 2 | -------------------------------------------------------------------------------- /test/typescript/fixtures/source-error/test/ok.test-d.ts: -------------------------------------------------------------------------------- 1 | import { expectTypeOf, test } from 'vitest' 2 | 3 | test('ok', () => { 4 | expectTypeOf(1).toEqualTypeOf(2) 5 | }) 6 | -------------------------------------------------------------------------------- /test/typescript/fixtures/source-error/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({ 4 | test: { 5 | typecheck: { 6 | enabled: true, 7 | }, 8 | }, 9 | }) 10 | -------------------------------------------------------------------------------- /test/typescript/test-d/js.test-d.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | 3 | import { expectTypeOf, test } from 'vitest' 4 | 5 | test('js test also works', () => { 6 | expectTypeOf(1).toEqualTypeOf(2) 7 | }) 8 | -------------------------------------------------------------------------------- /test/typescript/test-d/nested-suite1.test-d.ts: -------------------------------------------------------------------------------- 1 | import { describe, test } from 'vitest' 2 | 3 | describe('suite-A', () => { 4 | describe('suite-B', () => { 5 | test('case-X', () => { 6 | }) 7 | }) 8 | }) 9 | 10 | test('case-Y', () => { 11 | }) 12 | -------------------------------------------------------------------------------- /test/typescript/tsconfig.custom.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "include": [ 4 | "**/fail.test-d.ts" 5 | ], 6 | "exclude": [ 7 | "**/dist/**" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /test/typescript/tsconfig.empty.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "include": [ 4 | "src" 5 | ], 6 | "exclude": [ 7 | "**/dist/**" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /test/typescript/tsconfig.fails.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "include": [ 4 | "./failing/*" 5 | ], 6 | "exclude": [ 7 | "**/dist/**" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /test/typescript/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "include": [ 4 | "./**/*.ts", 5 | "./**/*.js" 6 | ], 7 | "exclude": [ 8 | "**/dist/**", 9 | "**/fixtures/**" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /test/ui/.gitignore: -------------------------------------------------------------------------------- 1 | html 2 | test-results 3 | -------------------------------------------------------------------------------- /test/ui/fixtures/coverage.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, it } from 'vitest' 2 | import { multiply } from './coverage' 3 | 4 | it(multiply, () => { 5 | expect(multiply(2, 3)).toEqual(6) 6 | }) 7 | -------------------------------------------------------------------------------- /test/ui/fixtures/coverage.ts: -------------------------------------------------------------------------------- 1 | export function multiply(n: number, m: number) { 2 | return n * m; 3 | } 4 | -------------------------------------------------------------------------------- /test/ui/fixtures/cute-puppy.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitest-dev/vitest/35e313f8c92bb839e295adfc15d4afe2aea4753a/test/ui/fixtures/cute-puppy.jpg -------------------------------------------------------------------------------- /test/ui/fixtures/error.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, it } from "vitest" 2 | 3 | // https://github.com/vitest-dev/vitest/issues/5321 4 | it('escape html in error diff', () => { 5 | expect('').toBe("") 6 | }) 7 | -------------------------------------------------------------------------------- /test/ui/fixtures/example.txt: -------------------------------------------------------------------------------- 1 | hello world 2 | -------------------------------------------------------------------------------- /test/ui/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({ 4 | test: { 5 | dir: './fixtures', 6 | environment: 'happy-dom', 7 | coverage: { 8 | reportOnFailure: true, 9 | }, 10 | }, 11 | }) 12 | -------------------------------------------------------------------------------- /test/vite-node/.env.local: -------------------------------------------------------------------------------- 1 | MY_TEST_ENV=hello -------------------------------------------------------------------------------- /test/vite-node/src/buildStart/test.ts: -------------------------------------------------------------------------------- 1 | export default 'test' 2 | -------------------------------------------------------------------------------- /test/vite-node/src/circular1/a.ts: -------------------------------------------------------------------------------- 1 | export function a() { 2 | return 'A' 3 | } 4 | -------------------------------------------------------------------------------- /test/vite-node/src/circular1/b.ts: -------------------------------------------------------------------------------- 1 | import { foo } from '.' 2 | 3 | export function b() { 4 | return `B${foo()}` 5 | } 6 | -------------------------------------------------------------------------------- /test/vite-node/src/circular2/a.ts: -------------------------------------------------------------------------------- 1 | import { c } from './reg' 2 | 3 | await new Promise(resolve => setTimeout(resolve, 10)) 4 | 5 | export const a = `a${c}` 6 | -------------------------------------------------------------------------------- /test/vite-node/src/circular2/b.ts: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line unused-imports/no-unused-imports 2 | import { a } from './a' 3 | 4 | await new Promise(resolve => setTimeout(resolve, 10)) 5 | 6 | export const b = 'b' 7 | -------------------------------------------------------------------------------- /test/vite-node/src/circular2/c.ts: -------------------------------------------------------------------------------- 1 | export const c = 'c' 2 | 3 | await new Promise(resolve => setTimeout(resolve, 10)) 4 | -------------------------------------------------------------------------------- /test/vite-node/src/circular2/index.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-console */ 2 | import { a } from './a' 3 | import { b } from './b' 4 | 5 | /** 6 | * index -> a -> b 7 | * ^ ^v 8 | * reg -> c 9 | */ 10 | 11 | console.log(a, b) 12 | -------------------------------------------------------------------------------- /test/vite-node/src/circular2/reg.ts: -------------------------------------------------------------------------------- 1 | export { a } from './a' 2 | 3 | await new Promise(resolve => setTimeout(resolve, 20)) 4 | 5 | export { b } from './b' 6 | export { c } from './c' 7 | -------------------------------------------------------------------------------- /test/vite-node/src/cli-parse-args.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line no-console 2 | console.log(process.argv) 3 | -------------------------------------------------------------------------------- /test/vite-node/src/cli-print-env.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line no-console 2 | console.log(JSON.stringify(process.env, null, 2)) 3 | -------------------------------------------------------------------------------- /test/vite-node/src/deps.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | } 4 | -------------------------------------------------------------------------------- /test/vite-node/src/foo.js: -------------------------------------------------------------------------------- 1 | export function add(a, b) { 2 | return a + b 3 | } 4 | -------------------------------------------------------------------------------- /test/vite-node/src/hmr-script.js: -------------------------------------------------------------------------------- 1 | console.error('Hello!') 2 | 3 | if (import.meta.hot) { 4 | import.meta.hot.accept(() => { 5 | console.error('Accept') 6 | }) 7 | } 8 | -------------------------------------------------------------------------------- /test/vite-node/src/self-export-example2.ts: -------------------------------------------------------------------------------- 1 | import ansiEscapes, { HelloWorld } from './self-export' 2 | 3 | // eslint-disable-next-line no-console 4 | console.log(ansiEscapes, HelloWorld) 5 | -------------------------------------------------------------------------------- /test/vite-node/src/self-export.d.ts: -------------------------------------------------------------------------------- 1 | declare const ansiEscapes: { 2 | HelloWorld: number 3 | } 4 | export default ansiEscapes 5 | 6 | declare const HelloWorld: number 7 | export { HelloWorld } 8 | -------------------------------------------------------------------------------- /test/vite-node/src/self-export.js: -------------------------------------------------------------------------------- 1 | const ansiEscapes = module.exports 2 | module.exports.default = ansiEscapes 3 | ansiEscapes.HelloWorld = 1 4 | -------------------------------------------------------------------------------- /test/vite-node/src/testMod.ts: -------------------------------------------------------------------------------- 1 | export const a = 'hello testModule' 2 | 3 | // eslint-disable-next-line no-console 4 | console.log('[testModule.js] load!') 5 | 6 | import('./deps') 7 | -------------------------------------------------------------------------------- /test/vite-node/src/watch/index.cjs: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line no-console 2 | console.log('test 1') 3 | -------------------------------------------------------------------------------- /test/vite-node/src/watch/index.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line no-console 2 | console.log('test 1') 3 | -------------------------------------------------------------------------------- /test/vite-node/src/watch/index.mjs: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line no-console 2 | console.log('test 1') 3 | -------------------------------------------------------------------------------- /test/watch/.gitignore: -------------------------------------------------------------------------------- 1 | fixtures/test-results -------------------------------------------------------------------------------- /test/watch/fixtures/42.txt: -------------------------------------------------------------------------------- 1 | 42 2 | -------------------------------------------------------------------------------- /test/watch/fixtures/example.ts: -------------------------------------------------------------------------------- 1 | export function getHelloWorld() { 2 | return 'Hello world' 3 | } 4 | -------------------------------------------------------------------------------- /test/watch/fixtures/force-watch/trigger.js: -------------------------------------------------------------------------------- 1 | export const trigger = false 2 | -------------------------------------------------------------------------------- /test/watch/fixtures/math.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | import { sum } from './math' 4 | 5 | test('sum', () => { 6 | expect(sum(1, 2)).toBe(3) 7 | }) 8 | -------------------------------------------------------------------------------- /test/watch/fixtures/math.ts: -------------------------------------------------------------------------------- 1 | export function sum(a: number, b: number) { 2 | return a + b 3 | } 4 | -------------------------------------------------------------------------------- /test/watch/fixtures/single-failed/basic.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, it } from 'vitest'; 2 | 3 | it('works correctly', () => { 4 | console.log('log basic') 5 | expect(1).toBe(1) 6 | }) 7 | -------------------------------------------------------------------------------- /test/watch/fixtures/single-failed/failed.test.ts: -------------------------------------------------------------------------------- 1 | import { it } from 'vitest'; 2 | 3 | it('fails', () => { 4 | console.log('log fail') 5 | throw new Error('failed') 6 | }) 7 | -------------------------------------------------------------------------------- /test/workspaces-browser/.gitignore: -------------------------------------------------------------------------------- 1 | results.json -------------------------------------------------------------------------------- /test/workspaces-browser/space_1/test/math.spec.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | import { sum } from '../../src/math' 3 | 4 | test('3 + 3 = 6', () => { 5 | expect(sum(3, 3)).toBe(6) 6 | }) 7 | -------------------------------------------------------------------------------- /test/workspaces-browser/space_1/test/node.spec.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('window is undefined', () => { 4 | expect(globalThis.window).toBeUndefined() 5 | }) 6 | -------------------------------------------------------------------------------- /test/workspaces-browser/space_1/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineProject } from 'vitest/config' 2 | 3 | export default defineProject({ 4 | test: { 5 | name: 'space_1', 6 | }, 7 | }) 8 | -------------------------------------------------------------------------------- /test/workspaces-browser/space_1/vitest.config.ts.timestamp-4345324-324424.mjs: -------------------------------------------------------------------------------- 1 | import { defineProject } from 'vitest/config' 2 | 3 | export default defineProject({ 4 | test: { 5 | name: 'space_1', 6 | environment: 'happy-dom', 7 | }, 8 | }) 9 | -------------------------------------------------------------------------------- /test/workspaces-browser/space_browser/test/browser.spec.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('window is not defined', () => { 4 | expect(typeof window).toBe('object') 5 | }) 6 | -------------------------------------------------------------------------------- /test/workspaces-browser/space_browser_inline/test-alias-to.ts: -------------------------------------------------------------------------------- 1 | export default 'hello' 2 | -------------------------------------------------------------------------------- /test/workspaces/.env.local: -------------------------------------------------------------------------------- 1 | VITE_MY_TEST_VARIABLE=core 2 | VITE_CORE_VARIABLE=core 3 | CUSTOM_ROOT=custom 4 | ROOT_VARIABLE=root -------------------------------------------------------------------------------- /test/workspaces/.gitignore: -------------------------------------------------------------------------------- 1 | results.json -------------------------------------------------------------------------------- /test/workspaces/coverage-report-tests/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config' 2 | 3 | export default defineConfig({ 4 | test: { 5 | include: ['./check-coverage.test.ts'], 6 | }, 7 | }) 8 | -------------------------------------------------------------------------------- /test/workspaces/cwdPlugin.d.ts: -------------------------------------------------------------------------------- 1 | import type { Plugin } from 'vite' 2 | 3 | export function cwdPlugin(name: string): Plugin 4 | -------------------------------------------------------------------------------- /test/workspaces/space_1/.env.local: -------------------------------------------------------------------------------- 1 | VITE_MY_TEST_VARIABLE=local 2 | CUSTOM_MY_TEST_VARIABLE=custom -------------------------------------------------------------------------------- /test/workspaces/space_1/test/happy-dom.spec.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('window is defined', () => { 4 | expect(window).toBeDefined() 5 | }) 6 | -------------------------------------------------------------------------------- /test/workspaces/space_1/test/math.spec.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | import { sum } from '../../src/math' 3 | 4 | test('3 + 3 = 6', () => { 5 | expect(sum(3, 3)).toBe(6) 6 | }) 7 | -------------------------------------------------------------------------------- /test/workspaces/space_1/vite.config.ts.timestamp-4345324-324424.mjs: -------------------------------------------------------------------------------- 1 | import { defineProject } from 'vitest/config' 2 | 3 | export default defineProject({ 4 | test: { 5 | name: 'space_1', 6 | environment: 'happy-dom', 7 | }, 8 | }) 9 | -------------------------------------------------------------------------------- /test/workspaces/space_2/test/node.spec.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest' 2 | 3 | test('window is not defined', () => { 4 | expect(typeof window).toBe('undefined') 5 | }) 6 | -------------------------------------------------------------------------------- /test/workspaces/space_3/fake-vitest/config.js: -------------------------------------------------------------------------------- 1 | exports.defineProject = (c) => { 2 | return c 3 | } 4 | -------------------------------------------------------------------------------- /test/workspaces/space_3/fake-vitest/index.js: -------------------------------------------------------------------------------- 1 | throw new Error('should not import from fake vitest') 2 | -------------------------------------------------------------------------------- /test/workspaces/space_3/fake-vitest/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vitest", 3 | "type": "commonjs", 4 | "exports": { 5 | ".": "./index.js", 6 | "./config": "./config.js" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/workspaces/space_3/localSetup.ts: -------------------------------------------------------------------------------- 1 | import type { GlobalSetupContext } from 'vitest/node' 2 | 3 | export function setup({ provide }: GlobalSetupContext) { 4 | provide('globalSetupOverridden', true) 5 | } 6 | -------------------------------------------------------------------------------- /test/workspaces/space_3/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@vitest/space_3", 3 | "private": true, 4 | "scripts": { 5 | "test": "vitest" 6 | }, 7 | "dependencies": { 8 | "vitest": "link:./fake-vitest" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /test/workspaces/space_3/src/multiply.ts: -------------------------------------------------------------------------------- 1 | export function multiple(a: number, b: number) { 2 | return a * b 3 | } 4 | -------------------------------------------------------------------------------- /test/workspaces/space_shared/setup.jsdom.ts: -------------------------------------------------------------------------------- 1 | Object.defineProperty(globalThis, 'testValue', { value: 'jsdom' }) 2 | -------------------------------------------------------------------------------- /test/workspaces/space_shared/setup.node.ts: -------------------------------------------------------------------------------- 1 | Object.defineProperty(globalThis, 'testValue', { value: 'node' }) 2 | -------------------------------------------------------------------------------- /tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.base.json", 3 | "compilerOptions": { 4 | "paths": { 5 | "vitest": ["./packages/vitest/dist/index.d.ts"] 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /vitest.workspace.vscode.ts: -------------------------------------------------------------------------------- 1 | import { defineWorkspace } from 'vitest/config' 2 | 3 | export default defineWorkspace([ 4 | './test/core', 5 | './test/cli', 6 | './test/config', 7 | ]) 8 | --------------------------------------------------------------------------------