2018-03-27 22:28:17 +00:00
|
|
|
import { loadFixture, Nuxt, Builder } from './index'
|
|
|
|
|
2018-08-16 15:34:32 +00:00
|
|
|
export const buildFixture = function (fixture, callback) {
|
2018-03-27 22:28:17 +00:00
|
|
|
test(`Build ${fixture}`, async () => {
|
2018-08-17 20:25:23 +00:00
|
|
|
const config = await loadFixture(fixture)
|
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)
|
2018-08-16 15:34:32 +00:00
|
|
|
if (typeof callback === 'function') {
|
|
|
|
callback(builder)
|
|
|
|
}
|
2018-07-24 16:24:10 +00:00
|
|
|
}, 120000)
|
2018-03-27 22:28:17 +00:00
|
|
|
}
|