Skip to content

test: make checkPlatform negation tests platform-independent#11411

Merged
zkochan merged 2 commits into
mainfrom
fix-os
Apr 30, 2026
Merged

test: make checkPlatform negation tests platform-independent#11411
zkochan merged 2 commits into
mainfrom
fix-os

Conversation

@zkochan

@zkochan zkochan commented Apr 30, 2026

Copy link
Copy Markdown
Member

Summary

  • The two supportedArchitectures negation tests added in fix: negated os / cpu skipped under multi-platform supportedArchitectures #11375 used 'current' alongside a value the wanted platform's negation could match on some hosts (e.g. os: ['linux', 'current'] on Windows expands to ['linux', 'win32'], which is correctly rejected by ['!win32']). The expected null only held on non-Windows runners.
  • Replace 'current' with fixed second values ('darwin', 'arm64') so the multi-value code path that fix: negated os / cpu skipped under multi-platform supportedArchitectures #11375 fixed is still exercised, but the test result no longer depends on process.platform / process.arch.
  • Production logic in checkPlatform is correct and unchanged — supportedArchitectures requires all listed targets to be supported, and a package declaring !win32 genuinely cannot satisfy a Windows host that's also asked to install for linux.

Test plan

  • pnpm --filter @pnpm/config.package-is-installable test (20/20 pass on macOS/arm64)
  • CI green on Windows runners

zkochan added 2 commits April 30, 2026 20:27
The two multi-valued supportedArchitectures tests added in #11375 used
'current' alongside a value that the negation in the wanted platform
matched on some hosts (e.g. ['linux', 'current'] on Windows expands to
['linux', 'win32'], which is correctly rejected by ['!win32']). Replace
'current' with fixed second values so the multi-value code path is still
exercised without depending on process.platform / process.arch.
Restores the more realistic scenario from #11375 where supportedArchitectures
mixes a fixed value with 'current'. Mock process.platform / process.arch
explicitly per test so the result no longer depends on the host CI runner.
@zkochan zkochan merged commit e6aca55 into main Apr 30, 2026
12 checks passed
@zkochan zkochan deleted the fix-os branch April 30, 2026 20:07
zkochan added a commit that referenced this pull request Apr 30, 2026
* test: make checkPlatform negation tests platform-independent

The two multi-valued supportedArchitectures tests added in #11375 used
'current' alongside a value that the negation in the wanted platform
matched on some hosts (e.g. ['linux', 'current'] on Windows expands to
['linux', 'win32'], which is correctly rejected by ['!win32']). Replace
'current' with fixed second values so the multi-value code path is still
exercised without depending on process.platform / process.arch.

* test: mock process.platform / process.arch instead of avoiding 'current'

Restores the more realistic scenario from #11375 where supportedArchitectures
mixes a fixed value with 'current'. Mock process.platform / process.arch
explicitly per test so the result no longer depends on the host CI runner.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant