2018-03-27 22:28:17 +00:00
|
|
|
import { loadFixture, Nuxt, Builder } from './index'
|
|
|
|
|
|
|
|
export const buildFixture = function buildFixture(fixture) {
|
|
|
|
test(`Build ${fixture}`, async () => {
|
|
|
|
const config = loadFixture(fixture, {
|
|
|
|
test: true,
|
|
|
|
minimalCLI: true,
|
|
|
|
build: {
|
2018-03-29 07:11:34 +00:00
|
|
|
stats: 'errors-only'
|
2018-03-27 22:28:17 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
const nuxt = new Nuxt(config)
|
|
|
|
const buildDone = jest.fn()
|
|
|
|
nuxt.hook('build:done', buildDone)
|
|
|
|
const builder = await new Builder(nuxt).build()
|
|
|
|
// 2: BUILD_DONE
|
|
|
|
expect(builder._buildStatus).toBe(2)
|
|
|
|
expect(buildDone).toHaveBeenCalledTimes(1)
|
|
|
|
})
|
|
|
|
}
|