Skip to content

Commit

Permalink
fix: add report summary skipped status when script is missing (#6139)
Browse files Browse the repository at this point in the history
  • Loading branch information
await-ovo committed Feb 27, 2023
1 parent e570adc commit 7d64d75
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .changeset/cuddly-ducks-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@pnpm/plugin-commands-script-runners": patch
"@pnpm/cli-utils": patch
"pnpm": patch
---

Add `skipped` status in exec report summary when script is missing [#6139](https://github.com/pnpm/pnpm/pull/6139).
2 changes: 1 addition & 1 deletion cli/cli-utils/src/recursiveSummary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface ActionFailure {
}

export type RecursiveSummary = Record<string, {
status: 'passed' | 'queued' | 'running'
status: 'passed' | 'queued' | 'running' | 'skipped'
duration?: number
} | ActionFailure>

Expand Down
4 changes: 3 additions & 1 deletion exec/plugin-commands-script-runners/src/runRecursive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ export async function runRecursive (
const selectedScripts = chunk.map(prefix => {
const pkg = opts.selectedProjectsGraph[prefix]
const specifiedScripts = getSpecifiedScripts(pkg.package.manifest.scripts ?? {}, scriptName)

if (!specifiedScripts.length) {
result[prefix].status = 'skipped'
}
return specifiedScripts.map(script => ({ prefix, scriptName: script }))
}).flat()

Expand Down
10 changes: 10 additions & 0 deletions exec/plugin-commands-script-runners/test/runRecursive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,10 @@ test('pnpm recursive run report summary', async () => {
build: 'exit 1',
},
},
{
name: 'project-5',
version: '1.0.0',
},
])
let error
try {
Expand All @@ -1033,6 +1037,7 @@ test('pnpm recursive run report summary', async () => {
expect(executionStatus[path.resolve('project-3')].duration).not.toBeFalsy()
expect(executionStatus[path.resolve('project-4')].status).toBe('failure')
expect(executionStatus[path.resolve('project-4')].duration).not.toBeFalsy()
expect(executionStatus[path.resolve('project-5')].status).toBe('skipped')
})

test('pnpm recursive run report summary with --bail', async () => {
Expand Down Expand Up @@ -1065,6 +1070,10 @@ test('pnpm recursive run report summary with --bail', async () => {
build: 'exit 1',
},
},
{
name: 'project-5',
version: '1.0.0',
},
])
let error
try {
Expand All @@ -1090,4 +1099,5 @@ test('pnpm recursive run report summary with --bail', async () => {
expect(executionStatus[path.resolve('project-2')].duration).not.toBeFalsy()
expect(executionStatus[path.resolve('project-3')].status).toBe('running')
expect(executionStatus[path.resolve('project-4')].status).toBe('queued')
expect(executionStatus[path.resolve('project-5')].status).toBe('skipped')
})

0 comments on commit 7d64d75

Please sign in to comment.