summaryrefslogtreecommitdiff
path: root/cli/tools/test/mod.rs
diff options
context:
space:
mode:
authorValentin Anger <syrupthinker@gryphno.de>2023-08-26 01:19:23 +0200
committerGitHub <noreply@github.com>2023-08-26 01:19:23 +0200
commita526cff0a9888a475d5b542efda443fe720a93d0 (patch)
tree9e6245c6ce5af9c25bd9cac11bd591d609edd504 /cli/tools/test/mod.rs
parent8bb4e10881730576bbb82e54ede1ebf5931194c3 (diff)
feat(cli/tools): add TAP test reporter (#14390) (#20073)
This PR adds a test reporter for the [Test Anything Protocol](https://testanything.org). It makes the following implementation decisions: - No TODO pragma, as there is no such marker in `Deno.test` - SKIP pragma for `ignore`d tests - Test steps are treated as TAP14 subtests - Support for this in consumers seems spotty - Some consumers will incorrectly interpret these markers, resulting in unexpected output - Considering the lack of support, and to avoid implementation complexity, subtests are at most one level deep (all test steps are in the same subtest) - To accommodate consumers that use comments to indicate test-suites (unspecced) - The test module path is output as a comment - This is disabled for `--parallel` testing - Failure diagnostics are output as JSON, which is also valid YAML - The structure is not specified, so the format roughly follows the spec example: ``` --- message: "Failed with error 'hostname peebles.example.com not found'" severity: fail found: hostname: 'peebles.example.com' address: ~ wanted: hostname: 'peebles.example.com' address: '85.193.201.85' at: file: test/dns-resolve.c line: 142 ... ```
Diffstat (limited to 'cli/tools/test/mod.rs')
-rw-r--r--cli/tools/test/mod.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/cli/tools/test/mod.rs b/cli/tools/test/mod.rs
index 365b83268..9ad205e2e 100644
--- a/cli/tools/test/mod.rs
+++ b/cli/tools/test/mod.rs
@@ -89,6 +89,7 @@ use reporters::CompoundTestReporter;
use reporters::DotTestReporter;
use reporters::JunitTestReporter;
use reporters::PrettyTestReporter;
+use reporters::TapTestReporter;
use reporters::TestReporter;
/// The test mode is used to determine how a specifier is to be tested.
@@ -404,6 +405,9 @@ fn get_test_reporter(options: &TestSpecifiersOptions) -> Box<dyn TestReporter> {
TestReporterConfig::Junit => {
Box::new(JunitTestReporter::new("-".to_string()))
}
+ TestReporterConfig::Tap => Box::new(TapTestReporter::new(
+ options.concurrent_jobs > NonZeroUsize::new(1).unwrap(),
+ )),
};
if let Some(junit_path) = &options.junit_path {