Skip to content

Commit

Permalink
fix(default-reporter): use loglevel to filter deprecation warnings (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
milahu committed Mar 30, 2022
1 parent 5581e4e commit 06f2aaf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/default-reporter/src/reporterForClient/index.ts
Expand Up @@ -75,7 +75,11 @@ export default function (
cwd,
width,
}),
reportDeprecations(log$.deprecation, { cwd, isRecursive: opts.isRecursive }),
reportDeprecations(log$.deprecation, {
cwd,
isRecursive: opts.isRecursive,
logLevel: opts.logLevel,
}),
reportMisc(
log$,
{
Expand Down
@@ -1,18 +1,23 @@
import { DeprecationLog } from '@pnpm/core-loggers'
import * as Rx from 'rxjs'
import { map } from 'rxjs/operators'
import { filter, map } from 'rxjs/operators'
import chalk from 'chalk'
import formatWarn from './utils/formatWarn'
import { zoomOut } from './utils/zooming'
import type { LogLevel } from '@pnpm/logger'

export default (
deprecation$: Rx.Observable<DeprecationLog>,
opts: {
cwd: string
isRecursive: boolean
logLevel?: LogLevel
}
) => {
return deprecation$.pipe(
// print deprecation warnings for all logLevel except error = warn info debug
// TODO unswitch -> return a "null pipe"
filter(() => opts.logLevel != 'error'),
map((log) => {
if (!opts.isRecursive && log.prefix === opts.cwd) {
return Rx.of({
Expand Down

0 comments on commit 06f2aaf

Please sign in to comment.