Skip to content

Commit 048a7e8

Browse files
klkvrrplusq
authored andcommitted
fix(forge test): install missing dependencies before creating Project (foundry-rs#9379)
* fix(forge test): install missing dependencies before instantiating the project * optimization
1 parent f824e29 commit 048a7e8

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

crates/config/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -904,6 +904,9 @@ impl Config {
904904
) -> Result<BTreeMap<PathBuf, RestrictionsWithVersion<MultiCompilerRestrictions>>, SolcError>
905905
{
906906
let mut map = BTreeMap::new();
907+
if self.compilation_restrictions.is_empty() {
908+
return Ok(BTreeMap::new());
909+
}
907910

908911
let graph = Graph::<MultiCompilerParsedSource>::resolve(paths)?;
909912
let (sources, _) = graph.into_sources();

crates/forge/bin/cmd/test/mod.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -280,16 +280,15 @@ impl TestArgs {
280280
config.invariant.gas_report_samples = 0;
281281
}
282282

283-
// Set up the project.
284-
let mut project = config.project()?;
285-
286283
// Install missing dependencies.
287284
if install::install_missing_dependencies(&mut config) && config.auto_detect_remappings {
288285
// need to re-configure here to also catch additional remappings
289286
config = self.load_config();
290-
project = config.project()?;
291287
}
292288

289+
// Set up the project.
290+
let project = config.project()?;
291+
293292
let mut filter = self.filter(&config);
294293
trace!(target: "forge::test", ?filter, "using filter");
295294

0 commit comments

Comments
 (0)