--- title: "Test Your Module" description: "Learn how to test your Nuxt module with unit, integration and E2E tests." --- Testing helps ensure your module works as expected given various setups. Find in this section how to perform various kinds of tests against your module. ## Write Unit Tests ::tip We're still discussing and exploring how to ease unit and integration testing on Nuxt modules. :br :br [Check out this RFC to join the conversation](https://github.com/nuxt/nuxt/discussions/18399). :: ## Write E2E Tests [Nuxt Test Utils](/docs/4.x/getting-started/testing) is the go-to library to help you test your module in an end-to-end way. Here's the workflow to adopt with it: 1. Create a Nuxt application to be used as a "fixture" inside `test/fixtures/*` 2. Setup Nuxt with this fixture inside your test file 3. Interact with the fixture using utilities from `@nuxt/test-utils` (e.g. fetching a page) 4. Perform checks related to this fixture (e.g. "HTML contains ...") 5. Repeat In practice, the fixture: ```ts [test/fixtures/ssr/nuxt.config.ts] // 1. Create a Nuxt application to be used as a "fixture" import MyModule from '../../../src/module' export default defineNuxtConfig({ ssr: true, modules: [ MyModule, ], }) ``` And its test: ```ts [test/rendering.ts] import { describe, expect, it } from 'vitest' import { fileURLToPath } from 'node:url' import { $fetch, setup } from '@nuxt/test-utils/e2e' describe('ssr', async () => { // 2. Setup Nuxt with this fixture inside your test file await setup({ rootDir: fileURLToPath(new URL('./fixtures/ssr', import.meta.url)), }) it('renders the index page', async () => { // 3. Interact with the fixture using utilities from `@nuxt/test-utils` const html = await $fetch('/') // 4. Perform checks related to this fixture expect(html).toContain('