Nuxt/test/utils/index.js

23 lines
576 B
JavaScript
Raw Normal View History

2018-03-18 23:41:14 +00:00
import path from 'path'
import fs from 'fs'
import _getPort from 'get-port'
2018-03-19 04:21:04 +00:00
import { defaultsDeep } from 'lodash'
2018-03-18 23:41:14 +00:00
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
2018-03-19 04:21:04 +00:00
return defaultsDeep({}, overrides, config)
2018-03-18 23:41:14 +00:00
}
export function getPort() {
return _getPort()
2018-03-18 23:41:14 +00:00
}