Skip to content
This repository was archived by the owner on Oct 25, 2023. It is now read-only.

Commit 99c804d

Browse files
committed
fix: sort paths in hashmap values
1 parent eafb8ad commit 99c804d

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

src/lib.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ pub fn tsconfig_includes(
249249
}
250250

251251
/// Enumerate source code files used by the TypeScript compiler during
252-
/// compilation. The return value is a list of relative paths from the monorepo
253-
/// root, grouped by scoped package name.
252+
/// compilation. The return value is a list of alphabetically-sorted relative
253+
/// paths from the monorepo root, grouped by scoped package name.
254254
pub fn tsconfig_includes_by_package_name(
255255
tsconfig: &Path,
256256
calculation_type: Calculation,
@@ -314,11 +314,12 @@ pub fn tsconfig_includes_by_package_name(
314314
.parent()
315315
.unwrap()
316316
.join("tsconfig.json");
317-
let included = match calculation_type {
317+
let mut included_files = match calculation_type {
318318
Calculation::Estimate => tsconfig_includes_estimate(&monorepo_root, tsconfig),
319319
Calculation::Exact => tsconfig_includes_exact(&monorepo_root, tsconfig),
320320
}?;
321-
Ok((manifest.contents.name.clone(), included))
321+
included_files.sort_unstable();
322+
Ok((manifest.contents.name.clone(), included_files))
322323
})
323324
.collect::<Result<HashMap<_, _>, _>>()?;
324325

tests/estimate-by-package-name.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ fn list_happy_path_dependencies_bar() {
3131
&[
3232
("bar", "packages/bar/src/bin.ts"),
3333
("bar", "packages/bar/src/index.ts"),
34-
("foo", "packages/foo/src/lib.ts"),
3534
("foo", "packages/foo/src/index.ts"),
35+
("foo", "packages/foo/src/lib.ts"),
3636
],
3737
);
3838
}
@@ -42,8 +42,8 @@ fn list_happy_path_dependencies_foo() {
4242
check(
4343
"test-data/happy-path/packages/foo/tsconfig.json",
4444
&[
45-
("foo", "packages/foo/src/lib.ts"),
4645
("foo", "packages/foo/src/index.ts"),
46+
("foo", "packages/foo/src/lib.ts"),
4747
],
4848
);
4949
}

0 commit comments

Comments
 (0)