diff --git a/test/basic.dev.test.js b/test/basic.dev.test.js index be75b6cac1..5ee3d73025 100644 --- a/test/basic.dev.test.js +++ b/test/basic.dev.test.js @@ -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(() => { + }) }) diff --git a/test/basic.fail.generate.test.js b/test/basic.fail.generate.test.js index b8861e8e0a..340bf4d253 100644 --- a/test/basic.fail.generate.test.js +++ b/test/basic.fail.generate.test.js @@ -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, diff --git a/test/basic.generate.test.js b/test/basic.generate.test.js index cd270c13ac..e896360ad0 100644 --- a/test/basic.generate.test.js +++ b/test/basic.generate.test.js @@ -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 diff --git a/test/basic.test.js b/test/basic.test.js index b29df1ead9..49a86d25c4 100755 --- a/test/basic.test.js +++ b/test/basic.test.js @@ -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') }) diff --git a/test/children.test.js b/test/children.test.js index 01786707c9..3424a5e15c 100644 --- a/test/children.test.js +++ b/test/children.test.js @@ -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') }) diff --git a/test/dynamic-routes.test.js b/test/dynamic-routes.test.js index b2256a9951..79618677cd 100644 --- a/test/dynamic-routes.test.js +++ b/test/dynamic-routes.test.js @@ -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, diff --git a/test/error.test.js b/test/error.test.js index ab361c4d03..6f1cc7c8e3 100644 --- a/test/error.test.js +++ b/test/error.test.js @@ -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') }) diff --git a/test/index.test.js b/test/index.test.js index ae20a2ef74..b008b1ee04 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -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') diff --git a/test/module.test.js b/test/module.test.js index eca4d7bfea..331d42943f 100755 --- a/test/module.test.js +++ b/test/module.test.js @@ -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') }) diff --git a/test/utils.test.js b/test/utils.test.js index acd0b20c18..de741554ac 100644 --- a/test/utils.test.js +++ b/test/utils.test.js @@ -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 = '

Hello

' diff --git a/test/with-config.test.js b/test/with-config.test.js index f621ca9f2d..def656d841 100644 --- a/test/with-config.test.js +++ b/test/with-config.test.js @@ -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') })