mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 09:27:13 +00:00
fix: appveyor test failure (#3754)
* fix: appveyor test failure * ci: bring back yarn cache * ci: turn off matrix * refactor: use babel instead of esm in jest * refactor: use es modules in fixtures
This commit is contained in:
parent
565ab7086a
commit
432720b8c8
3
.babelrc
3
.babelrc
@ -7,7 +7,8 @@
|
||||
"node": "current"
|
||||
}
|
||||
}]
|
||||
]
|
||||
],
|
||||
"plugins": ["dynamic-import-node"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,13 @@
|
||||
# Test against the latest version of this Node.js version
|
||||
environment:
|
||||
matrix:
|
||||
- nodejs_version: "Current"
|
||||
nodejs_version: "Current"
|
||||
# environment:
|
||||
# matrix:
|
||||
# - nodejs_version: "Current"
|
||||
|
||||
cache:
|
||||
- 'node_modules -> yarn.lock'
|
||||
# - '%LOCALAPPDATA%\\Yarn -> yarn.lock'
|
||||
- '%LOCALAPPDATA%\\Yarn -> yarn.lock'
|
||||
|
||||
image: Visual Studio 2017
|
||||
|
||||
|
@ -7,6 +7,7 @@ module.exports = {
|
||||
],
|
||||
setupTestFrameworkScriptFile: './test/utils/setup',
|
||||
testPathIgnorePatterns: ['test/fixtures/.*/.*?/'],
|
||||
transformIgnorePatterns: ['<rootDir>/node_modules/'],
|
||||
moduleFileExtensions: ['js', 'mjs', 'json'],
|
||||
expand: true,
|
||||
forceExit: true
|
||||
|
@ -141,6 +141,7 @@
|
||||
"babel-core": "^7.0.0-0",
|
||||
"babel-eslint": "^9.0.0-beta",
|
||||
"babel-jest": "^23.4.2",
|
||||
"babel-plugin-dynamic-import-node": "^2.0.0",
|
||||
"codecov": "^3.0.4",
|
||||
"cross-env": "^5.2.0",
|
||||
"eslint": "^4.19.1",
|
||||
|
@ -10,7 +10,7 @@ let page = null
|
||||
|
||||
describe('basic browser', () => {
|
||||
beforeAll(async () => {
|
||||
const config = loadFixture('basic')
|
||||
const config = await loadFixture('basic')
|
||||
nuxt = new Nuxt(config)
|
||||
port = await getPort()
|
||||
await nuxt.listen(port, 'localhost')
|
||||
|
@ -9,7 +9,7 @@ let nuxt = null
|
||||
let page = null
|
||||
|
||||
const startServer = async (type = 'basic') => {
|
||||
const config = loadFixture(type)
|
||||
const config = await loadFixture(type)
|
||||
nuxt = new Nuxt(config)
|
||||
port = await getPort()
|
||||
await nuxt.listen(port, 'localhost')
|
||||
|
@ -11,7 +11,7 @@ const dates = {}
|
||||
|
||||
describe('children patch (browser)', () => {
|
||||
beforeAll(async () => {
|
||||
const options = loadFixture('children')
|
||||
const options = await loadFixture('children')
|
||||
nuxt = new Nuxt(options)
|
||||
port = await getPort()
|
||||
await nuxt.listen(port, 'localhost')
|
||||
|
2
test/fixtures/basic/basic.test.js
vendored
2
test/fixtures/basic/basic.test.js
vendored
@ -1,3 +1,3 @@
|
||||
const { buildFixture } = require('../../utils/build')
|
||||
import { buildFixture } from '../../utils/build'
|
||||
|
||||
buildFixture('basic')
|
||||
|
2
test/fixtures/children/children.test.js
vendored
2
test/fixtures/children/children.test.js
vendored
@ -1,3 +1,3 @@
|
||||
const { buildFixture } = require('../../utils/build')
|
||||
import { buildFixture } from '../../utils/build'
|
||||
|
||||
buildFixture('children')
|
||||
|
@ -1,3 +1,3 @@
|
||||
const { buildFixture } = require('../../utils/build')
|
||||
import { buildFixture } from '../../utils/build'
|
||||
|
||||
buildFixture('config-explicit')
|
||||
|
@ -1,3 +1,3 @@
|
||||
const { buildFixture } = require('../../utils/build')
|
||||
import { buildFixture } from '../../utils/build'
|
||||
|
||||
buildFixture('custom-app-template')
|
||||
|
@ -1,3 +1,3 @@
|
||||
const { buildFixture } = require('../../utils/build')
|
||||
import { buildFixture } from '../../utils/build'
|
||||
|
||||
buildFixture('custom-dirs')
|
||||
|
5
test/fixtures/custom-dirs/package.json
vendored
5
test/fixtures/custom-dirs/package.json
vendored
@ -1,5 +0,0 @@
|
||||
{
|
||||
"name": "custom-dirs",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {}
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
const { buildFixture } = require('../../utils/build')
|
||||
import { buildFixture } from '../../utils/build'
|
||||
|
||||
buildFixture('dynamic-routes')
|
||||
|
2
test/fixtures/empty/empty.test.js
vendored
2
test/fixtures/empty/empty.test.js
vendored
@ -1,3 +1,3 @@
|
||||
const { buildFixture } = require('../../utils/build')
|
||||
import { buildFixture } from '../../utils/build'
|
||||
|
||||
buildFixture('empty')
|
||||
|
2
test/fixtures/error/error.test.js
vendored
2
test/fixtures/error/error.test.js
vendored
@ -1,3 +1,3 @@
|
||||
const { buildFixture } = require('../../utils/build')
|
||||
import { buildFixture } from '../../utils/build'
|
||||
|
||||
buildFixture('error')
|
||||
|
@ -1,3 +1,3 @@
|
||||
const { buildFixture } = require('../../utils/build')
|
||||
import { buildFixture } from '../../utils/build'
|
||||
|
||||
buildFixture('extract-css')
|
||||
|
2
test/fixtures/module/module.test.js
vendored
2
test/fixtures/module/module.test.js
vendored
@ -1,3 +1,3 @@
|
||||
const { buildFixture } = require('../../utils/build')
|
||||
import { buildFixture } from '../../utils/build'
|
||||
|
||||
buildFixture('module')
|
||||
|
5
test/fixtures/module/package.json
vendored
5
test/fixtures/module/package.json
vendored
@ -1,5 +0,0 @@
|
||||
{
|
||||
"name": "module",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {}
|
||||
}
|
2
test/fixtures/spa/spa.test.js
vendored
2
test/fixtures/spa/spa.test.js
vendored
@ -1,3 +1,3 @@
|
||||
const { buildFixture } = require('../../utils/build')
|
||||
import { buildFixture } from '../../utils/build'
|
||||
|
||||
buildFixture('spa')
|
||||
|
2
test/fixtures/ssr/ssr.test.js
vendored
2
test/fixtures/ssr/ssr.test.js
vendored
@ -1,3 +1,3 @@
|
||||
const { buildFixture } = require('../../utils/build')
|
||||
import { buildFixture } from '../../utils/build'
|
||||
|
||||
buildFixture('ssr')
|
||||
|
5
test/fixtures/with-config/package.json
vendored
5
test/fixtures/with-config/package.json
vendored
@ -1,5 +0,0 @@
|
||||
{
|
||||
"name": "with-config",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
const consola = require('consola')
|
||||
const { buildFixture } = require('../../utils/build')
|
||||
import consola from 'consola'
|
||||
import { buildFixture } from '../../utils/build'
|
||||
|
||||
describe('with-config', () => {
|
||||
buildFixture('with-config', () => {
|
||||
|
@ -8,7 +8,7 @@ let transpile = null
|
||||
|
||||
describe('basic dev', () => {
|
||||
beforeAll(async () => {
|
||||
const config = loadFixture('basic', {
|
||||
const config = await loadFixture('basic', {
|
||||
dev: true,
|
||||
debug: true,
|
||||
buildDir: '.nuxt-dev',
|
||||
|
@ -2,7 +2,7 @@ import { loadFixture, Nuxt, Generator } from '../utils'
|
||||
|
||||
describe('basic fail generate', () => {
|
||||
test('Fail with routes() which throw an error', async () => {
|
||||
const options = loadFixture('basic', {
|
||||
const options = await loadFixture('basic', {
|
||||
generate: {
|
||||
routes() {
|
||||
throw new Error('Not today!')
|
||||
|
@ -16,7 +16,7 @@ let generator = null
|
||||
|
||||
describe('basic generate', () => {
|
||||
beforeAll(async () => {
|
||||
const config = loadFixture('basic', { generate: { dir: '.nuxt-generate' } })
|
||||
const config = await loadFixture('basic', { generate: { dir: '.nuxt-generate' } })
|
||||
const nuxt = new Nuxt(config)
|
||||
const builder = new Builder(nuxt)
|
||||
builder.build = jest.fn()
|
||||
|
@ -4,7 +4,7 @@ let port
|
||||
const url = route => 'http://localhost:' + port + route
|
||||
|
||||
const startCspServer = async (csp, isProduction = true) => {
|
||||
const options = loadFixture('basic', {
|
||||
const options = await loadFixture('basic', {
|
||||
debug: !isProduction,
|
||||
render: { csp }
|
||||
})
|
||||
|
@ -8,7 +8,7 @@ let nuxt = null
|
||||
|
||||
describe('basic ssr', () => {
|
||||
beforeAll(async () => {
|
||||
const options = loadFixture('basic')
|
||||
const options = await loadFixture('basic')
|
||||
nuxt = new Nuxt(options)
|
||||
port = await getPort()
|
||||
await nuxt.listen(port, '0.0.0.0')
|
||||
|
@ -7,7 +7,7 @@ let nuxt = null
|
||||
|
||||
describe('children', () => {
|
||||
beforeAll(async () => {
|
||||
const options = loadFixture('children')
|
||||
const options = await loadFixture('children')
|
||||
nuxt = new Nuxt(options)
|
||||
port = await getPort()
|
||||
await nuxt.listen(port, 'localhost')
|
||||
|
@ -5,7 +5,7 @@ let nuxt = null
|
||||
|
||||
describe('custom-app-template', () => {
|
||||
beforeAll(async () => {
|
||||
const options = loadFixture('custom-app-template')
|
||||
const options = await loadFixture('custom-app-template')
|
||||
nuxt = new Nuxt(options)
|
||||
port = await getPort()
|
||||
await nuxt.listen(port, '0.0.0.0')
|
||||
|
@ -7,7 +7,7 @@ let nuxt = null
|
||||
|
||||
describe('custom-dirs', () => {
|
||||
beforeAll(async () => {
|
||||
const config = loadFixture('custom-dirs')
|
||||
const config = await loadFixture('custom-dirs')
|
||||
nuxt = new Nuxt(config)
|
||||
port = await getPort()
|
||||
await nuxt.listen(port, 'localhost')
|
||||
|
@ -7,7 +7,7 @@ let nuxt = null
|
||||
|
||||
describe('dist options', () => {
|
||||
beforeAll(async () => {
|
||||
const options = loadFixture('basic')
|
||||
const options = await loadFixture('basic')
|
||||
nuxt = new Nuxt(Object.assign(options, {dev: false}))
|
||||
port = await getPort()
|
||||
await nuxt.listen(port, '0.0.0.0')
|
||||
|
@ -10,7 +10,7 @@ let nuxt = null
|
||||
|
||||
describe('error', () => {
|
||||
beforeAll(async () => {
|
||||
const config = loadFixture('error')
|
||||
const config = await loadFixture('error')
|
||||
nuxt = new Nuxt(config)
|
||||
port = await getPort()
|
||||
await nuxt.listen(port, 'localhost')
|
||||
|
@ -11,7 +11,7 @@ let server
|
||||
describe('express', () => {
|
||||
// Init nuxt.js and create express server
|
||||
beforeAll(async () => {
|
||||
const config = loadFixture('basic')
|
||||
const config = await loadFixture('basic')
|
||||
nuxt = new Nuxt(config)
|
||||
|
||||
port = await getPort()
|
||||
|
@ -15,7 +15,7 @@ let generator = null
|
||||
|
||||
describe('fallback generate', () => {
|
||||
beforeAll(async () => {
|
||||
const config = loadFixture('basic', {generate: {dir: '.nuxt-generate-fallback'}})
|
||||
const config = await loadFixture('basic', {generate: {dir: '.nuxt-generate-fallback'}})
|
||||
|
||||
nuxt = new Nuxt(config)
|
||||
generator = new Generator(nuxt)
|
||||
|
@ -10,7 +10,7 @@ let nuxt = null
|
||||
|
||||
describe('module', () => {
|
||||
beforeAll(async () => {
|
||||
const config = loadFixture('module')
|
||||
const config = await loadFixture('module')
|
||||
nuxt = new Nuxt(config)
|
||||
port = await getPort()
|
||||
await nuxt.listen(port, 'localhost')
|
||||
|
@ -7,7 +7,7 @@ describe('nuxt', () => {
|
||||
})
|
||||
|
||||
test('Nuxt.js Instance', async () => {
|
||||
const config = loadFixture('empty')
|
||||
const config = await loadFixture('empty')
|
||||
const nuxt = new Nuxt(config)
|
||||
|
||||
expect(typeof nuxt).toBe('object')
|
||||
|
@ -13,7 +13,7 @@ const renderRoute = async (_url) => {
|
||||
|
||||
describe('spa', () => {
|
||||
beforeAll(async () => {
|
||||
const config = loadFixture('spa')
|
||||
const config = await loadFixture('spa')
|
||||
nuxt = new Nuxt(config)
|
||||
port = await getPort()
|
||||
await nuxt.listen(port, 'localhost')
|
||||
|
@ -63,7 +63,7 @@ const stressTest = async (_url, concurrency = 2, steps = 4) => {
|
||||
|
||||
describe('ssr', () => {
|
||||
beforeAll(async () => {
|
||||
const config = loadFixture('ssr')
|
||||
const config = await loadFixture('ssr')
|
||||
nuxt = new Nuxt(config)
|
||||
port = await getPort()
|
||||
await nuxt.listen(port, 'localhost')
|
||||
|
@ -7,7 +7,7 @@ let nuxt = null
|
||||
|
||||
describe('with-config', () => {
|
||||
beforeAll(async () => {
|
||||
const config = loadFixture('with-config')
|
||||
const config = await loadFixture('with-config')
|
||||
nuxt = new Nuxt(config)
|
||||
port = await getPort()
|
||||
await nuxt.listen(port, 'localhost')
|
||||
|
@ -2,7 +2,7 @@ import { loadFixture, Nuxt, Builder } from './index'
|
||||
|
||||
export const buildFixture = function (fixture, callback) {
|
||||
test(`Build ${fixture}`, async () => {
|
||||
const config = loadFixture(fixture)
|
||||
const config = await loadFixture(fixture)
|
||||
const nuxt = new Nuxt(config)
|
||||
const buildDone = jest.fn()
|
||||
nuxt.hook('build:done', buildDone)
|
||||
|
@ -4,7 +4,6 @@ import fs from 'fs'
|
||||
import _getPort from 'get-port'
|
||||
import { defaultsDeep } from 'lodash'
|
||||
import _rp from 'request-promise-native'
|
||||
import esm from 'esm'
|
||||
import pkg from '../../package.json'
|
||||
import Dist from '../../lib/nuxt'
|
||||
|
||||
@ -18,13 +17,11 @@ export const Options = Dist.Options
|
||||
export const Builder = Dist.Builder
|
||||
export const Generator = Dist.Generator
|
||||
|
||||
const requireModule = esm(module, {})
|
||||
|
||||
export const loadFixture = function loadFixture(fixture, overrides) {
|
||||
export const loadFixture = async function (fixture, overrides) {
|
||||
const rootDir = path.resolve(__dirname, '..', 'fixtures', fixture)
|
||||
const configFile = path.resolve(rootDir, 'nuxt.config.js')
|
||||
|
||||
const config = fs.existsSync(configFile) ? requireModule(configFile).default : {}
|
||||
const config = fs.existsSync(configFile) ? (await import(`../fixtures/${fixture}/nuxt.config`)).default : {}
|
||||
|
||||
config.rootDir = rootDir
|
||||
config.dev = false
|
||||
|
24
yarn.lock
24
yarn.lock
@ -1328,6 +1328,13 @@ babel-messages@^6.23.0:
|
||||
dependencies:
|
||||
babel-runtime "^6.22.0"
|
||||
|
||||
babel-plugin-dynamic-import-node@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.0.0.tgz#d6fc3f6c5e3bdc34e49c15faca7ce069755c0a57"
|
||||
dependencies:
|
||||
babel-plugin-syntax-dynamic-import "^6.18.0"
|
||||
object.assign "^4.1.0"
|
||||
|
||||
babel-plugin-istanbul@^4.1.6:
|
||||
version "4.1.6"
|
||||
resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.6.tgz#36c59b2192efce81c5b378321b74175add1c9a45"
|
||||
@ -1341,6 +1348,10 @@ babel-plugin-jest-hoist@^23.2.0:
|
||||
version "23.2.0"
|
||||
resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-23.2.0.tgz#e61fae05a1ca8801aadee57a6d66b8cefaf44167"
|
||||
|
||||
babel-plugin-syntax-dynamic-import@^6.18.0:
|
||||
version "6.18.0"
|
||||
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-dynamic-import/-/babel-plugin-syntax-dynamic-import-6.18.0.tgz#8d6a26229c83745a9982a441051572caa179b1da"
|
||||
|
||||
babel-plugin-syntax-object-rest-spread@^6.13.0:
|
||||
version "6.13.0"
|
||||
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz#fd6536f2bce13836ffa3a5458c4903a597bb3bf5"
|
||||
@ -4084,6 +4095,10 @@ is-callable@^1.1.1, is-callable@^1.1.3:
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.3.tgz#86eb75392805ddc33af71c92a0eedf74ee7604b2"
|
||||
|
||||
is-callable@^1.1.4:
|
||||
version "1.1.4"
|
||||
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75"
|
||||
|
||||
is-ci@^1.0.10, is-ci@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.1.0.tgz#247e4162e7860cebbdaf30b774d6b0ac7dcfe7a5"
|
||||
@ -7935,11 +7950,14 @@ strip-json-comments@~2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"
|
||||
|
||||
style-resources-loader@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/style-resources-loader/-/style-resources-loader-1.1.0.tgz#492f4f6ab0052c207148fd808acbdd83e79a9231"
|
||||
style-resources-loader@^1.2.1:
|
||||
version "1.2.1"
|
||||
resolved "https://registry.yarnpkg.com/style-resources-loader/-/style-resources-loader-1.2.1.tgz#7679d5dc2f27046b2fc2b83c1d5b6c1b8a9b820c"
|
||||
dependencies:
|
||||
glob "^7.1.2"
|
||||
is-callable "^1.1.4"
|
||||
is-plain-object "^2.0.4"
|
||||
is-promise "^2.1.0"
|
||||
loader-utils "^1.1.0"
|
||||
|
||||
stylehacks@^4.0.0:
|
||||
|
Loading…
Reference in New Issue
Block a user