mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
c7ea13ea9f
Co-authored-by: Pooya Parsa <pyapar@gmail.com>
26 lines
681 B
JavaScript
26 lines
681 B
JavaScript
import { resolve } from 'path'
|
|
import { isWindows } from 'std-env'
|
|
|
|
const rootDir = isWindows ? 'C:\\nuxt' : '/var/nuxt'
|
|
|
|
export const createNuxt = () => ({
|
|
ready: jest.fn(),
|
|
callHook: jest.fn(),
|
|
server: {
|
|
renderRoute: jest.fn(() => ({ html: 'rendered html' }))
|
|
},
|
|
options: {
|
|
mode: 'universal',
|
|
srcDir: resolve(rootDir, 'src'),
|
|
buildDir: resolve(rootDir, 'build'),
|
|
generate: { dir: resolve(rootDir, 'generate') },
|
|
build: { publicPath: '__public' },
|
|
dir: { static: resolve(rootDir, 'static') },
|
|
render: {}
|
|
}
|
|
})
|
|
|
|
export function hookCalls (nuxt, name) {
|
|
return nuxt.callHook.mock.calls.filter(c => c[0] === name).map(c => c.splice(1))
|
|
}
|