clone options to prevent unwanted side-effects

fixes with-config test that runs nuxt twice with same nuxt.config.js file
This commit is contained in:
Pooya Parsa 2017-06-14 03:22:30 +04:30
parent 76c3b358cc
commit b61694ca21
2 changed files with 5 additions and 1 deletions

View File

@ -11,9 +11,12 @@ import Server from './server'
import Defaults from './defaults'
export default class Nuxt extends Tapable {
constructor (options = {}) {
constructor (_options = {}) {
super()
// Clone options to prevent unwanted side-effects
const options = Object.assign({}, _options)
// Normalize options
if (options.loading === true) {
delete options.loading

View File

@ -111,4 +111,5 @@ test.after('Should be able to start Nuxt with build done', async t => {
config.rootDir = rootDir
config.dev = false
nuxt = new Nuxt(config)
await nuxt.init()
})