Skip to content

Commit

Permalink
fix(forge test): install missing dependencies before creating `Projec…
Browse files Browse the repository at this point in the history
…t` (#9379)

* fix(forge test): install missing dependencies before instantiating the project

* optimization
  • Loading branch information
klkvr authored Nov 22, 2024
1 parent 2bc7125 commit 76a2cb0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 3 additions & 0 deletions crates/config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -904,6 +904,9 @@ impl Config {
) -> Result<BTreeMap<PathBuf, RestrictionsWithVersion<MultiCompilerRestrictions>>, SolcError>
{
let mut map = BTreeMap::new();
if self.compilation_restrictions.is_empty() {
return Ok(BTreeMap::new());
}

let graph = Graph::<MultiCompilerParsedSource>::resolve(paths)?;
let (sources, _) = graph.into_sources();
Expand Down
7 changes: 3 additions & 4 deletions crates/forge/bin/cmd/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,16 +280,15 @@ impl TestArgs {
config.invariant.gas_report_samples = 0;
}

// Set up the project.
let mut project = config.project()?;

// Install missing dependencies.
if install::install_missing_dependencies(&mut config) && config.auto_detect_remappings {
// need to re-configure here to also catch additional remappings
config = self.load_config();
project = config.project()?;
}

// Set up the project.
let project = config.project()?;

let mut filter = self.filter(&config);
trace!(target: "forge::test", ?filter, "using filter");

Expand Down

0 comments on commit 76a2cb0

Please sign in to comment.