test: disable terser/minify by default (#6290)

This commit is contained in:
Pim 2019-08-24 16:13:03 +02:00 committed by Pooya Parsa
parent 9ad02c4017
commit 3a125b09d1
3 changed files with 15 additions and 2 deletions

View File

@ -1,6 +1,10 @@
const createData = async () => { const createData = async () => {
await new Promise(resolve => setTimeout(resolve, 500)) await new Promise(resolve => setTimeout(resolve, 500))
return { return {
build: {
// without terser enabled the size-limit unit test fails
terser: true
},
head: { head: {
title: 'Async Config!' title: 'Async Config!'
} }

View File

@ -35,12 +35,12 @@ describe('modern server mode', () => {
test('should include es6 syntax in modern resources', async () => { test('should include es6 syntax in modern resources', async () => {
const response = await rp(url(`/_nuxt/modern-${wChunk('pages/index.js')}`)) const response = await rp(url(`/_nuxt/modern-${wChunk('pages/index.js')}`))
expect(response).toContain('arrow:()=>"build test"') expect(response).toContain('arrow: () => {')
}) })
test('should not include es6 syntax in normal resources', async () => { test('should not include es6 syntax in normal resources', async () => {
const response = await rp(url(`/_nuxt/${wChunk('pages/index.js')}`)) const response = await rp(url(`/_nuxt/${wChunk('pages/index.js')}`))
expect(response).toContain('arrow:function(){return"build test"}') expect(response).toContain('arrow: function arrow() {')
}) })
test('should contain legacy http2 pushed resources', async () => { test('should contain legacy http2 pushed resources', async () => {

View File

@ -33,5 +33,14 @@ export const loadFixture = async function (fixture, overrides) {
config.dev = false config.dev = false
config.test = true config.test = true
// disable terser to speed-up fixture builds
if (config.build) {
if (!config.build.terser) {
config.build.terser = false
}
} else {
config.build = { terser: false }
}
return defaultsDeep({}, overrides, config) return defaultsDeep({}, overrides, config)
} }