mirror of
https://github.com/pnpm/pnpm.git
synced 2025-12-23 23:29:17 -05:00
fix(default-reporter): should print error summary as expected (#6345)
* fix(default-reporter): should print error summary as expected * docs: add changeset
This commit is contained in:
6
.changeset/red-knives-decide.md
Normal file
6
.changeset/red-knives-decide.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/default-reporter": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
Should report error summary as expected.
|
||||
@@ -258,10 +258,10 @@ function reportLockfileBreakingChange (err: Error, msg: object) {
|
||||
}
|
||||
}
|
||||
|
||||
function formatRecursiveCommandSummary (msg: { fails: Array<Error & { prefix: string }>, passes: number }) {
|
||||
const output = EOL + `Summary: ${chalk.red(`${msg.fails.length} fails`)}, ${msg.passes} passes` + EOL + EOL +
|
||||
msg.fails.map((fail) => {
|
||||
return fail.prefix + ':' + EOL + formatErrorSummary(fail.message)
|
||||
function formatRecursiveCommandSummary (msg: { failures: Array<Error & { prefix: string }>, passes: number }) {
|
||||
const output = EOL + `Summary: ${chalk.red(`${msg.failures.length} fails`)}, ${msg.passes} passes` + EOL + EOL +
|
||||
msg.failures.map(({ message, prefix }) => {
|
||||
return prefix + ':' + EOL + formatErrorSummary(message)
|
||||
}).join(EOL + EOL)
|
||||
return {
|
||||
title: '',
|
||||
|
||||
@@ -572,7 +572,7 @@ ${formatError('ERROR', 'f failed')}`)
|
||||
})
|
||||
|
||||
const err = new PnpmError('RECURSIVE_FAIL', '...')
|
||||
err['fails'] = [
|
||||
err['failures'] = [
|
||||
{
|
||||
message: 'a failed',
|
||||
prefix: '/a',
|
||||
|
||||
@@ -47,3 +47,36 @@ test('should clean up child processes when process exited', async () => {
|
||||
expect(await isPortInUse(9990)).toBe(false)
|
||||
expect(await isPortInUse(9999)).toBe(false)
|
||||
})
|
||||
|
||||
test('should print error summary when some packages fail with --no-bail', async () => {
|
||||
preparePackages([
|
||||
{
|
||||
location: 'project-1',
|
||||
package: {
|
||||
scripts: {
|
||||
build: 'echo "build project-1"',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'project-2',
|
||||
version: '1.0.0',
|
||||
scripts: {
|
||||
build: 'exit 1',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'project-3',
|
||||
version: '1.0.0',
|
||||
scripts: {
|
||||
build: 'echo "build project-3"',
|
||||
},
|
||||
},
|
||||
])
|
||||
await writeYamlFile('pnpm-workspace.yaml', { packages: ['**', '!store/**'] })
|
||||
const { stdout } = execPnpmSync(['-r', '--no-bail', 'run', 'build'])
|
||||
const output = stdout.toString()
|
||||
expect(output).toContain('ERR_PNPM_RECURSIVE_FAIL')
|
||||
expect(output).toContain('Summary: 1 fails, 2 passes')
|
||||
expect(output).toContain('ERROR project-2@1.0.0 build: `exit 1`')
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user