Nuxt/test/utils/index.js
2018-03-19 15:05:02 +08:00

25 lines
592 B
JavaScript

import path from 'path'
import fs from 'fs'
// import _getPort from 'get-port'
import { defaultsDeep } from 'lodash'
import { requireModule } from '../../lib/common/module'
export function loadFixture(fixture, overrides) {
const rootDir = path.resolve(__dirname, '../fixtures/' + fixture)
const configFile = path.resolve(rootDir, 'nuxt.config.js')
const config = fs.existsSync(configFile) ? requireModule(configFile) : {}
config.rootDir = rootDir
config.dev = false
return defaultsDeep({}, overrides, config)
}
let port = 4000
export function getPort() {
return port++
}