1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 15:24:46 -05:00

test(cli): reorganize test subcommand testcases and fixtures (#9627)

This commit is contained in:
Casper Beyer 2021-03-01 20:02:51 +08:00 committed by GitHub
parent 6dae627749
commit 62f33e3b14
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 57 additions and 53 deletions

View file

@ -2238,28 +2238,6 @@ mod integration {
}
}
#[test]
fn deno_test_no_color() {
let (out, _) = util::run_and_collect_output(
false,
"test deno_test_no_color.ts",
None,
Some(vec![("NO_COLOR".to_owned(), "true".to_owned())]),
false,
);
// ANSI escape codes should be stripped.
assert!(out.contains("test success ... ok"));
assert!(out.contains("test fail ... FAILED"));
assert!(out.contains("test ignored ... ignored"));
assert!(out.contains("test result: FAILED. 1 passed; 1 failed; 1 ignored; 0 measured; 0 filtered out"));
}
itest!(test_exit_sanitizer {
args: "test exit_sanitizer_test.ts",
output: "exit_sanitizer_test.out",
exit_code: 1,
});
itest!(stdout_write_all {
args: "run --quiet stdout_write_all.ts",
output: "stdout_write_all.out",
@ -2386,41 +2364,67 @@ mod integration {
http_server: true,
});
itest!(deno_test {
args: "test test_runner_test.ts",
exit_code: 1,
output: "deno_test.out",
});
mod test {
use super::*;
itest!(deno_test_fail_fast {
args: "test --fail-fast test_runner_test.ts",
exit_code: 1,
output: "deno_test_fail_fast.out",
});
#[test]
fn no_color() {
let (out, _) = util::run_and_collect_output(
false,
"test test/deno_test_no_color.ts",
None,
Some(vec![("NO_COLOR".to_owned(), "true".to_owned())]),
false,
);
// ANSI escape codes should be stripped.
assert!(out.contains("test success ... ok"));
assert!(out.contains("test fail ... FAILED"));
assert!(out.contains("test ignored ... ignored"));
assert!(out.contains("test result: FAILED. 1 passed; 1 failed; 1 ignored; 0 measured; 0 filtered out"));
}
itest!(deno_test_only {
args: "test deno_test_only.ts",
exit_code: 1,
output: "deno_test_only.ts.out",
});
itest!(all {
args: "test test/test_runner_test.ts",
exit_code: 1,
output: "test/deno_test.out",
});
itest!(deno_test_no_check {
args: "test --no-check test_runner_test.ts",
exit_code: 1,
output: "deno_test.out",
});
itest!(fail_fast {
args: "test --fail-fast test/test_runner_test.ts",
exit_code: 1,
output: "test/deno_test_fail_fast.out",
});
itest!(deno_test_finally_cleartimeout {
args: "test test_finally_cleartimeout.ts",
exit_code: 1,
output: "test_finally_cleartimeout.out",
});
itest!(only {
args: "test test/deno_test_only.ts",
exit_code: 1,
output: "test/deno_test_only.ts.out",
});
itest!(deno_test_unresolved_promise {
args: "test test_unresolved_promise.js",
exit_code: 1,
output: "deno_test_unresolved_promise.out",
});
itest!(no_check {
args: "test --no-check test/test_runner_test.ts",
exit_code: 1,
output: "test/deno_test.out",
});
itest!(finally_cleartimeout {
args: "test test/test_finally_cleartimeout.ts",
exit_code: 1,
output: "test/test_finally_cleartimeout.out",
});
itest!(unresolved_promise {
args: "test test/test_unresolved_promise.js",
exit_code: 1,
output: "test/deno_test_unresolved_promise.out",
});
itest!(exit_sanitizer {
args: "test test/exit_sanitizer_test.ts",
output: "test/exit_sanitizer_test.out",
exit_code: 1,
});
}
#[test]
fn timeout_clear() {

View file

@ -1,6 +1,6 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
import { assert } from "../../test_util/std/testing/asserts.ts";
import { assert } from "../../../test_util/std/testing/asserts.ts";
Deno.test("fail1", function () {
assert(false, "fail1 assertion");