mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 16:43:55 +00:00
cb18aa6f53
After #3564 and the request of #3427 (plus #3452) I decided to add a dedicated `vueConfig`object to the `nuxt.config.js` file. The keys will be projected on Vue.config. By default, `Vue.config.performance` is enabled in dev mode, `Vue.config.silent` is enabled in production mode. Doc PR incoming. Resolves: #2910, #3427
57 lines
1.4 KiB
JavaScript
57 lines
1.4 KiB
JavaScript
import Browser from '../utils/browser'
|
|
import { getPort, loadFixture, Nuxt } from '../utils'
|
|
|
|
let port
|
|
const browser = new Browser()
|
|
const url = route => 'http://localhost:' + port + route
|
|
|
|
let nuxt = null
|
|
let page = null
|
|
|
|
const startServer = async (type = 'basic') => {
|
|
const config = loadFixture(type)
|
|
nuxt = new Nuxt(config)
|
|
port = await getPort()
|
|
await nuxt.listen(port, 'localhost')
|
|
|
|
return nuxt
|
|
}
|
|
|
|
describe('basic vue-config', () => {
|
|
beforeAll(async () => {
|
|
await browser.start({
|
|
// slowMo: 50,
|
|
// headless: false
|
|
})
|
|
})
|
|
|
|
test('default', async () => {
|
|
nuxt = await startServer()
|
|
expect(nuxt.options.vue.config).toEqual({ silent: true, performance: false })
|
|
page = await browser.page(url('/config'))
|
|
|
|
expect(await page.$text('#silent')).toBe('true')
|
|
expect(await page.$text('#performance')).toBe('false')
|
|
})
|
|
|
|
test('explicit', async () => {
|
|
nuxt = await startServer('config-explicit')
|
|
page = await browser.page(url('/config'))
|
|
|
|
expect(nuxt.options.vue.config).toEqual({ silent: false, performance: true, devtools: true })
|
|
|
|
expect(await page.$text('#silent')).toBe('false')
|
|
expect(await page.$text('#performance')).toBe('true')
|
|
expect(await page.$text('#devtools')).toBe('true')
|
|
})
|
|
|
|
afterEach(async () => {
|
|
await nuxt.close()
|
|
})
|
|
|
|
afterAll(async () => {
|
|
await page.close()
|
|
await browser.close()
|
|
})
|
|
})
|