Skip to content

Commit

Permalink
test(cli): reorganize test subcommand testcases and fixtures (denolan…
Browse files Browse the repository at this point in the history
  • Loading branch information
caspervonb committed Mar 1, 2021
1 parent 6dae627 commit 62f33e3
Show file tree
Hide file tree
Showing 13 changed files with 57 additions and 53 deletions.
108 changes: 56 additions & 52 deletions cli/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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() {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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");
Expand Down
File renamed without changes.

0 comments on commit 62f33e3

Please sign in to comment.