From b61694ca219bc8def106aabdc2d5c0ad4e4686c0 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Wed, 14 Jun 2017 03:22:30 +0430 Subject: [PATCH] clone options to prevent unwanted side-effects fixes with-config test that runs nuxt twice with same nuxt.config.js file --- lib/nuxt.js | 5 ++++- test/with-config.test.js | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/nuxt.js b/lib/nuxt.js index 93ee1499cc..6a6fbed55c 100644 --- a/lib/nuxt.js +++ b/lib/nuxt.js @@ -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 diff --git a/test/with-config.test.js b/test/with-config.test.js index 07c299f245..41fb678f42 100644 --- a/test/with-config.test.js +++ b/test/with-config.test.js @@ -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() })