mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 06:05:11 +00:00
Use Nuxt server for tests
This commit is contained in:
parent
530cb9f272
commit
6b7062046e
@ -24,6 +24,10 @@ class Server {
|
||||
return this
|
||||
}
|
||||
|
||||
close (cb) {
|
||||
return this.server.close(cb)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = Server
|
||||
|
@ -1,6 +1,5 @@
|
||||
import test from 'ava'
|
||||
import jsdom from 'jsdom'
|
||||
import { createServer } from 'http'
|
||||
import { resolve } from 'path'
|
||||
const port = 4002
|
||||
const url = (route) => 'http://localhost:' + port + route
|
||||
@ -18,7 +17,7 @@ test.before('Init Nuxt.js', t => {
|
||||
nuxt = new Nuxt(options)
|
||||
return nuxt.build()
|
||||
.then(function () {
|
||||
server = createServer((req, res) => nuxt.render(req, res))
|
||||
server = new nuxt.Server(nuxt)
|
||||
server.listen(port, 'localhost')
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user