mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-17 06:01:34 +00:00
28 lines
862 B
JavaScript
28 lines
862 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', () => {
|
|
test('nuxt build', async () => {
|
|
const { stdout } = await execify(`node ${nuxtBin} build ${rootDir}`)
|
|
|
|
expect(stdout.includes('Compiled successfully')).toBe(true)
|
|
})
|
|
|
|
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')
|
|
})
|
|
})
|
|
|
|
test('nuxt generate', async () => {
|
|
const { stdout } = await execify(`node ${nuxtBin} generate ${rootDir}`)
|
|
|
|
expect(stdout.includes('Generated successfully')).toBe(true)
|
|
})
|
|
})
|