fix some tests

This commit is contained in:
Pooya Parsa 2017-06-15 14:33:54 +04:30
parent 25d106e2ab
commit 15bc36afb0
3 changed files with 3 additions and 8 deletions

View File

@ -6,6 +6,6 @@ module.exports = function () {
// Add /api endpoint // Add /api endpoint
this.addTemplate({ this.addTemplate({
fileName: 'router.js', fileName: 'router.js',
src: path.resolve(this.nuxt.srcDir, 'router.js') src: path.resolve(this.options.srcDir, 'router.js')
}) })
} }

View File

@ -9,13 +9,10 @@ test('Nuxt.js Class', t => {
test.serial('Nuxt.js Instance', async t => { test.serial('Nuxt.js Instance', async t => {
const nuxt = new Nuxt({ const nuxt = new Nuxt({
dev: false,
runBuild: true,
rootDir: resolve(__dirname, 'fixtures', 'empty') rootDir: resolve(__dirname, 'fixtures', 'empty')
}) })
t.is(typeof nuxt, 'object') t.is(typeof nuxt, 'object')
t.is(nuxt.options.dev, false) t.is(nuxt.options.dev, true)
t.is(typeof nuxt.build, 'function')
t.is(typeof nuxt.generate, 'function') t.is(typeof nuxt.generate, 'function')
t.is(typeof nuxt._init.then, 'function') t.is(typeof nuxt._init.then, 'function')
await nuxt.init() await nuxt.init()
@ -32,7 +29,6 @@ test.serial('Fail to build when no pages/ directory but is in the parent', t =>
let s = String(err) let s = String(err)
t.true(s.includes('No `pages` directory found')) t.true(s.includes('No `pages` directory found'))
t.true(s.includes('Did you mean to run `nuxt` in the parent (`../`) directory?')) t.true(s.includes('Did you mean to run `nuxt` in the parent (`../`) directory?'))
resolve()
}) })
}) })
@ -46,6 +42,5 @@ test.serial('Fail to build when no pages/ directory', t => {
let s = String(err) let s = String(err)
t.true(s.includes('Couldn\'t find a `pages` directory')) t.true(s.includes('Couldn\'t find a `pages` directory'))
t.true(s.includes('Please create one under the project root')) t.true(s.includes('Please create one under the project root'))
resolve()
}) })
}) })

View File

@ -18,7 +18,7 @@ test.before('Init Nuxt.js', async t => {
config.runBuild = true config.runBuild = true
nuxt = new Nuxt(config) nuxt = new Nuxt(config)
await nuxt.init() await nuxt.init()
server = new nuxt.Server(nuxt) server = new Nuxt.Server(nuxt)
server.listen(port, 'localhost') server.listen(port, 'localhost')
}) })