diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2020-06-30 21:10:51 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-30 13:10:51 +0200 |
commit | 062d1a41ea6ab22bab36e54d1f1222fc09351bf3 (patch) | |
tree | b954d72e6214bf7d0f11837a97424209606fbad9 /cli/global_state.rs | |
parent | 6844c3ac0ea4afcb799bba4945b400a011eb5d84 (diff) |
refactor: Improvements to TsCompiler and its tests (#6576)
Diffstat (limited to 'cli/global_state.rs')
-rw-r--r-- | cli/global_state.rs | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/cli/global_state.rs b/cli/global_state.rs index f3a35be3c..ef5814f90 100644 --- a/cli/global_state.rs +++ b/cli/global_state.rs @@ -70,9 +70,8 @@ impl GlobalState { let ts_compiler = TsCompiler::new( file_fetcher.clone(), + flags.clone(), dir.gen_cache.clone(), - !flags.reload, - flags.config_path.clone(), )?; // Note: reads lazily from disk on first call to lockfile.check() @@ -155,7 +154,7 @@ impl GlobalState { if should_compile { self .ts_compiler - .compile_module_graph( + .compile( self.clone(), &out, target_lib, @@ -245,12 +244,19 @@ impl GlobalState { } #[cfg(test)] - pub fn mock(argv: Vec<String>) -> GlobalState { - GlobalState::new(flags::Flags { - argv, - ..flags::Flags::default() - }) - .unwrap() + pub fn mock( + argv: Vec<String>, + maybe_flags: Option<flags::Flags>, + ) -> GlobalState { + if let Some(in_flags) = maybe_flags { + GlobalState::new(flags::Flags { argv, ..in_flags }).unwrap() + } else { + GlobalState::new(flags::Flags { + argv, + ..flags::Flags::default() + }) + .unwrap() + } } } @@ -312,7 +318,7 @@ fn needs_compilation( #[test] fn thread_safe() { fn f<S: Send + Sync>(_: S) {} - f(GlobalState::mock(vec![])); + f(GlobalState::mock(vec![], None)); } #[test] |