Nuxt/packages/generator/test/__utils__/index.js
renovate[bot] c7ea13ea9f
feat: update std-env to v3 (#10012) [release]
Co-authored-by: Pooya Parsa <pyapar@gmail.com>
2021-11-03 18:46:49 +01:00

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))
}