Skip to content

Commit 6ac9249

Browse files
bartlomiejuclaude
andcommitted
fix: update frozen lockfile test expectations for imara-diff
The imara-diff algorithm matches identical lines (like closing braces) as unchanged context rather than delete/insert pairs, producing more minimal diffs. Update .out files to match. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ae9f49b commit 6ac9249

11 files changed

+50
-30
lines changed

libs/resolver/display.rs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,54 @@ mod tests {
263263
run_test("test\n", "test\r\n", " | Text differed by line endings.\n");
264264
}
265265

266+
#[test]
267+
fn test_lockfile_diff() {
268+
// Simulates the frozen lockfile diff scenario where adding a new
269+
// dependency inserts lines while matching braces remain unchanged.
270+
let before = r#"{
271+
"version": "5",
272+
"packages": {
273+
"npm:@denotest/add@1": "1.0.0"
274+
},
275+
"npm": {
276+
"@denotest/add@1.0.0": {
277+
"integrity": "abc",
278+
"tarball": "http://localhost/add/1.0.0.tgz"
279+
}
280+
}
281+
}"#;
282+
let after = r#"{
283+
"version": "5",
284+
"packages": {
285+
"npm:@denotest/add@1": "1.0.0",
286+
"npm:@denotest/subtract@1": "1.0.0"
287+
},
288+
"npm": {
289+
"@denotest/add@1.0.0": {
290+
"integrity": "abc",
291+
"tarball": "http://localhost/add/1.0.0.tgz"
292+
},
293+
"@denotest/subtract@1.0.0": {
294+
"integrity": "def",
295+
"tarball": "http://localhost/subtract/1.0.0.tgz"
296+
}
297+
}
298+
}"#;
299+
run_test(
300+
before,
301+
after,
302+
concat!(
303+
" 4 | - \"npm:@denotest/add@1\": \"1.0.0\"\n",
304+
" 4 | + \"npm:@denotest/add@1\": \"1.0.0\",\n",
305+
" 5 | + \"npm:@denotest/subtract@1\": \"1.0.0\"\n",
306+
"11 | + },\n",
307+
"12 | + \"@denotest/subtract@1.0.0\": {\n",
308+
"13 | + \"integrity\": \"def\",\n",
309+
"14 | + \"tarball\": \"http://localhost/subtract/1.0.0.tgz\"\n",
310+
),
311+
);
312+
}
313+
266314
fn run_test(diff_text1: &str, diff_text2: &str, expected_output: &str) {
267315
assert_eq!(
268316
test_util::strip_ansi_codes(&diff(diff_text1, diff_text2,)),

tests/specs/lockfile/frozen_lockfile/frozen_new_dep_cache.out

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ changes:
33
4 | - "npm:@denotest/add@1": "1.0.0"
44
4 | + "npm:@denotest/add@1": "1.0.0",
55
5 | + "npm:@denotest/subtract@1": "1.0.0"
6-
10 | - }
76
11 | + },
87
12 | + "@denotest/subtract@1.0.0": {
98
13 | + "integrity": "[WILDCARD]",
109
14 | + "tarball": "http://localhost:4260/@denotest/subtract/1.0.0.tgz"
11-
15 | + }
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
Download http://localhost:4545/welcome.ts
22
error: Uncaught (in promise) TypeError: The lockfile is out of date. Run `deno install --frozen=false`, or rerun with `--frozen=false` to update it.
33
changes:
4-
11 | - }
54
11 | + },
65
12 | + "remote": {
76
13 | + "http://localhost:4545/welcome.ts": "7353d5fcbc36c45d26bcbca478cf973092523b07c45999f41319820092b4de31"
8-
14 | + }
97
const _ = await import(scheme + "localhost:4545/welcome.ts");
108
^
119
at [WILDCARD]

tests/specs/lockfile/frozen_lockfile/frozen_new_dep_dynamic_jsr.out

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@ Download http://127.0.0.1:4250/@denotest/add/1.0.0_meta.json
33
Download http://127.0.0.1:4250/@denotest/add/1.0.0/mod.ts
44
error: Uncaught (in promise) TypeError: The lockfile is out of date. Run `deno install --frozen=false`, or rerun with `--frozen=false` to update it.
55
changes:
6-
4 | - "npm:@denotest/add@1": "1.0.0"
76
4 | + "jsr:@denotest/add@1": "1.0.0",
8-
5 | + "npm:@denotest/add@1": "1.0.0"
9-
6 | + },
107
7 | + "jsr": {
118
8 | + "@denotest/add@1.0.0": {
129
9 | + "integrity": "[WILDCARD]"
1310
10 | + }
11+
11 | + },
1412
const { add } = await import(scheme + "@denotest/add@1");
1513
^
16-
at [WILDCARD]
14+
at [WILDCARD]

