1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-01 16:51:13 -05:00

chore(ext/node): suppress node compat tests stdout by default (#17909)

This commit is contained in:
Yoshiya Hinosawa 2023-02-27 19:39:33 +09:00
parent de08015925
commit f1c756f589

View file

@ -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]),