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 { table, getBorderCharacters } from 'table'
|
||||
import isPrimitive from 'is-primitive'
|
||||
import stdenv from 'std-env'
|
||||
import type { ServerMiddleware } from '../../server/middleware'
|
||||
import virtual from './virtual'
|
||||
|
||||
@ -13,13 +14,17 @@ export function middleware (getMiddleware: () => ServerMiddleware[]) {
|
||||
return virtual({
|
||||
'~serverMiddleware': () => {
|
||||
const middleware = getMiddleware()
|
||||
const dumped = dumpMiddleware(middleware)
|
||||
if (dumped !== lastDump) {
|
||||
lastDump = dumped
|
||||
if (middleware.length) {
|
||||
console.log('\n\nNitro middleware:\n' + dumped)
|
||||
|
||||
if (!stdenv.test) {
|
||||
const dumped = dumpMiddleware(middleware)
|
||||
if (dumped !== lastDump) {
|
||||
lastDump = dumped
|
||||
if (middleware.length) {
|
||||
console.log('\n\nNitro middleware:\n' + dumped)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return `
|
||||
${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 { readFile } from 'fs-extra'
|
||||
import chalk from 'chalk'
|
||||
import stdenv from 'std-env'
|
||||
|
||||
export async function printFSTree (dir) {
|
||||
if (stdenv.test) {
|
||||
return
|
||||
}
|
||||
|
||||
const files = await globby('**/*.*', { cwd: dir })
|
||||
|
||||
const items = (await Promise.all(files.map(async (file) => {
|
||||
|
Loading…
Reference in New Issue
Block a user