2018-08-17 20:25:23 +00:00
|
|
|
import consola from 'consola'
|
|
|
|
import { buildFixture } from '../../utils/build'
|
2018-03-27 22:28:17 +00:00
|
|
|
|
2018-09-08 21:08:25 +00:00
|
|
|
beforeAll(() => {
|
|
|
|
process.env.NUXT_ENV_FOO = 'manniL'
|
|
|
|
})
|
|
|
|
|
2018-09-08 20:18:14 +00:00
|
|
|
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', () => {
|
|
|
|
expect(consola.warn).toHaveBeenCalledTimes(1)
|
2018-09-08 20:18:14 +00:00
|
|
|
expect(consola.fatal).toHaveBeenCalledTimes(0)
|
2018-08-16 15:34:32 +00:00
|
|
|
expect(consola.warn.mock.calls[0]).toMatchObject([{
|
|
|
|
message: 'Found 2 plugins that match the configuration, suggest to specify extension:',
|
|
|
|
additional: expect.stringContaining('plugins/test.json'),
|
|
|
|
badge: true
|
|
|
|
}])
|
2018-09-08 20:18:14 +00:00
|
|
|
expect(customCompressionMiddlewareFunctionName).toBe('damn')
|
|
|
|
}, hooks)
|
2018-08-16 15:34:32 +00:00
|
|
|
})
|
2018-09-08 21:08:25 +00:00
|
|
|
|
|
|
|
afterAll(() => {
|
|
|
|
delete process.env.NUXT_ENV_FOO
|
|
|
|
})
|