2021-06-27 13:27:36 -04:00
|
|
|
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
|
|
|
|
|
|
|
|
use crate::itest;
|
|
|
|
use test_util as util;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn no_color() {
|
|
|
|
let (out, _) = util::run_and_collect_output(
|
|
|
|
false,
|
2021-06-29 09:40:16 -04:00
|
|
|
"test test/no_color.ts",
|
2021-06-27 13:27:36 -04:00
|
|
|
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"));
|
|
|
|
}
|
|
|
|
|
2021-06-29 09:40:16 -04:00
|
|
|
itest!(pass {
|
|
|
|
args: "test test/pass.ts",
|
|
|
|
exit_code: 0,
|
|
|
|
output: "test/pass.out",
|
|
|
|
});
|
|
|
|
|
|
|
|
itest!(ignore {
|
|
|
|
args: "test test/ignore.ts",
|
|
|
|
exit_code: 0,
|
|
|
|
output: "test/ignore.out",
|
|
|
|
});
|
|
|
|
|
2021-07-05 12:36:43 -04:00
|
|
|
itest!(ignore_permissions {
|
|
|
|
args: "test --unstable test/ignore_permissions.ts",
|
|
|
|
exit_code: 0,
|
|
|
|
output: "test/ignore_permissions.out",
|
|
|
|
});
|
|
|
|
|
2021-06-29 09:40:16 -04:00
|
|
|
itest!(fail {
|
|
|
|
args: "test test/fail.ts",
|
2021-06-27 13:27:36 -04:00
|
|
|
exit_code: 1,
|
2021-06-29 09:40:16 -04:00
|
|
|
output: "test/fail.out",
|
2021-06-27 13:27:36 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
itest!(doc {
|
|
|
|
args: "test --doc --allow-all test/doc.ts",
|
|
|
|
exit_code: 1,
|
|
|
|
output: "test/doc.out",
|
|
|
|
});
|
|
|
|
|
2021-06-29 09:40:16 -04:00
|
|
|
itest!(quiet {
|
|
|
|
args: "test --quiet test/quiet.ts",
|
2021-06-27 13:27:36 -04:00
|
|
|
exit_code: 0,
|
2021-06-29 09:40:16 -04:00
|
|
|
output: "test/quiet.out",
|
2021-06-27 13:27:36 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
itest!(fail_fast {
|
2021-06-29 09:40:16 -04:00
|
|
|
args: "test --fail-fast test/fail_fast.ts",
|
2021-06-27 13:27:36 -04:00
|
|
|
exit_code: 1,
|
2021-06-29 09:40:16 -04:00
|
|
|
output: "test/fail_fast.out",
|
2021-06-27 13:27:36 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
itest!(only {
|
2021-06-29 09:40:16 -04:00
|
|
|
args: "test test/only.ts",
|
2021-06-27 13:27:36 -04:00
|
|
|
exit_code: 1,
|
2021-06-29 09:40:16 -04:00
|
|
|
output: "test/only.out",
|
2021-06-27 13:27:36 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
itest!(no_check {
|
2021-06-29 09:40:16 -04:00
|
|
|
args: "test --no-check test/no_check.ts",
|
2021-06-27 13:27:36 -04:00
|
|
|
exit_code: 1,
|
2021-06-29 09:40:16 -04:00
|
|
|
output: "test/no_check.out",
|
2021-06-27 13:27:36 -04:00
|
|
|
});
|
|
|
|
|
2021-06-29 09:40:16 -04:00
|
|
|
itest!(no_run {
|
|
|
|
args: "test --unstable --no-run test/no_run.ts",
|
|
|
|
output: "test/no_run.out",
|
2021-06-27 13:27:36 -04:00
|
|
|
exit_code: 1,
|
|
|
|
});
|
|
|
|
|
2021-06-29 09:40:16 -04:00
|
|
|
itest!(allow_all {
|
|
|
|
args: "test --unstable --allow-all test/allow_all.ts",
|
|
|
|
exit_code: 0,
|
|
|
|
output: "test/allow_all.out",
|
2021-06-27 13:27:36 -04:00
|
|
|
});
|
|
|
|
|
2021-06-29 09:40:16 -04:00
|
|
|
itest!(allow_none {
|
|
|
|
args: "test --unstable test/allow_none.ts",
|
2021-06-27 13:27:36 -04:00
|
|
|
exit_code: 1,
|
2021-06-29 09:40:16 -04:00
|
|
|
output: "test/allow_none.out",
|
2021-06-27 13:27:36 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
itest!(exit_sanitizer {
|
2021-06-29 09:40:16 -04:00
|
|
|
args: "test test/exit_sanitizer.ts",
|
|
|
|
output: "test/exit_sanitizer.out",
|
2021-06-27 13:27:36 -04:00
|
|
|
exit_code: 1,
|
|
|
|
});
|
|
|
|
|
2021-06-29 09:40:16 -04:00
|
|
|
itest!(finally_timeout {
|
|
|
|
args: "test test/finally_timeout.ts",
|
|
|
|
exit_code: 1,
|
|
|
|
output: "test/finally_timeout.out",
|
2021-06-27 13:27:36 -04:00
|
|
|
});
|
|
|
|
|
2021-06-29 09:40:16 -04:00
|
|
|
itest!(unresolved_promise {
|
|
|
|
args: "test test/unresolved_promise.ts",
|
2021-06-27 13:27:36 -04:00
|
|
|
exit_code: 1,
|
2021-06-29 09:40:16 -04:00
|
|
|
output: "test/unresolved_promise.out",
|
|
|
|
});
|
|
|
|
|
|
|
|
itest!(unhandled_rejection {
|
|
|
|
args: "test test/unhandled_rejection.ts",
|
|
|
|
exit_code: 1,
|
|
|
|
output: "test/unhandled_rejection.out",
|
2021-06-27 13:27:36 -04:00
|
|
|
});
|
2021-07-05 21:20:33 -04:00
|
|
|
|
|
|
|
itest!(shuffle {
|
|
|
|
args: "test --shuffle test/shuffle",
|
|
|
|
exit_code: 0,
|
|
|
|
output_str: Some("[WILDCARD]"),
|
|
|
|
});
|
|
|
|
|
|
|
|
itest!(shuffle_with_seed {
|
|
|
|
args: "test --shuffle=42 test/shuffle",
|
|
|
|
exit_code: 0,
|
|
|
|
output: "test/shuffle.out",
|
|
|
|
});
|