doc-vitest icon indicating copy to clipboard operation
doc-vitest copied to clipboard

Add example for Nuxt

Open Rednas83 opened this issue 1 year ago • 1 comments

I would like to try it with nuxt.

Can the setup be done with nuxt.config.ts?

Tried:

import { doctest } from 'vite-plugin-doctest';
export default defineNuxtConfig({
  plugins: [doctest({ /* options */ })],
  test: {
    includeSource: [
      './src/**/*.[jt]s?(x)',
      './**/*.md', // You can disable markdown test by removing this line
    ],
  },
})

But it returns an error image

Rednas83 avatar Jul 19 '24 11:07 Rednas83

If you want to use vitest at Nuxt project, you should put a vitest.config.ts (official document). And, you can configuration testing at vitest.config.ts.

Here is the example! https://stackblitz.com/edit/nuxt-doctest?file=vitest.config.ts,functions%2Fsome-function.ts

fyi: vite-plugin-doctest cannot test comment in .vue files.

ssssota avatar Jul 19 '24 14:07 ssssota