From de2e296ca3af146f95215ec0dde72c0366087f41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20Magyar?= Date: Sat, 10 Oct 2026 13:06:05 +0100 Subject: [PATCH] test(deps): cover exact peer pins and existing-install migration Verify exact 0.25.1 peers, repeatable preparation, and migration from the previously widened peer metadata. --- .../unit/prepare-tree-sitter-bundle.test.ts | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/gitnexus/test/unit/prepare-tree-sitter-bundle.test.ts b/gitnexus/test/unit/prepare-tree-sitter-bundle.test.ts index f4337bf06..6978bfde2 100644 --- a/gitnexus/test/unit/prepare-tree-sitter-bundle.test.ts +++ b/gitnexus/test/unit/prepare-tree-sitter-bundle.test.ts @@ -73,7 +73,7 @@ afterEach(() => { }); describe('native parser bundle preparation', () => { - it('admits the tested runtime for direct and transitive peers without changing binaries', () => { + it('pins direct and transitive peers to the tested runtime without changing binaries', () => { const root = fixture(); const native = path.join(root, 'node_modules/tree-sitter-cpp/parser.node'); writeFileSync(native, Buffer.from([0, 1, 128, 255])); @@ -83,7 +83,7 @@ describe('native parser bundle preparation', () => { read(path.join(root, 'node_modules/tree-sitter-cpp/package.json')).peerDependencies[ 'tree-sitter' ], - ).toBe('^0.21.1 || 0.25.1'); + ).toBe('0.25.1'); expect( read( path.join( @@ -91,7 +91,7 @@ describe('native parser bundle preparation', () => { 'node_modules/tree-sitter-typescript/node_modules/tree-sitter-javascript/package.json', ), ).peerDependencies['tree-sitter'], - ).toBe('^0.21.1 || 0.25.1'); + ).toBe('0.25.1'); expect( read(path.join(root, 'node_modules/tree-sitter-javascript/package.json')).peerDependencies[ 'tree-sitter' @@ -102,6 +102,17 @@ describe('native parser bundle preparation', () => { expect(read(path.join(root, 'package.json')).dependencies).toEqual(directVersions); }); + it('migrates previously widened peer ranges to the exact runtime', () => { + const root = fixture(); + const file = path.join(root, 'node_modules/tree-sitter-cpp/package.json'); + const pkg = read(file); + pkg.peerDependencies['tree-sitter'] = '^0.21.1 || 0.25.1'; + write(file, pkg); + expect(prepareTreeSitterBundle(root)).toHaveLength(8); + expect(read(file).peerDependencies['tree-sitter']).toBe('0.25.1'); + expect(prepareTreeSitterBundle(root)).toHaveLength(8); + }); + it('rejects changed peer metadata before writing any package', () => { const root = fixture(); const first = path.join(root, 'node_modules/tree-sitter-c/package.json');