mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-12 00:53:55 +00:00
dec8f99fc3
Co-authored-by: Clark Du <clark.duxin@gmail.com>
28 lines
694 B
JavaScript
28 lines
694 B
JavaScript
import { resolve } from 'path'
|
|
import env from 'std-env'
|
|
|
|
const isWin = env.windows
|
|
|
|
const rootDir = isWin ? '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))
|
|
}
|