fix(reporter): don't print installation context for the dlx command (#5559)

This commit is contained in:
Zoltan Kochan
2022-10-28 23:25:28 +03:00
committed by GitHub
parent 3c36e7e021
commit 0018cd03ed
3 changed files with 41 additions and 1 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/default-reporter": patch
"pnpm": patch
---
Don't print context information when running install for the `pnpm dlx` command.

View File

@@ -93,10 +93,13 @@ export function reporterForClient (
reportScope(log$.scope, { isRecursive: opts.isRecursive, cmd: opts.cmd }),
reportSkippedOptionalDependencies(log$.skippedOptionalDependency, { cwd }),
reportHooks(log$.hook, { cwd, isRecursive: opts.isRecursive }),
reportContext(log$, { cwd }),
reportUpdateCheck(log$.updateCheck, opts),
]
if (opts.cmd !== 'dlx') {
outputs.push(reportContext(log$, { cwd }))
}
if (PRINT_EXECUTION_TIME_IN_COMMANDS[opts.cmd]) {
outputs.push(reportExecutionTime(log$.executionTime))
}

View File

@@ -66,3 +66,34 @@ test('do not print info if not fresh install', (done) => {
subscription.unsubscribe()
}, 10)
})
test('do not print info if dlx is the executed command', (done) => {
const output$ = toOutput$({
context: {
argv: ['dlx'],
},
streamParser: createStreamParser(),
})
contextLogger.debug({
currentLockfileExists: false,
storeDir: '~/.pnpm-store/v3',
virtualStoreDir: 'node_modules/.pnpm',
})
packageImportMethodLogger.debug({
method: 'hardlink',
})
const subscription = output$.subscribe({
complete: () => done(),
error: done,
next: (msg) => {
expect(msg).toBeFalsy()
},
})
setTimeout(() => {
done()
subscription.unsubscribe()
}, 10)
})