summaryrefslogtreecommitdiff
path: root/cli/tests/integration/test_tests.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/tests/integration/test_tests.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/tests/integration/test_tests.rs')
-rw-r--r--cli/tests/integration/test_tests.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/cli/tests/integration/test_tests.rs b/cli/tests/integration/test_tests.rs
index 04465dd53..030da05e1 100644
--- a/cli/tests/integration/test_tests.rs
+++ b/cli/tests/integration/test_tests.rs
@@ -356,6 +356,25 @@ itest!(steps_dot_ignored_steps {
output: "test/steps/ignored_steps.dot.out",
});
+itest!(steps_tap_passing_steps {
+ args: "test --reporter=tap test/steps/passing_steps.ts",
+ exit_code: 0,
+ output: "test/steps/passing_steps.tap.out",
+});
+
+itest!(steps_tap_failing_steps {
+ args: "test --reporter=tap test/steps/failing_steps.ts",
+ exit_code: 1,
+ envs: vec![("NO_COLOR".to_owned(), "1".to_owned())],
+ output: "test/steps/failing_steps.tap.out",
+});
+
+itest!(steps_tap_ignored_steps {
+ args: "test --reporter=tap test/steps/ignored_steps.ts",
+ exit_code: 0,
+ output: "test/steps/ignored_steps.tap.out",
+});
+
itest!(steps_invalid_usage {
args: "test test/steps/invalid_usage.ts",
exit_code: 1,