mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
refactor: options.test from env CI or test
This commit is contained in:
parent
11bd31e788
commit
c4792d247b
@ -110,7 +110,7 @@ export default class WebpackClientConfig extends WebpackBaseConfig {
|
||||
}
|
||||
|
||||
// Add friendly error plugin
|
||||
if (this.options.dev) {
|
||||
if (this.options.dev && !this.options.test) {
|
||||
config.plugins.push(
|
||||
new FriendlyErrorsWebpackPlugin({
|
||||
clearConsole: true,
|
||||
|
@ -10,6 +10,7 @@ export default {
|
||||
// Information about running environment
|
||||
dev: Boolean(env.dev),
|
||||
debug: undefined, // = dev
|
||||
test: Boolean(env.ci || env.test),
|
||||
|
||||
// Mode
|
||||
mode: 'universal',
|
||||
|
@ -190,7 +190,7 @@ Options.from = function (_options) {
|
||||
options.build.optimization.splitChunks.name = true
|
||||
}
|
||||
|
||||
if (options.build.stats === 'none') {
|
||||
if (options.build.stats === 'none' || options.test === true) {
|
||||
options.build.stats = false
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,6 @@ let page = null
|
||||
// Init nuxt.js and create server listening on localhost:4003
|
||||
test.serial('Init Nuxt.js', async (t) => {
|
||||
const options = {
|
||||
test: true,
|
||||
rootDir: resolve(__dirname, 'fixtures/basic'),
|
||||
buildDir: '.nuxt-csr',
|
||||
dev: true,
|
||||
|
@ -9,7 +9,6 @@ let transpile = null
|
||||
describe('basic dev', () => {
|
||||
beforeAll(async () => {
|
||||
const config = loadFixture('basic', {
|
||||
test: true,
|
||||
dev: true,
|
||||
debug: true,
|
||||
buildDir: '.nuxt-dev',
|
||||
|
@ -7,7 +7,7 @@ describe('nuxt', () => {
|
||||
})
|
||||
|
||||
test('Nuxt.js Instance', async () => {
|
||||
const config = loadFixture('empty', { test: true })
|
||||
const config = loadFixture('empty')
|
||||
const nuxt = new Nuxt(config)
|
||||
|
||||
expect(typeof nuxt).toBe('object')
|
||||
@ -33,7 +33,7 @@ describe('nuxt', () => {
|
||||
})
|
||||
|
||||
test('Build with default page when no pages/ directory', async () => {
|
||||
const nuxt = new Nuxt({ test: true })
|
||||
const nuxt = new Nuxt()
|
||||
new Builder(nuxt).build()
|
||||
const port = await getPort()
|
||||
await nuxt.listen(port, 'localhost')
|
||||
@ -46,7 +46,6 @@ describe('nuxt', () => {
|
||||
|
||||
test('Fail to build when specified plugin isn\'t found', () => {
|
||||
const nuxt = new Nuxt({
|
||||
test: true,
|
||||
dev: false,
|
||||
rootDir: resolve(__dirname, '..', 'fixtures', 'missing-plugin')
|
||||
})
|
||||
|
@ -2,9 +2,7 @@ import { loadFixture, Nuxt, Builder } from './index'
|
||||
|
||||
export const buildFixture = function buildFixture(fixture) {
|
||||
test(`Build ${fixture}`, async () => {
|
||||
const config = loadFixture(fixture, {
|
||||
test: true
|
||||
})
|
||||
const config = loadFixture(fixture)
|
||||
const nuxt = new Nuxt(config)
|
||||
const buildDone = jest.fn()
|
||||
nuxt.hook('build:done', buildDone)
|
||||
|
Loading…
Reference in New Issue
Block a user