//nuxt-bridge-vitestbywattanx

nuxt-bridge-vitest

Make some features of nuxt-vitest available in nuxt bridge as well.

5
0
5
13
TypeScript

nuxt bridge vitest

[!WARNING]
This library is in active development and you should pin the patch version before using.

Supporting nuxt bridge testing in the vitest environment.

▶️ Playground

Installation

  1. First install nuxt-vitest:
pnpm add -D @wattanx/nuxt-bridge-vitest vitest happy-dom

# or
yarn add --dev @wattanx/nuxt-bridge-vitest vitest happy-dom
npm i -D @wattanx/nuxt-bridge-vitest vitest happy-dom
  1. Then create a vitest.config.ts with the following content:
import { defineVitestConfig } from "@wattanx/nuxt-bridge-vitest/config";

export default defineVitestConfig({
  // any custom vitest config you require
});

Helpers

Currently only mockNuxtImport is supported.

mockNuxtImport

The basic usage is the same as @nuxt/test-utils.

https://nuxt.com/docs/getting-started/testing#mocknuxtimport

[beta]v0.14.0