Skip to content
Open
12 changes: 6 additions & 6 deletions crates/forge/src/run_tests/resolve_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ pub async fn resolve_config(
ignored: case.config.ignored
|| (env_ignore_fork_tests && case.config.fork_config.is_some()),
expected_result: case.config.expected_result,
fork_config: resolve_fork_config(
case.config.fork_config,
block_number_map,
fork_targets,
)
.await?,
fork_config: if case.config.ignored {
None
} else {
resolve_fork_config(case.config.fork_config, block_number_map, fork_targets)
.await?
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't correct, in case forge is run with --ignored or --include-ignored, they will not have their configs resolved.

We should probably split separate the steps test_target_with_config and resolve_config and call them as separate methods, not as a part of test_package_with_config_resolved.

Then we can pass TestsFilter to resolve_config and call resolve_fork_config based on if should_be_run is true for a test case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could probably make do without splitting from test_package_with_config_resolved and just passing TestFilter to the method, but it seems a bit weird to me to use test filter without we even did any kind of filtering with it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing tests_filter to test_package_with_config_resolved would require marking the ignored_filter field pub, that looks like a change that would be needing approval?

Filtering is being done there, tests which the fork config should be resolved or not is going to be dependent on the tests_filter argument being passed there, if it wasn't for that, then we'll be running into the issue described above, unless there's another way to resolve that.

fuzzer_config: case.config.fuzzer_config,
disable_predeployed_contracts: case.config.disable_predeployed_contracts,
},
Expand Down
5 changes: 4 additions & 1 deletion crates/forge/src/test_filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ impl TestCaseFilter for TestsFilter {

match self.ignored_filter {
IgnoredFilter::All => true,
IgnoredFilter::Ignored => ignored,
IgnoredFilter::Ignored => {
assert!(ignored);
true
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think we should be including this change, it's technically true given our current logic, but I think it's safer to still check if the test is ignored here since it's not very expensive.

IgnoredFilter::NotIgnored => !ignored,
}
}
Expand Down
Loading