import { fileURLToPath } from 'node:url' import { describe, it, expect } from 'vitest' import { setup } from '@nuxt/test-utils/e2e' import { useNuxt } from '@nuxt/kit' const logs: string[] = [] Object.defineProperty(console, 'log', { get() { return (...args: string[]) => logs.push( args .join(' ') // eslint-disable-next-line no-control-regex .replace(/\u001B\[\d+m/g, ''), ) }, set() {}, }) await setup({ rootDir: fileURLToPath(new URL('../playground', import.meta.url)), build: true, nuxtConfig: { vite: { $client: { build: { rollupOptions: { output: { chunkFileNames: '_nuxt/[name].js', entryFileNames: '_nuxt/[name].js', }, }, }, }, }, hooks: { 'modules:before'() { const nuxt = useNuxt() nuxt.options.nitro.prerender = { routes: ['/'] } }, }, }, }) describe('nuxt-capo', async () => { it('shows logs when prerendering', async () => { expect(logs).toMatchInlineSnapshot(` [ "> [capo] actual \`
\` order for \`/\`: ████████", "", "█ 11 ", "█ 11 ", "█ 10