Nuxt/test/utils/build.js
Clark Du 432720b8c8 fix: appveyor test failure (#3754)
* fix: appveyor test failure

* ci: bring back yarn cache

* ci: turn off matrix

* refactor: use babel instead of esm in jest

* refactor: use es modules in fixtures
2018-08-17 22:25:23 +02:00

18 lines
553 B
JavaScript

import { loadFixture, Nuxt, Builder } from './index'
export const buildFixture = function (fixture, callback) {
test(`Build ${fixture}`, async () => {
const config = await loadFixture(fixture)
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)
if (typeof callback === 'function') {
callback(builder)
}
}, 120000)
}