mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
refactor: move tests to unit folder
This commit is contained in:
parent
0e0729ddff
commit
db637c4d32
@ -43,8 +43,8 @@
|
||||
"scripts": {
|
||||
"test": "npm run build-fixtures && npm run test:unit",
|
||||
"build-fixtures": "node ./scripts/build-fixtures",
|
||||
"test:unit": "jest --maxWorkers=4 test/*.test.js",
|
||||
"test:e2e": "jest --maxWorkers=1 test/e2e/*.test.js",
|
||||
"test:unit": "jest --maxWorkers=4 test/unit",
|
||||
"test:e2e": "jest --maxWorkers=1 test/e2e",
|
||||
"coverage": "codecov",
|
||||
"lint": "eslint --ext .js,.mjs,.vue bin/* build/ lib/ test/ examples/",
|
||||
"precommit": "npm run lint",
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { resolve } from 'path'
|
||||
import { Nuxt, Options } from '..'
|
||||
import { version } from '../package.json'
|
||||
import { Nuxt, Options } from '../../'
|
||||
import { version } from '../../package.json'
|
||||
|
||||
describe('basic config defaults', () => {
|
||||
test('Nuxt.version is same as package', () => {
|
||||
@ -9,7 +9,7 @@ describe('basic config defaults', () => {
|
||||
|
||||
test('modulesDir uses /node_modules as default if not set', async () => {
|
||||
const options = Options.from({})
|
||||
const currentNodeModulesDir = resolve(__dirname, '..', 'node_modules')
|
||||
const currentNodeModulesDir = resolve(__dirname, '..', '..', 'node_modules')
|
||||
expect(options.modulesDir.includes(currentNodeModulesDir)).toBe(true)
|
||||
})
|
||||
})
|
@ -1,5 +1,5 @@
|
||||
import { Nuxt, Builder } from '..'
|
||||
import { loadFixture, getPort } from './utils'
|
||||
import { Nuxt, Builder } from '../../'
|
||||
import { loadFixture, getPort } from '../utils'
|
||||
|
||||
let port
|
||||
const url = route => 'http://localhost:' + port + route
|
@ -1,5 +1,5 @@
|
||||
import { Nuxt, Generator } from '..'
|
||||
import { loadFixture } from './utils'
|
||||
import { Nuxt, Generator } from '../../'
|
||||
import { loadFixture } from '../utils'
|
||||
|
||||
describe('basic fail generate', () => {
|
||||
test('Fail with routes() which throw an error', async () => {
|
@ -5,12 +5,12 @@ import { remove } from 'fs-extra'
|
||||
import serveStatic from 'serve-static'
|
||||
import finalhandler from 'finalhandler'
|
||||
import rp from 'request-promise-native'
|
||||
import { Nuxt, Generator } from '..'
|
||||
import { loadFixture, getPort } from './utils'
|
||||
import { Nuxt, Generator } from '../../'
|
||||
import { loadFixture, getPort } from '../utils'
|
||||
|
||||
let port
|
||||
const url = route => 'http://localhost:' + port + route
|
||||
const rootDir = resolve(__dirname, 'fixtures/basic')
|
||||
const rootDir = resolve(__dirname, '..', 'fixtures/basic')
|
||||
const distDir = resolve(rootDir, '.nuxt-generate')
|
||||
|
||||
let nuxt = null
|
@ -1,6 +1,6 @@
|
||||
import rp from 'request-promise-native'
|
||||
import { Nuxt } from '..'
|
||||
import { loadFixture, getPort } from './utils'
|
||||
import { Nuxt } from '../../'
|
||||
import { loadFixture, getPort } from '../utils'
|
||||
|
||||
let port
|
||||
const url = route => 'http://localhost:' + port + route
|
@ -1,6 +1,6 @@
|
||||
import rp from 'request-promise-native'
|
||||
import { Nuxt } from '..'
|
||||
import { loadFixture, getPort } from './utils'
|
||||
import { Nuxt } from '../../'
|
||||
import { loadFixture, getPort } from '../utils'
|
||||
|
||||
let port
|
||||
const url = route => 'http://localhost:' + port + route
|
@ -1,5 +1,5 @@
|
||||
import { Nuxt } from '..'
|
||||
import { loadFixture, getPort } from './utils'
|
||||
import { Nuxt } from '../../'
|
||||
import { loadFixture, getPort } from '../utils'
|
||||
|
||||
let port
|
||||
// const url = (route) => 'http://localhost:' + port + route
|
@ -2,15 +2,15 @@ import { exec, spawn } from 'child_process'
|
||||
import { resolve } from 'path'
|
||||
import { promisify } from 'util'
|
||||
import rp from 'request-promise-native'
|
||||
import { Utils } from '..'
|
||||
import { Utils } from '../../'
|
||||
|
||||
const execify = promisify(exec)
|
||||
const rootDir = resolve(__dirname, 'fixtures/basic')
|
||||
const rootDir = resolve(__dirname, '..', 'fixtures/basic')
|
||||
|
||||
let port
|
||||
const url = route => 'http://localhost:' + port + route
|
||||
|
||||
const nuxtBin = resolve(__dirname, '..', 'bin', 'nuxt')
|
||||
const nuxtBin = resolve(__dirname, '..', '..', 'bin', 'nuxt')
|
||||
|
||||
describe.skip('cli', () => {
|
||||
test('nuxt build', async () => {
|
@ -1,6 +1,6 @@
|
||||
import rp from 'request-promise-native'
|
||||
import { Nuxt } from '..'
|
||||
import { loadFixture, getPort } from './utils'
|
||||
import { Nuxt } from '../../'
|
||||
import { loadFixture, getPort } from '../utils'
|
||||
|
||||
let port
|
||||
const url = route => 'http://localhost:' + port + route
|
@ -1,6 +1,6 @@
|
||||
import rp from 'request-promise-native'
|
||||
import { Nuxt } from '..'
|
||||
import { loadFixture, getPort } from './utils'
|
||||
import { Nuxt } from '../../'
|
||||
import { loadFixture, getPort } from '../utils'
|
||||
|
||||
let port
|
||||
const url = route => 'http://localhost:' + port + route
|
@ -1,5 +1,5 @@
|
||||
import { Nuxt } from '..'
|
||||
import { loadFixture, getPort } from './utils'
|
||||
import { Nuxt } from '../../'
|
||||
import { loadFixture, getPort } from '../utils'
|
||||
|
||||
let port
|
||||
|
@ -7,7 +7,7 @@ const readFile = promisify(fs.readFile)
|
||||
describe('dynamic routes', () => {
|
||||
test('Check .nuxt/router.js', () => {
|
||||
return readFile(
|
||||
resolve(__dirname, './fixtures/dynamic-routes/.nuxt/router.js'),
|
||||
resolve(__dirname, '..', 'fixtures/dynamic-routes/.nuxt/router.js'),
|
||||
'utf-8'
|
||||
).then(routerFile => {
|
||||
routerFile = routerFile
|
@ -1,6 +1,6 @@
|
||||
// import rp from 'request-promise-native'
|
||||
import { Nuxt } from '..'
|
||||
import { loadFixture, getPort } from './utils'
|
||||
import { Nuxt } from '../../'
|
||||
import { loadFixture, getPort } from '../utils'
|
||||
|
||||
let port
|
||||
const url = route => 'http://localhost:' + port + route
|
@ -1,7 +1,7 @@
|
||||
import express from 'express'
|
||||
import rp from 'request-promise-native'
|
||||
import { Nuxt } from '..'
|
||||
import { loadFixture, getPort } from './utils'
|
||||
import { Nuxt } from '../../'
|
||||
import { loadFixture, getPort } from '../utils'
|
||||
|
||||
let port
|
||||
const url = route => 'http://localhost:' + port + route
|
@ -4,12 +4,12 @@ import { resolve } from 'path'
|
||||
import serveStatic from 'serve-static'
|
||||
import finalhandler from 'finalhandler'
|
||||
import rp from 'request-promise-native'
|
||||
import { Nuxt, Generator, Options } from '..'
|
||||
import { loadFixture, getPort } from './utils'
|
||||
import { Nuxt, Generator, Options } from '../../'
|
||||
import { loadFixture, getPort } from '../utils'
|
||||
|
||||
let port
|
||||
const url = route => 'http://localhost:' + port + route
|
||||
const distDir = resolve(__dirname, 'fixtures/basic/.nuxt-generate-fallback')
|
||||
const distDir = resolve(__dirname, '..', 'fixtures/basic/.nuxt-generate-fallback')
|
||||
|
||||
let nuxt = null
|
||||
let server = null
|
@ -1,4 +1,4 @@
|
||||
import { Nuxt, Generator } from '..'
|
||||
import { Nuxt, Generator } from '../../'
|
||||
|
||||
describe('generator', () => {
|
||||
test('initRoutes with routes (fn => array)', async () => {
|
@ -1,7 +1,7 @@
|
||||
import { normalize } from 'path'
|
||||
import rp from 'request-promise-native'
|
||||
import { Nuxt } from '..'
|
||||
import { loadFixture, getPort } from './utils'
|
||||
import { Nuxt } from '../../'
|
||||
import { loadFixture, getPort } from '../utils'
|
||||
|
||||
let port
|
||||
const url = route => 'http://localhost:' + port + route
|
@ -1,6 +1,6 @@
|
||||
import { resolve } from 'path'
|
||||
import { Nuxt, Builder } from '..'
|
||||
import { loadFixture } from './utils'
|
||||
import { Nuxt, Builder } from '../../'
|
||||
import { loadFixture } from '../utils'
|
||||
|
||||
describe('nuxt', () => {
|
||||
test('Nuxt.js Class', () => {
|
||||
@ -23,7 +23,7 @@ describe('nuxt', () => {
|
||||
test('Fail to build when no pages/ directory but is in the parent', () => {
|
||||
const nuxt = new Nuxt({
|
||||
dev: false,
|
||||
rootDir: resolve(__dirname, 'fixtures', 'empty', 'pages')
|
||||
rootDir: resolve(__dirname, '..', 'fixtures', 'empty', 'pages')
|
||||
})
|
||||
|
||||
return new Builder(nuxt).build().catch(err => {
|
@ -1,5 +1,5 @@
|
||||
import { Nuxt } from '..'
|
||||
import { loadFixture, getPort } from './utils'
|
||||
import { Nuxt } from '../../'
|
||||
import { loadFixture, getPort } from '../utils'
|
||||
|
||||
let nuxt = null
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Nuxt, Utils } from '..'
|
||||
import { Nuxt, Utils } from '../../'
|
||||
import { uniq } from 'lodash'
|
||||
import rp from 'request-promise-native'
|
||||
import { loadFixture, getPort } from './utils'
|
||||
import { loadFixture, getPort } from '../utils'
|
||||
|
||||
let port
|
||||
let nuxt = null
|
@ -1,5 +1,5 @@
|
||||
import ansiHTML from 'ansi-html'
|
||||
import { Utils } from '..'
|
||||
import { Utils } from '../../'
|
||||
|
||||
describe('utils', () => {
|
||||
test('encodeHtml', () => {
|
@ -1,6 +1,6 @@
|
||||
import rp from 'request-promise-native'
|
||||
import { Nuxt } from '..'
|
||||
import { loadFixture, getPort } from './utils'
|
||||
import { Nuxt } from '../../'
|
||||
import { loadFixture, getPort } from '../utils'
|
||||
|
||||
let port
|
||||
const url = route => 'http://localhost:' + port + route
|
Loading…
Reference in New Issue
Block a user