Nuxt/test/fixtures/with-config/with-config.test.js

45 lines
1.4 KiB
JavaScript
Raw Normal View History

import consola from 'consola'
import { buildFixture } from '../../utils/build'
beforeAll(() => {
process.env.NUXT_ENV_FOO = 'manniL'
})
let customCompressionMiddlewareFunctionName
const hooks = [
['render:errorMiddleware', (app) => {
customCompressionMiddlewareFunctionName = app.stack[0].handle.name
}]
]
2018-08-16 15:34:32 +00:00
describe('with-config', () => {
buildFixture('with-config', () => {
2018-12-20 09:28:10 +00:00
expect(consola.warn).toHaveBeenCalledTimes(5)
expect(consola.fatal).toHaveBeenCalledTimes(0)
expect(consola.warn.mock.calls).toMatchObject([
[
'Unknown mode: unknown. Falling back to universal'
],
2018-12-20 09:28:10 +00:00
[
`Invalid plugin mode (server/client/all): 'abc'. Falling back to 'all'`
],
[{
message: 'Found 2 plugins that match the configuration, suggest to specify extension:',
additional: expect.stringContaining('plugins/test.json')
}],
[
'Using styleResources without the nuxt-style-resources-module is not suggested and can lead to severe performance issues.',
'Please use https://github.com/nuxt-community/style-resources-module'
],
[
'Notice: Please do not deploy bundles built with analyze mode, it\'s only for analyzing purpose.'
]
])
expect(customCompressionMiddlewareFunctionName).toBe('damn')
}, hooks)
2018-08-16 15:34:32 +00:00
})
afterAll(() => {
delete process.env.NUXT_ENV_FOO
})