tests/specs/lockfile/frozen_lockfile/frozen_new_dep_dynamic_npm.out

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@ changes:
44
4 | - "npm:@denotest/add@1": "1.0.0"
55
4 | + "npm:@denotest/add@1": "1.0.0",
66
5 | + "npm:@denotest/subtract@1": "1.0.0"
7-
10 | - }
87
11 | + },
98
12 | + "@denotest/subtract@1.0.0": {
109
13 | + "integrity": "[WILDCARD]",
1110
14 | + "tarball": "http://localhost:4260/@denotest/subtract/1.0.0.tgz"
12-
15 | + }
1311
const { subtract } = await import(scheme + "@denotest/subtract@1");
1412
^
1513
at [WILDCARD]
Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
error: The lockfile is out of date. Run `deno install --frozen=false`, or rerun with `--frozen=false` to update it.
22
changes:
3-
4 | - "jsr:@denotest/add@1": "1.0.0"
4-
5 | - },
5-
6 | - "jsr": {
63
4 | + "jsr:@denotest/add@0.2.0": "0.2.0",
7-
5 | + "jsr:@denotest/add@1": "1.0.0"
8-
6 | + },
9-
7 | + "jsr": {
104
8 | + "@denotest/add@0.2.0": {
115
9 | + "integrity": "[WILDCARD]"
126
10 | + },

tests/specs/lockfile/frozen_lockfile/frozen_new_dep_jsr_run.out

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,7 @@ Download http://127.0.0.1:4250/@denotest/add/0.2.0_meta.json
22
Download http://127.0.0.1:4250/@denotest/add/0.2.0/mod.ts
33
error: The lockfile is out of date. Run `deno install --frozen=false`, or rerun with `--frozen=false` to update it.
44
changes:
5-
4 | - "jsr:@denotest/add@1": "1.0.0"
6-
5 | - },
7-
6 | - "jsr": {
85
4 | + "jsr:@denotest/add@0.2.0": "0.2.0",
9-
5 | + "jsr:@denotest/add@1": "1.0.0"
10-
6 | + },
11-
7 | + "jsr": {
126
8 | + "@denotest/add@0.2.0": {
137
9 | + "integrity": "[WILDCARD]"
148
10 | + },

tests/specs/lockfile/frozen_lockfile/frozen_new_dep_run.out

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ changes:
44
4 | - "npm:@denotest/add@1": "1.0.0"
55
4 | + "npm:@denotest/add@1": "1.0.0",
66
5 | + "npm:@denotest/subtract@1": "1.0.0"
7-
10 | - }
87
11 | + },
98
12 | + "@denotest/subtract@1.0.0": {
109
13 | + "integrity": "[WILDCARD]",
1110
14 | + "tarball": "http://localhost:4260/@denotest/subtract/1.0.0.tgz"
12-
15 | + }

tests/specs/lockfile/frozen_lockfile/frozen_package_json_changed.out

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ changes:
44
4 | - "npm:@denotest/add@1": "1.0.0"
55
4 | + "npm:@denotest/add@1": "1.0.0",
66
5 | + "npm:@denotest/bin@0.7.0": "0.7.0"
7-
10 | - }
87
11 | + },
98
12 | + "@denotest/bin@0.7.0": {
109
13 | + "integrity": "sha512-RAE7sQrdTUuV4KdDAshObhsULXb2QjTjfRg/KbzE9asZV8dUmwbPZy2kfmE2CunPo8+6DvwPklXFJ4PQi0Usuw==",
@@ -17,4 +16,3 @@ changes:
1716
20 | + "dependencies": [
1817
21 | + "npm:@denotest/bin@0.7.0"
1918
22 | + ]
20-
23 | + }

tests/specs/lockfile/frozen_lockfile/frozen_package_json_changed_install.out

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ changes:
33
4 | - "npm:@denotest/add@1": "1.0.0"
44
4 | + "npm:@denotest/add@1": "1.0.0",
55
5 | + "npm:@denotest/bin@0.7.0": "0.7.0"
6-
10 | - }
76
11 | + },
87
12 | + "@denotest/bin@0.7.0": {
98
13 | + "integrity": "sha512-RAE7sQrdTUuV4KdDAshObhsULXb2QjTjfRg/KbzE9asZV8dUmwbPZy2kfmE2CunPo8+6DvwPklXFJ4PQi0Usuw==",
@@ -16,4 +15,3 @@ changes:
1615
20 | + "dependencies": [
1716
21 | + "npm:@denotest/bin@0.7.0"
1817
22 | + ]
19-
23 | + }

0 commit comments

Comments
 (0)