summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoshiya Hinosawa <stibium121@gmail.com>2023-02-27 19:39:33 +0900
committerGitHub <noreply@github.com>2023-02-27 19:39:33 +0900
commit92ba46c384806af171f1ad9c0040146a50531e84 (patch)
tree58d1bd9c42ee143a2ba9436dcf5d16950787e178
parent5e91489db91335b38b16af78253efb86b0be310e (diff)
chore(ext/node): suppress node compat tests stdout by default (#17909)
-rw-r--r--cli/tests/node_compat/test.ts13
1 files changed, 10 insertions, 3 deletions
diff --git a/cli/tests/node_compat/test.ts b/cli/tests/node_compat/test.ts
index 4029596bd..213a27974 100644
--- a/cli/tests/node_compat/test.ts
+++ b/cli/tests/node_compat/test.ts
@@ -8,6 +8,7 @@ import { config, getPathsFromTestSuites } from "./common.ts";
// deno test -A cli/tests/node_compat/test.ts -- <test-names>
// Use the test-names as filters
const filters = Deno.args;
+const hasFilters = filters.length > 0;
/**
* This script will run the test files specified in the configuration file
@@ -78,9 +79,10 @@ for await (const path of testPaths) {
});
const { code, stdout, stderr } = await command.output();
- if (stdout.length) console.log(decoder.decode(stdout));
-
if (code !== 0) {
+ // If the test case failed, show the stdout, stderr, and instruction
+ // for repeating the single test case.
+ if (stdout.length) console.log(decoder.decode(stdout));
console.log(`Error: "${path}" failed`);
console.log(
"You can repeat only this test with the command:",
@@ -89,6 +91,11 @@ for await (const path of testPaths) {
),
);
fail(decoder.decode(stderr));
+ } else if (hasFilters) {
+ // Even if the test case is successful, shows the stdout and stderr
+ // when test case filtering is specified.
+ if (stdout.length) console.log(decoder.decode(stdout));
+ if (stderr.length) console.log(decoder.decode(stderr));
}
},
});
@@ -107,7 +114,7 @@ function checkConfigTestFilesOrder(testFileLists: Array<string[]>) {
}
}
-if (filters.length === 0) {
+if (!hasFilters) {
Deno.test("checkConfigTestFilesOrder", function () {
checkConfigTestFilesOrder([
...Object.keys(config.ignore).map((suite) => config.ignore[suite]),