fix(deps.status): skip engine check when scanning workspace projects (#11592)

* fix(deps.status): skip engine check when scanning workspace projects

checkDepsStatus (run by verifyDepsBeforeRun) called findWorkspaceProjects
without a nodeVersion, so the engine check fell back to the system Node from
PATH and emitted spurious "Unsupported engine" warnings before scripts ran.
The actual install still does engine validation; a status check shouldn't.

* test(pnpm): cover engine warning regression for verifyDepsBeforeRun

* docs(changeset): clarify scope of the skipped validation

* test(pnpm): also check stderr for unsupported engine warning
This commit is contained in:
Zoltan Kochan
2026-05-12 00:22:57 +02:00
committed by GitHub
parent 732312f49e
commit 02e9cf5b67
3 changed files with 51 additions and 3 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/deps.status": patch
"pnpm": patch
---
Skip installability validation when scanning workspace projects in `checkDepsStatus` (run by `verifyDepsBeforeRun`). Previously the status check called `findWorkspaceProjects`, which validates each project's `engines` and `os`/`cpu`/`libc` and warns about useless fields in non-root manifests — work that the install pipeline already performs. With no `nodeVersion` threaded through, the engine check also fell back to the system Node from `PATH` and emitted spurious "Unsupported engine" warnings before scripts ran. Status-only callers now use `findWorkspaceProjectsNoCheck`; install paths continue to validate.

View File

@@ -32,7 +32,7 @@ import type {
ProjectId,
ProjectManifest,
} from '@pnpm/types'
import { findWorkspaceProjects } from '@pnpm/workspace.projects-reader'
import { findWorkspaceProjectsNoCheck } from '@pnpm/workspace.projects-reader'
import { loadWorkspaceState, updateWorkspaceState, type WorkspaceState, type WorkspaceStateSettings } from '@pnpm/workspace.state'
import { readWorkspaceManifest } from '@pnpm/workspace.workspace-manifest-reader'
import { equals, filter, isEmpty, once } from 'ramda'
@@ -353,9 +353,8 @@ async function _checkDepsStatus (opts: CheckDepsStatusOptions, workspaceState: W
const workspaceRoot = workspaceDir ?? rootProjectManifestDir
const workspaceManifest = await readWorkspaceManifest(workspaceRoot)
if (workspaceManifest ?? workspaceDir) {
const allProjects = await findWorkspaceProjects(rootProjectManifestDir, {
const allProjects = await findWorkspaceProjectsNoCheck(rootProjectManifestDir, {
patterns: workspaceManifest?.packages,
sharedWorkspaceLockfile,
})
return checkDepsStatus({
...opts,

View File

@@ -0,0 +1,43 @@
import { expect, test } from '@jest/globals'
import { preparePackages } from '@pnpm/prepare'
import type { ProjectManifest } from '@pnpm/types'
import { writeYamlFileSync } from 'write-yaml-file'
import { execPnpm, execPnpmSync } from '../utils/index.js'
test('verify-deps-before-run does not emit unsupported engine warnings for workspace projects', async () => {
const manifests: Record<string, ProjectManifest> = {
root: {
name: 'root',
private: true,
scripts: {
start: 'echo hello from root',
},
},
'has-strict-engine': {
name: 'has-strict-engine',
private: true,
engines: {
node: '>=99.0.0',
},
scripts: {
start: 'echo hello from has-strict-engine',
},
},
}
preparePackages([
{ location: '.', package: manifests.root },
manifests['has-strict-engine'],
])
writeYamlFileSync('pnpm-workspace.yaml', { packages: ['**', '!store/**'] })
await execPnpm(['install'])
const { stdout, stderr } = execPnpmSync(['--config.verify-deps-before-run=install', 'start'], {
expectSuccess: true,
})
expect(stdout.toString()).toContain('hello from root')
expect(stdout.toString() + stderr.toString()).not.toContain('Unsupported engine')
})