mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
fix: don't show filtered test suites as running (#20385)
This commit is contained in:
parent
147c845c95
commit
e0a269c23a
4 changed files with 22 additions and 2 deletions
|
@ -278,6 +278,12 @@ itest!(clear_timeout {
|
|||
output: "test/clear_timeout.out",
|
||||
});
|
||||
|
||||
itest!(hide_empty_suites {
|
||||
args: "test --filter none test/pass.ts",
|
||||
exit_code: 0,
|
||||
output: "test/hide_empty_suites.out",
|
||||
});
|
||||
|
||||
itest!(finally_timeout {
|
||||
args: "test test/finally_timeout.ts",
|
||||
exit_code: 1,
|
||||
|
|
4
cli/tests/testdata/test/hide_empty_suites.out
vendored
Normal file
4
cli/tests/testdata/test/hide_empty_suites.out
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
Check [WILDCARD]/test/pass.ts
|
||||
|
||||
ok | 0 passed | 0 failed | 16 filtered out ([WILDCARD])
|
||||
|
|
@ -343,6 +343,7 @@ struct TestSpecifiersOptions {
|
|||
concurrent_jobs: NonZeroUsize,
|
||||
fail_fast: Option<NonZeroUsize>,
|
||||
log_level: Option<log::Level>,
|
||||
filter: bool,
|
||||
specifier: TestSpecifierOptions,
|
||||
reporter: TestReporterConfig,
|
||||
junit_path: Option<String>,
|
||||
|
@ -384,6 +385,7 @@ fn get_test_reporter(options: &TestSpecifiersOptions) -> Box<dyn TestReporter> {
|
|||
TestReporterConfig::Pretty => Box::new(PrettyTestReporter::new(
|
||||
parallel,
|
||||
options.log_level != Some(Level::Error),
|
||||
options.filter,
|
||||
)),
|
||||
TestReporterConfig::Junit => {
|
||||
Box::new(JunitTestReporter::new("-".to_string()))
|
||||
|
@ -1144,6 +1146,7 @@ pub async fn run_tests(
|
|||
concurrent_jobs: test_options.concurrent_jobs,
|
||||
fail_fast: test_options.fail_fast,
|
||||
log_level,
|
||||
filter: test_options.filter.is_some(),
|
||||
reporter: test_options.reporter,
|
||||
junit_path: test_options.junit_path,
|
||||
specifier: TestSpecifierOptions {
|
||||
|
@ -1276,6 +1279,7 @@ pub async fn run_tests_with_watch(
|
|||
concurrent_jobs: test_options.concurrent_jobs,
|
||||
fail_fast: test_options.fail_fast,
|
||||
log_level,
|
||||
filter: test_options.filter.is_some(),
|
||||
reporter: test_options.reporter,
|
||||
junit_path: test_options.junit_path,
|
||||
specifier: TestSpecifierOptions {
|
||||
|
|
|
@ -8,6 +8,7 @@ pub struct PrettyTestReporter {
|
|||
parallel: bool,
|
||||
echo_output: bool,
|
||||
in_new_line: bool,
|
||||
filter: bool,
|
||||
scope_test_id: Option<usize>,
|
||||
cwd: Url,
|
||||
did_have_user_output: bool,
|
||||
|
@ -18,11 +19,16 @@ pub struct PrettyTestReporter {
|
|||
}
|
||||
|
||||
impl PrettyTestReporter {
|
||||
pub fn new(parallel: bool, echo_output: bool) -> PrettyTestReporter {
|
||||
pub fn new(
|
||||
parallel: bool,
|
||||
echo_output: bool,
|
||||
filter: bool,
|
||||
) -> PrettyTestReporter {
|
||||
PrettyTestReporter {
|
||||
parallel,
|
||||
echo_output,
|
||||
in_new_line: true,
|
||||
filter,
|
||||
scope_test_id: None,
|
||||
cwd: Url::from_directory_path(std::env::current_dir().unwrap()).unwrap(),
|
||||
did_have_user_output: false,
|
||||
|
@ -133,7 +139,7 @@ impl TestReporter for PrettyTestReporter {
|
|||
fn report_plan(&mut self, plan: &TestPlan) {
|
||||
self.summary.total += plan.total;
|
||||
self.summary.filtered_out += plan.filtered_out;
|
||||
if self.parallel {
|
||||
if self.parallel || (self.filter && plan.total == 0) {
|
||||
return;
|
||||
}
|
||||
let inflection = if plan.total == 1 { "test" } else { "tests" };
|
||||
|
|
Loading…
Reference in a new issue