tests.pnpm: add pnpm_11_v4 test for fetcherVersion 4

Tests the SQLite dump/reconstruct code path introduced in fetcherVersion 4,
which ensures reproducibility of the pnpm v11 store index.

Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Maciej Krüger
2026-05-21 19:37:13 +02:00
committed by Sefa Eyeoglu
parent f09853e8b7
commit 6f77647495
7 changed files with 136 additions and 0 deletions

View File

@@ -3,4 +3,5 @@
pnpm-empty-lockfile = callPackage ./pnpm-empty-lockfile { };
pnpm-fixup-state-db = callPackage ./pnpm-fixup-state-db { };
pnpm_11_v3 = callPackage ./pnpm_11_v3 { };
pnpm_11_v4 = callPackage ./pnpm_11_v4 { };
}

View File

@@ -0,0 +1,60 @@
{
fetchPnpmDeps,
lib,
makeShellWrapper,
nodejs,
pnpmConfigHook,
pnpm_11,
stdenv,
testers,
}:
let
pnpm = pnpm_11;
in
stdenv.mkDerivation (finalAttrs: {
pname = "pnpm-test";
inherit (pnpm) version;
src = ./src;
pnpmDeps = testers.invalidateFetcherByDrvHash fetchPnpmDeps {
inherit (finalAttrs) pname version src;
inherit pnpm;
fetcherVersion = 4;
hash = "sha256-f5EC0m+y9vvt+6alquFjdgGmH8ha1YprthBU3dnq9SE=";
};
nativeBuildInputs = [
makeShellWrapper
nodejs
pnpm
pnpmConfigHook
];
buildPhase = ''
runHook preBuild
pnpm build
runHook postBuild
'';
installPhase = ''
runHook preInstall
install -Dm644 -t $out/lib/pnpm-11-test dist/index.js
makeWrapper ${lib.getExe nodejs} $out/bin/pnpm-11-test \
--add-flags "$out/lib/pnpm-11-test"
runHook postInstall
'';
__structuredAttrs = true;
meta = {
license = lib.licenses.mit;
mainProgram = "pnpm-11-test";
inherit (pnpm.meta) maintainers;
};
})

View File

@@ -0,0 +1,2 @@
dist/
node_modules/

View File

@@ -0,0 +1 @@
console.log("Hello World");

View File

@@ -0,0 +1,20 @@
{
"name": "pnpm11test",
"version": "1.0.0",
"description": "",
"main": "dist/index.js",
"scripts": {
"build": "tsc",
"start": "node dist/index.js"
},
"license": "MIT",
"packageManager": "pnpm",
"type": "module",
"files": [
"dist/"
],
"devDependencies": {
"@types/node": "^25.5.0",
"typescript": "^6.0.2"
}
}

View File

@@ -0,0 +1,39 @@
lockfileVersion: '9.0'
settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
importers:
.:
devDependencies:
'@types/node':
specifier: ^25.5.0
version: 25.5.0
typescript:
specifier: ^6.0.2
version: 6.0.2
packages:
'@types/node@25.5.0':
resolution: {integrity: sha512-jp2P3tQMSxWugkCUKLRPVUpGaL5MVFwF8RDuSRztfwgN1wmqJeMSbKlnEtQqU8UrhTmzEmZdu2I6v2dpp7XIxw==}
typescript@6.0.2:
resolution: {integrity: sha512-bGdAIrZ0wiGDo5l8c++HWtbaNCWTS4UTv7RaTH/ThVIgjkveJt83m74bBHMJkuCbslY8ixgLBVZJIOiQlQTjfQ==}
engines: {node: '>=14.17'}
hasBin: true
undici-types@7.18.2:
resolution: {integrity: sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==}
snapshots:
'@types/node@25.5.0':
dependencies:
undici-types: 7.18.2
typescript@6.0.2: {}
undici-types@7.18.2: {}

View File

@@ -0,0 +1,13 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"outDir": "dist",
"rootDir": ".",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
}
}