mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
update tests
This commit is contained in:
parent
829ffa634b
commit
45485f5b8a
@ -1,6 +1,8 @@
|
||||
import test from 'ava'
|
||||
import { resolve } from 'path'
|
||||
import rp from 'request-promise-native'
|
||||
import { Nuxt, Server } from '../index.js'
|
||||
|
||||
const port = 4001
|
||||
const url = (route) => 'http://localhost:' + port + route
|
||||
|
||||
@ -9,14 +11,13 @@ let server = null
|
||||
|
||||
// Init nuxt.js and create server listening on localhost:4000
|
||||
test.before('Init Nuxt.js', async t => {
|
||||
const Nuxt = require('../')
|
||||
const options = {
|
||||
rootDir: resolve(__dirname, 'fixtures/basic'),
|
||||
dev: true
|
||||
}
|
||||
nuxt = new Nuxt(options)
|
||||
await nuxt.ready()
|
||||
server = new Nuxt.Server(nuxt)
|
||||
server = new Server(nuxt)
|
||||
server.listen(port, 'localhost')
|
||||
})
|
||||
|
||||
@ -38,5 +39,6 @@ test('/_nuxt/test.hot-update.json should returns empty html', async t => {
|
||||
// Close server and ask nuxt to stop listening to file changes
|
||||
test.after('Closing server and nuxt.js', t => {
|
||||
server.close()
|
||||
nuxt.close(() => {})
|
||||
nuxt.close(() => {
|
||||
})
|
||||
})
|
||||
|
@ -1,8 +1,8 @@
|
||||
import test from 'ava'
|
||||
import { resolve } from 'path'
|
||||
import { Nuxt } from '../index.js'
|
||||
|
||||
test('Fail with routes() which throw an error', async t => {
|
||||
const Nuxt = require('../')
|
||||
const options = {
|
||||
rootDir: resolve(__dirname, 'fixtures/basic'),
|
||||
dev: false,
|
||||
|
@ -4,6 +4,7 @@ import http from 'http'
|
||||
import serveStatic from 'serve-static'
|
||||
import finalhandler from 'finalhandler'
|
||||
import rp from 'request-promise-native'
|
||||
import { Nuxt } from '../index.js'
|
||||
|
||||
const port = 4002
|
||||
const url = (route) => 'http://localhost:' + port + route
|
||||
@ -13,7 +14,6 @@ let server = null
|
||||
|
||||
// Init nuxt.js and create server listening on localhost:4000
|
||||
test.before('Init Nuxt.js', async t => {
|
||||
const Nuxt = require('../')
|
||||
const rootDir = resolve(__dirname, 'fixtures/basic')
|
||||
let config = require(resolve(rootDir, 'nuxt.config.js'))
|
||||
config.rootDir = rootDir
|
||||
|
@ -2,6 +2,7 @@ import test from 'ava'
|
||||
import { resolve } from 'path'
|
||||
import rp from 'request-promise-native'
|
||||
import stdMocks from 'std-mocks'
|
||||
import { Nuxt, Server } from '../index.js'
|
||||
|
||||
const port = 4003
|
||||
const url = (route) => 'http://localhost:' + port + route
|
||||
@ -11,7 +12,6 @@ let server = null
|
||||
|
||||
// Init nuxt.js and create server listening on localhost:4000
|
||||
test.before('Init Nuxt.js', async t => {
|
||||
const Nuxt = require('../')
|
||||
const options = {
|
||||
rootDir: resolve(__dirname, 'fixtures/basic'),
|
||||
dev: false,
|
||||
@ -19,7 +19,7 @@ test.before('Init Nuxt.js', async t => {
|
||||
}
|
||||
nuxt = new Nuxt(options)
|
||||
await nuxt.ready()
|
||||
server = new Nuxt.Server(nuxt)
|
||||
server = new Server(nuxt)
|
||||
server.listen(port, 'localhost')
|
||||
})
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
import test from 'ava'
|
||||
import { resolve } from 'path'
|
||||
import { Nuxt, Server } from '../index.js'
|
||||
|
||||
const port = 4004
|
||||
// const url = (route) => 'http://localhost:' + port + route
|
||||
@ -9,7 +10,6 @@ let server = null
|
||||
|
||||
// Init nuxt.js and create server listening on localhost:4000
|
||||
test.before('Init Nuxt.js', async t => {
|
||||
const Nuxt = require('../')
|
||||
const options = {
|
||||
rootDir: resolve(__dirname, 'fixtures/children'),
|
||||
dev: false,
|
||||
@ -17,7 +17,7 @@ test.before('Init Nuxt.js', async t => {
|
||||
}
|
||||
nuxt = new Nuxt(options)
|
||||
await nuxt.ready()
|
||||
server = new Nuxt.Server(nuxt)
|
||||
server = new Server(nuxt)
|
||||
server.listen(port, 'localhost')
|
||||
})
|
||||
|
||||
|
@ -2,11 +2,11 @@ import test from 'ava'
|
||||
import { resolve } from 'path'
|
||||
import fs from 'fs'
|
||||
import pify from 'pify'
|
||||
import { Nuxt } from '../index.js'
|
||||
|
||||
const readFile = pify(fs.readFile)
|
||||
|
||||
test.before('Init Nuxt.js', async t => {
|
||||
const Nuxt = require('../')
|
||||
const nuxt = new Nuxt({
|
||||
rootDir: resolve(__dirname, 'fixtures/dynamic-routes'),
|
||||
dev: false,
|
||||
|
@ -1,5 +1,6 @@
|
||||
import test from 'ava'
|
||||
import { resolve } from 'path'
|
||||
import { Nuxt, Server } from '../index.js'
|
||||
|
||||
const port = 4005
|
||||
const url = (route) => 'http://localhost:' + port + route
|
||||
@ -9,7 +10,6 @@ let server = null
|
||||
|
||||
// Init nuxt.js and create server listening on localhost:4000
|
||||
test.before('Init Nuxt.js', async t => {
|
||||
const Nuxt = require('../')
|
||||
const options = {
|
||||
rootDir: resolve(__dirname, 'fixtures/error'),
|
||||
dev: false,
|
||||
@ -17,7 +17,7 @@ test.before('Init Nuxt.js', async t => {
|
||||
}
|
||||
nuxt = new Nuxt(options)
|
||||
await nuxt.ready()
|
||||
server = new Nuxt.Server(nuxt)
|
||||
server = new Server(nuxt)
|
||||
server.listen(port, 'localhost')
|
||||
})
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
import test from 'ava'
|
||||
import { resolve } from 'path'
|
||||
|
||||
const Nuxt = require('../')
|
||||
import { Nuxt } from '../index.js'
|
||||
|
||||
test('Nuxt.js Class', t => {
|
||||
t.is(typeof Nuxt, 'function')
|
||||
|
@ -1,7 +1,7 @@
|
||||
import test from 'ava'
|
||||
import { resolve, normalize } from 'path'
|
||||
import rp from 'request-promise-native'
|
||||
import Nuxt from '..'
|
||||
import { Nuxt, Server } from '../index.js'
|
||||
|
||||
const port = 4006
|
||||
const url = (route) => 'http://localhost:' + port + route
|
||||
@ -18,7 +18,7 @@ test.before('Init Nuxt.js', async t => {
|
||||
config.runBuild = true
|
||||
nuxt = new Nuxt(config)
|
||||
await nuxt.ready()
|
||||
server = new Nuxt.Server(nuxt)
|
||||
server = new Server(nuxt)
|
||||
server.listen(port, 'localhost')
|
||||
})
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import test from 'ava'
|
||||
import ansiHTML from 'ansi-html'
|
||||
import { Utils } from '..'
|
||||
import { Utils } from '../index.js'
|
||||
|
||||
test('encodeHtml', t => {
|
||||
const html = '<h1>Hello</h1>'
|
||||
|
@ -1,6 +1,7 @@
|
||||
import test from 'ava'
|
||||
import { resolve } from 'path'
|
||||
import rp from 'request-promise-native'
|
||||
import { Nuxt, Server } from '../index.js'
|
||||
|
||||
const port = 4007
|
||||
const url = (route) => 'http://localhost:' + port + route
|
||||
@ -10,7 +11,6 @@ let server = null
|
||||
|
||||
// Init nuxt.js and create server listening on localhost:4000
|
||||
test.before('Init Nuxt.js', async t => {
|
||||
const Nuxt = require('../')
|
||||
const rootDir = resolve(__dirname, 'fixtures/with-config')
|
||||
let config = require(resolve(rootDir, 'nuxt.config.js'))
|
||||
config.rootDir = rootDir
|
||||
@ -18,7 +18,7 @@ test.before('Init Nuxt.js', async t => {
|
||||
config.runBuild = true
|
||||
nuxt = new Nuxt(config)
|
||||
await nuxt.ready()
|
||||
server = new Nuxt.Server(nuxt)
|
||||
server = new Server(nuxt)
|
||||
server.listen(port, 'localhost')
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user