test: make test output less noisy (denoland/deno#8445)

This commit makes output of  tests less noisy
by passing "--quiet" flag to Deno subprocesses run
as part of test suite.
This commit is contained in:
Bartek Iwańczuk 2020-11-20 18:01:58 +01:00 committed by denobot
parent 0ea945721b
commit 4379f0a9c1
15 changed files with 34 additions and 9 deletions

View File

@ -10,6 +10,7 @@ Deno.test("[examples/cat] print multiple files", async () => {
cmd: [ cmd: [
Deno.execPath(), Deno.execPath(),
"run", "run",
"--quiet",
"--allow-read", "--allow-read",
"cat.ts", "cat.ts",
"testdata/cat/hello.txt", "testdata/cat/hello.txt",

View File

@ -82,7 +82,14 @@ function catj(
...files: string[] ...files: string[]
): Deno.Process<Deno.RunOptions & { stdin: "piped"; stdout: "piped" }> { ): Deno.Process<Deno.RunOptions & { stdin: "piped"; stdout: "piped" }> {
return Deno.run({ return Deno.run({
cmd: [Deno.execPath(), "run", "--allow-read", "catj.ts", ...files], cmd: [
Deno.execPath(),
"run",
"--quiet",
"--allow-read",
"catj.ts",
...files,
],
cwd: moduleDir, cwd: moduleDir,
stdin: "piped", stdin: "piped",
stdout: "piped", stdout: "piped",

View File

@ -14,6 +14,7 @@ async function startServer(): Promise<
cmd: [ cmd: [
Deno.execPath(), Deno.execPath(),
"run", "run",
"--quiet",
"--allow-net", "--allow-net",
"--allow-read", "--allow-read",
"server.ts", "server.ts",

View File

@ -7,7 +7,7 @@ const moduleDir = dirname(fromFileUrl(import.meta.url));
Deno.test("[examples/colors] print a colored text", async () => { Deno.test("[examples/colors] print a colored text", async () => {
const decoder = new TextDecoder(); const decoder = new TextDecoder();
const process = Deno.run({ const process = Deno.run({
cmd: [Deno.execPath(), "run", "colors.ts"], cmd: [Deno.execPath(), "run", "--quiet", "colors.ts"],
cwd: moduleDir, cwd: moduleDir,
stdout: "piped", stdout: "piped",
}); });

View File

@ -20,6 +20,7 @@ Deno.test({
cmd: [ cmd: [
Deno.execPath(), Deno.execPath(),
"run", "run",
"--quiet",
"--allow-net", "--allow-net",
"curl.ts", "curl.ts",
"http://localhost:8081", "http://localhost:8081",

View File

@ -9,7 +9,7 @@ Deno.test("[examples/echo_server]", async () => {
const encoder = new TextEncoder(); const encoder = new TextEncoder();
const decoder = new TextDecoder(); const decoder = new TextDecoder();
const process = Deno.run({ const process = Deno.run({
cmd: [Deno.execPath(), "run", "--allow-net", "echo_server.ts"], cmd: [Deno.execPath(), "run", "--quiet", "--allow-net", "echo_server.ts"],
cwd: moduleDir, cwd: moduleDir,
stdout: "piped", stdout: "piped",
}); });

View File

@ -19,6 +19,7 @@ Deno.test("catSmoke", async function (): Promise<void> {
cmd: [ cmd: [
Deno.execPath(), Deno.execPath(),
"run", "run",
"--quiet",
"--allow-read", "--allow-read",
relative(Deno.cwd(), resolve(moduleDir, "cat.ts")), relative(Deno.cwd(), resolve(moduleDir, "cat.ts")),
relative(Deno.cwd(), resolve(moduleDir, "..", "README.md")), relative(Deno.cwd(), resolve(moduleDir, "..", "README.md")),

View File

@ -7,7 +7,7 @@ const moduleDir = dirname(fromFileUrl(import.meta.url));
Deno.test("[examples/welcome] print a welcome message", async () => { Deno.test("[examples/welcome] print a welcome message", async () => {
const decoder = new TextDecoder(); const decoder = new TextDecoder();
const process = Deno.run({ const process = Deno.run({
cmd: [Deno.execPath(), "run", "welcome.ts"], cmd: [Deno.execPath(), "run", "--quiet", "welcome.ts"],
cwd: moduleDir, cwd: moduleDir,
stdout: "piped", stdout: "piped",
}); });

View File

@ -38,6 +38,7 @@ Deno.test({
cmd: [ cmd: [
Deno.execPath(), Deno.execPath(),
"run", "run",
"--quiet",
xevalPath, xevalPath,
"--replvar=abc", "--replvar=abc",
"console.log(abc)", "console.log(abc)",
@ -58,7 +59,7 @@ Deno.test({
Deno.test("xevalCliSyntaxError", async function (): Promise<void> { Deno.test("xevalCliSyntaxError", async function (): Promise<void> {
const p = Deno.run({ const p = Deno.run({
cmd: [Deno.execPath(), "run", xevalPath, "("], cmd: [Deno.execPath(), "run", "--quiet", xevalPath, "("],
cwd: moduleDir, cwd: moduleDir,
stdin: "null", stdin: "null",
stdout: "piped", stdout: "piped",

View File

@ -204,7 +204,7 @@ for (const s of scenes) {
); );
try { try {
const args = [Deno.execPath(), "run"]; const args = [Deno.execPath(), "run", "--quiet"];
if (s.read) { if (s.read) {
args.push("--allow-read"); args.push("--allow-read");

View File

@ -113,7 +113,7 @@ for (const s of scenes) {
let title = `test ${s.async ? "exists" : "existsSync"}("testdata/${s.file}")`; let title = `test ${s.async ? "exists" : "existsSync"}("testdata/${s.file}")`;
title += ` ${s.read ? "with" : "without"} --allow-read`; title += ` ${s.read ? "with" : "without"} --allow-read`;
Deno.test(`[fs] existsPermission ${title}`, async function (): Promise<void> { Deno.test(`[fs] existsPermission ${title}`, async function (): Promise<void> {
const args = [Deno.execPath(), "run"]; const args = [Deno.execPath(), "run", "--quiet"];
if (s.read) { if (s.read) {
args.push("--allow-read"); args.push("--allow-read");

View File

@ -119,7 +119,13 @@ Deno.test("expandGlobIncludeDirs", async function (): Promise<void> {
Deno.test("expandGlobPermError", async function (): Promise<void> { Deno.test("expandGlobPermError", async function (): Promise<void> {
const exampleUrl = new URL("testdata/expand_wildcard.js", import.meta.url); const exampleUrl = new URL("testdata/expand_wildcard.js", import.meta.url);
const p = Deno.run({ const p = Deno.run({
cmd: [Deno.execPath(), "run", "--unstable", exampleUrl.toString()], cmd: [
Deno.execPath(),
"run",
"--quiet",
"--unstable",
exampleUrl.toString(),
],
stdin: "null", stdin: "null",
stdout: "piped", stdout: "piped",
stderr: "piped", stderr: "piped",

View File

@ -25,6 +25,7 @@ async function startFileServer({
cmd: [ cmd: [
Deno.execPath(), Deno.execPath(),
"run", "run",
"--quiet",
"--allow-read", "--allow-read",
"--allow-net", "--allow-net",
"file_server.ts", "file_server.ts",
@ -50,6 +51,7 @@ async function startFileServerAsLibrary({}: FileServerCfg = {}): Promise<void> {
cmd: [ cmd: [
Deno.execPath(), Deno.execPath(),
"run", "run",
"--quiet",
"--allow-read", "--allow-read",
"--allow-net", "--allow-net",
"testdata/file_server_as_library.ts", "testdata/file_server_as_library.ts",
@ -205,6 +207,7 @@ Deno.test("printHelp", async function (): Promise<void> {
cmd: [ cmd: [
Deno.execPath(), Deno.execPath(),
"run", "run",
"--quiet",
// TODO(ry) It ought to be possible to get the help output without // TODO(ry) It ought to be possible to get the help output without
// --allow-read. // --allow-read.
"--allow-read", "--allow-read",
@ -264,6 +267,7 @@ async function startTlsFileServer({
cmd: [ cmd: [
Deno.execPath(), Deno.execPath(),
"run", "run",
"--quiet",
"--allow-read", "--allow-read",
"--allow-net", "--allow-net",
"file_server.ts", "file_server.ts",
@ -319,6 +323,7 @@ Deno.test("partial TLS arguments fail", async function (): Promise<void> {
cmd: [ cmd: [
Deno.execPath(), Deno.execPath(),
"run", "run",
"--quiet",
"--allow-read", "--allow-read",
"--allow-net", "--allow-net",
"file_server.ts", "file_server.ts",

View File

@ -9,7 +9,7 @@ const moduleDir = dirname(fromFileUrl(import.meta.url));
let server: Deno.Process<Deno.RunOptions & { stdout: "piped" }>; let server: Deno.Process<Deno.RunOptions & { stdout: "piped" }>;
async function startServer(): Promise<void> { async function startServer(): Promise<void> {
server = Deno.run({ server = Deno.run({
cmd: [Deno.execPath(), "run", "-A", "racing_server.ts"], cmd: [Deno.execPath(), "run", "--quiet", "-A", "racing_server.ts"],
cwd: moduleDir, cwd: moduleDir,
stdout: "piped", stdout: "piped",
}); });

View File

@ -370,6 +370,7 @@ Deno.test({
cmd: [ cmd: [
Deno.execPath(), Deno.execPath(),
"run", "run",
"--quiet",
"--allow-net", "--allow-net",
"testdata/simple_server.ts", "testdata/simple_server.ts",
], ],
@ -415,6 +416,7 @@ Deno.test({
cmd: [ cmd: [
Deno.execPath(), Deno.execPath(),
"run", "run",
"--quiet",
"--allow-net", "--allow-net",
"--allow-read", "--allow-read",
"testdata/simple_https_server.ts", "testdata/simple_https_server.ts",