mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-10-15 04:18:05 +00:00
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.
This commit is contained in:
parent
df94193d62
commit
de2e296ca3
1 changed files with 14 additions and 3 deletions
|
|
@ -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');
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue