Nuxt/test/fixtures/cli/cli.build.test.js
Clark Du 3c54d26c76 test: refactor cli tests (#3357)
* refactor: add untility for waiting until condition completed

* test: cli

* test: separate config of generate and build in cli test

* test: increase timeout of cli test slightly

* refactor: move waitUntil to test utils

* fix: use waitUntil in test utils
2018-06-06 17:01:43 +04:30

22 lines
712 B
JavaScript

import { exec } from 'child_process'
import { resolve } from 'path'
import { promisify } from 'util'
const execify = promisify(exec)
const rootDir = __dirname
const nuxtBin = resolve(__dirname, '..', '..', '..', 'bin', 'nuxt')
describe('cli build', () => {
test('nuxt build', async () => {
const { stdout } = await execify(`node ${nuxtBin} build ${rootDir} -c cli.build.config.js`)
expect(stdout.includes('Compiled successfully')).toBe(true)
}, 80000)
test('nuxt build -> error config', async () => {
await expect(execify(`node ${nuxtBin} build ${rootDir} -c config.js`)).rejects.toMatchObject({
stdout: expect.stringContaining('Could not load config file: config.js')
})
})
})