2024-01-01 14:58:21 -05:00
|
|
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2023-01-12 20:59:13 -05:00
|
|
|
|
|
|
|
use test_util as util;
|
2023-03-13 09:40:46 -04:00
|
|
|
use util::assert_contains;
|
2023-06-06 17:07:46 -04:00
|
|
|
use util::assert_not_contains;
|
2023-03-25 15:32:11 -04:00
|
|
|
use util::wildcard_match;
|
2023-02-27 15:52:49 -05:00
|
|
|
use util::TestContext;
|
2023-05-22 21:39:59 -04:00
|
|
|
use util::TestContextBuilder;
|
2023-01-12 20:59:13 -05:00
|
|
|
|
2023-11-01 15:59:51 -04:00
|
|
|
#[test]
|
|
|
|
fn junit_path() {
|
|
|
|
let context = TestContextBuilder::new().use_temp_cwd().build();
|
|
|
|
let temp_dir = context.temp_dir();
|
|
|
|
temp_dir.write("test.js", "Deno.test('does test', () => {});");
|
|
|
|
let output = context
|
|
|
|
.new_command()
|
|
|
|
.args("test --junit-path=sub_dir/output.xml test.js")
|
|
|
|
.run();
|
|
|
|
output.skip_output_check();
|
|
|
|
output.assert_exit_code(0);
|
|
|
|
temp_dir
|
|
|
|
.path()
|
|
|
|
.join("sub_dir/output.xml")
|
|
|
|
.assert_matches_text("<?xml [WILDCARD]");
|
|
|
|
}
|
|
|
|
|
2023-03-25 15:32:11 -04:00
|
|
|
#[test]
|
2023-03-28 17:49:00 -04:00
|
|
|
// todo(#18480): re-enable
|
|
|
|
#[ignore]
|
2023-03-25 15:32:11 -04:00
|
|
|
fn sigint_with_hanging_test() {
|
|
|
|
util::with_pty(
|
|
|
|
&[
|
|
|
|
"test",
|
|
|
|
"--quiet",
|
|
|
|
"--no-check",
|
|
|
|
"test/sigint_with_hanging_test.ts",
|
|
|
|
],
|
|
|
|
|mut console| {
|
|
|
|
std::thread::sleep(std::time::Duration::from_secs(1));
|
|
|
|
console.write_line("\x03");
|
2023-03-28 17:49:00 -04:00
|
|
|
let text = console.read_until("hanging_test.ts:10:15");
|
2023-03-25 15:32:11 -04:00
|
|
|
wildcard_match(
|
|
|
|
include_str!("../testdata/test/sigint_with_hanging_test.out"),
|
2023-03-28 17:49:00 -04:00
|
|
|
&text,
|
2023-03-25 15:32:11 -04:00
|
|
|
);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2023-05-22 21:39:59 -04:00
|
|
|
#[test]
|
|
|
|
fn test_with_glob_config() {
|
|
|
|
let context = TestContextBuilder::new().cwd("test").build();
|
|
|
|
|
|
|
|
let cmd_output = context
|
|
|
|
.new_command()
|
|
|
|
.args("test --config deno.glob.json")
|
|
|
|
.run();
|
|
|
|
|
|
|
|
cmd_output.assert_exit_code(0);
|
|
|
|
|
|
|
|
let output = cmd_output.combined_output();
|
|
|
|
assert_contains!(output, "glob/nested/fizz/fizz.ts");
|
|
|
|
assert_contains!(output, "glob/pages/[id].ts");
|
|
|
|
assert_contains!(output, "glob/nested/fizz/bar.ts");
|
|
|
|
assert_contains!(output, "glob/nested/foo/foo.ts");
|
|
|
|
assert_contains!(output, "glob/data/test1.js");
|
|
|
|
assert_contains!(output, "glob/nested/foo/bar.ts");
|
|
|
|
assert_contains!(output, "glob/nested/foo/fizz.ts");
|
|
|
|
assert_contains!(output, "glob/nested/fizz/foo.ts");
|
|
|
|
assert_contains!(output, "glob/data/test1.ts");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_with_glob_config_and_flags() {
|
|
|
|
let context = TestContextBuilder::new().cwd("test").build();
|
|
|
|
|
|
|
|
let cmd_output = context
|
|
|
|
.new_command()
|
|
|
|
.args("test --config deno.glob.json --ignore=glob/nested/**/bar.ts")
|
|
|
|
.run();
|
|
|
|
|
|
|
|
cmd_output.assert_exit_code(0);
|
|
|
|
|
|
|
|
let output = cmd_output.combined_output();
|
|
|
|
assert_contains!(output, "glob/nested/fizz/fizz.ts");
|
|
|
|
assert_contains!(output, "glob/pages/[id].ts");
|
|
|
|
assert_contains!(output, "glob/nested/fizz/bazz.ts");
|
|
|
|
assert_contains!(output, "glob/nested/foo/foo.ts");
|
|
|
|
assert_contains!(output, "glob/data/test1.js");
|
|
|
|
assert_contains!(output, "glob/nested/foo/bazz.ts");
|
|
|
|
assert_contains!(output, "glob/nested/foo/fizz.ts");
|
|
|
|
assert_contains!(output, "glob/nested/fizz/foo.ts");
|
|
|
|
assert_contains!(output, "glob/data/test1.ts");
|
|
|
|
|
|
|
|
let cmd_output = context
|
|
|
|
.new_command()
|
|
|
|
.args("test --config deno.glob.json glob/data/test1.?s")
|
|
|
|
.run();
|
|
|
|
|
|
|
|
cmd_output.assert_exit_code(0);
|
|
|
|
|
|
|
|
let output = cmd_output.combined_output();
|
|
|
|
assert_contains!(output, "glob/data/test1.js");
|
|
|
|
assert_contains!(output, "glob/data/test1.ts");
|
|
|
|
}
|
2023-06-06 17:07:46 -04:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn conditionally_loads_type_graph() {
|
|
|
|
let context = TestContext::default();
|
|
|
|
let output = context
|
|
|
|
.new_command()
|
|
|
|
.args("test --reload -L debug run/type_directives_js_main.js")
|
|
|
|
.run();
|
2024-04-18 21:43:28 -04:00
|
|
|
output.assert_matches_text("[WILDCARD] - FileFetcher::fetch_no_follow_with_options - specifier: file:///[WILDCARD]/subdir/type_reference.d.ts[WILDCARD]");
|
2023-06-06 17:07:46 -04:00
|
|
|
let output = context
|
|
|
|
.new_command()
|
|
|
|
.args("test --reload -L debug --no-check run/type_directives_js_main.js")
|
|
|
|
.run();
|
|
|
|
assert_not_contains!(output.combined_output(), "type_reference.d.ts");
|
|
|
|
}
|