mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 15:15:19 +00:00
chore: disable verbose output in test environment
This commit is contained in:
parent
8a22fa333e
commit
b7b9fbf927
@ -2,6 +2,7 @@ import hasha from 'hasha'
|
|||||||
import { relative } from 'upath'
|
import { relative } from 'upath'
|
||||||
import { table, getBorderCharacters } from 'table'
|
import { table, getBorderCharacters } from 'table'
|
||||||
import isPrimitive from 'is-primitive'
|
import isPrimitive from 'is-primitive'
|
||||||
|
import stdenv from 'std-env'
|
||||||
import type { ServerMiddleware } from '../../server/middleware'
|
import type { ServerMiddleware } from '../../server/middleware'
|
||||||
import virtual from './virtual'
|
import virtual from './virtual'
|
||||||
|
|
||||||
@ -13,6 +14,8 @@ export function middleware (getMiddleware: () => ServerMiddleware[]) {
|
|||||||
return virtual({
|
return virtual({
|
||||||
'~serverMiddleware': () => {
|
'~serverMiddleware': () => {
|
||||||
const middleware = getMiddleware()
|
const middleware = getMiddleware()
|
||||||
|
|
||||||
|
if (!stdenv.test) {
|
||||||
const dumped = dumpMiddleware(middleware)
|
const dumped = dumpMiddleware(middleware)
|
||||||
if (dumped !== lastDump) {
|
if (dumped !== lastDump) {
|
||||||
lastDump = dumped
|
lastDump = dumped
|
||||||
@ -20,6 +23,8 @@ export function middleware (getMiddleware: () => ServerMiddleware[]) {
|
|||||||
console.log('\n\nNitro middleware:\n' + dumped)
|
console.log('\n\nNitro middleware:\n' + dumped)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return `
|
return `
|
||||||
${middleware.filter(m => m.lazy === false).map(m => `import ${getImportId(m.handle)} from '${m.handle}';`).join('\n')}
|
${middleware.filter(m => m.lazy === false).map(m => `import ${getImportId(m.handle)} from '${m.handle}';`).join('\n')}
|
||||||
|
|
||||||
|
@ -4,8 +4,13 @@ import prettyBytes from 'pretty-bytes'
|
|||||||
import gzipSize from 'gzip-size'
|
import gzipSize from 'gzip-size'
|
||||||
import { readFile } from 'fs-extra'
|
import { readFile } from 'fs-extra'
|
||||||
import chalk from 'chalk'
|
import chalk from 'chalk'
|
||||||
|
import stdenv from 'std-env'
|
||||||
|
|
||||||
export async function printFSTree (dir) {
|
export async function printFSTree (dir) {
|
||||||
|
if (stdenv.test) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const files = await globby('**/*.*', { cwd: dir })
|
const files = await globby('**/*.*', { cwd: dir })
|
||||||
|
|
||||||
const items = (await Promise.all(files.map(async (file) => {
|
const items = (await Promise.all(files.map(async (file) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user