diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2020-10-29 21:18:18 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-29 21:18:18 +1100 |
commit | b0482400c96476946514f03f27f139dd505b06fb (patch) | |
tree | bbca9156c79a5de1e42354b6af5ab73c88ffc05e /cli/module_graph2.rs | |
parent | bfce376c685694569be2cbf0716dd58f898c111e (diff) |
fix(cli): make hashes of tsconfig deterministic (#8167)
Fixes #8163
Diffstat (limited to 'cli/module_graph2.rs')
-rw-r--r-- | cli/module_graph2.rs | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/cli/module_graph2.rs b/cli/module_graph2.rs index df2e5fc61..3fc900373 100644 --- a/cli/module_graph2.rs +++ b/cli/module_graph2.rs @@ -1735,6 +1735,51 @@ pub mod tests { } #[tokio::test] + async fn test_graph_check_user_config() { + let specifier = + ModuleSpecifier::resolve_url_or_path("file:///tests/checkwithconfig.ts") + .expect("could not resolve module"); + let (graph, handler) = setup(specifier.clone()).await; + let (_, diagnostics, maybe_ignored_options) = graph + .check(CheckOptions { + debug: false, + emit: true, + lib: TypeLib::DenoWindow, + maybe_config_path: Some( + "tests/module_graph/tsconfig_01.json".to_string(), + ), + reload: true, + }) + .expect("should have checked"); + assert!(maybe_ignored_options.is_none()); + assert!(diagnostics.is_empty()); + let h = handler.borrow(); + assert_eq!(h.version_calls.len(), 2); + let ver0 = h.version_calls[0].1.clone(); + let ver1 = h.version_calls[1].1.clone(); + + // let's do it all over again to ensure that the versions are determinstic + let (graph, handler) = setup(specifier).await; + let (_, diagnostics, maybe_ignored_options) = graph + .check(CheckOptions { + debug: false, + emit: true, + lib: TypeLib::DenoWindow, + maybe_config_path: Some( + "tests/module_graph/tsconfig_01.json".to_string(), + ), + reload: true, + }) + .expect("should have checked"); + assert!(maybe_ignored_options.is_none()); + assert!(diagnostics.is_empty()); + let h = handler.borrow(); + assert_eq!(h.version_calls.len(), 2); + assert!(h.version_calls[0].1 == ver0 || h.version_calls[0].1 == ver1); + assert!(h.version_calls[1].1 == ver0 || h.version_calls[1].1 == ver1); + } + + #[tokio::test] async fn test_graph_info() { let specifier = ModuleSpecifier::resolve_url_or_path("file:///tests/main.ts") |