mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 22:25:12 +00:00
fffe741986
Add stdout/stderr to console helpers Remove separate nosubfolders test file in favor of inclusion in basic.generate Add build.stats to silence webpack output Add .always to after hooks: (1) fixes issue with basic.dev test that watch.js is empty when one of the test fails and (2) fixes that sometimes when running multiple tests that failed after eachother the port is still used as the server did not automatically get killed Change all init nuxt before test to serial tests and add tests for DONE and OPEN logs
43 lines
1.2 KiB
JavaScript
43 lines
1.2 KiB
JavaScript
import test from 'ava'
|
|
import { resolve } from 'path'
|
|
import { Nuxt, Builder } from '..'
|
|
|
|
test('Nuxt.js Class', t => {
|
|
t.is(typeof Nuxt, 'function')
|
|
})
|
|
|
|
test('Nuxt.js Instance', async t => {
|
|
const nuxt = new Nuxt({
|
|
rootDir: resolve(__dirname, 'fixtures', 'empty')
|
|
})
|
|
t.is(typeof nuxt, 'object')
|
|
t.is(nuxt.options.dev, true)
|
|
t.is(typeof nuxt._ready.then, 'function')
|
|
await nuxt.ready()
|
|
t.is(nuxt.initialized, true)
|
|
})
|
|
|
|
test('Fail to build when no pages/ directory but is in the parent', t => {
|
|
const nuxt = new Nuxt({
|
|
dev: false,
|
|
rootDir: resolve(__dirname, 'fixtures', 'empty', 'pages')
|
|
})
|
|
return new Builder(nuxt).build().catch(err => {
|
|
let s = String(err)
|
|
t.true(s.includes('No `pages` directory found'))
|
|
t.true(s.includes('Did you mean to run `nuxt` in the parent (`../`) directory?'))
|
|
})
|
|
})
|
|
|
|
test('Fail to build when no pages/ directory', t => {
|
|
const nuxt = new Nuxt({
|
|
dev: false,
|
|
rootDir: resolve(__dirname)
|
|
})
|
|
return new Builder(nuxt).build().catch(err => {
|
|
let s = String(err)
|
|
t.true(s.includes('Couldn\'t find a `pages` directory'))
|
|
t.true(s.includes('Please create one under the project root'))
|
|
})
|
|
})
|