1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00

test: fix flaky compat tests (#13921)

This commit is contained in:
Bartek Iwańczuk 2022-03-12 02:08:55 +01:00 committed by GitHub
parent 5ebaa7943a
commit 1a764790f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -50,18 +50,21 @@ itest!(import_esm_from_cjs {
args:
"run --compat --unstable -A --quiet compat/import_esm_from_cjs/index.js",
output_str: Some("function\n"),
envs: vec![("DENO_NODE_COMPAT_URL".to_string(), std_file_url())],
});
itest!(test_runner_cjs {
args: "test --compat --unstable -A --quiet compat/test_runner/cjs.js",
exit_code: 1,
output: "compat/test_runner/cjs.out",
envs: vec![("DENO_NODE_COMPAT_URL".to_string(), std_file_url())],
});
itest!(test_runner_esm {
args: "test --compat --unstable -A --quiet compat/test_runner/esm.mjs",
exit_code: 1,
output: "compat/test_runner/esm.out",
envs: vec![("DENO_NODE_COMPAT_URL".to_string(), std_file_url())],
});
// Top level assertion test mostly just make sure that the test runner finishes correctly on compat mode
@ -70,41 +73,48 @@ itest!(top_level_assertion_cjs {
args: "test --compat --unstable -A --quiet compat/test_runner/top_level_assertion_cjs.js",
exit_code: 0,
output: "compat/test_runner/top_level_assertion_cjs.out",
envs: vec![("DENO_NODE_COMPAT_URL".to_string(), std_file_url())],
});
itest!(top_level_assertion_esm {
args: "test --compat --unstable -A --quiet compat/test_runner/top_level_assertion_esm.mjs",
exit_code: 0,
output: "compat/test_runner/top_level_assertion_esm.out",
envs: vec![("DENO_NODE_COMPAT_URL".to_string(), std_file_url())],
});
itest!(top_level_fail_cjs {
args: "test --compat --unstable -A --quiet compat/test_runner/top_level_fail_cjs.js",
exit_code: 1,
output: "compat/test_runner/top_level_fail_cjs.out",
envs: vec![("DENO_NODE_COMPAT_URL".to_string(), std_file_url())],
});
itest!(top_level_fail_esm {
args: "test --compat --unstable -A --quiet compat/test_runner/top_level_fail_esm.mjs",
exit_code: 1,
output: "compat/test_runner/top_level_fail_esm.out",
envs: vec![("DENO_NODE_COMPAT_URL".to_string(), std_file_url())],
});
itest!(compat_worker {
args: "run --compat --unstable -A --quiet --no-check compat/worker/worker_test.mjs",
output: "compat/worker/worker_test.out",
envs: vec![("DENO_NODE_COMPAT_URL".to_string(), std_file_url())],
});
itest!(cjs_esm_interop {
args:
"run --compat --unstable -A --quiet --no-check compat/import_cjs_from_esm/main.mjs",
output: "compat/import_cjs_from_esm.out",
envs: vec![("DENO_NODE_COMPAT_URL".to_string(), std_file_url())],
});
itest!(cjs_esm_interop_dynamic {
args:
"run --compat --unstable -A --quiet --no-check compat/import_cjs_from_esm/main_dynamic.mjs",
output: "compat/import_cjs_from_esm.out",
envs: vec![("DENO_NODE_COMPAT_URL".to_string(), std_file_url())],
});
#[test]
@ -127,7 +137,7 @@ fn require_in_repl() {
Some(vec![
"const foo = require('./compat/import_esm_from_cjs/index');",
]),
None,
Some(vec![("DENO_NODE_COMPAT_URL".to_string(), std_file_url())]),
false,
);
assert!(out.contains("function"));
@ -156,7 +166,7 @@ fn native_modules_as_global_vars() {
true,
vec!["repl", "--compat", "--unstable", "--quiet"],
Some(vec!["if(cluster && v8 && sys) { true } else { false }"]),
None,
Some(vec![("DENO_NODE_COMPAT_URL".to_string(), std_file_url())]),
false,
);
assert!(out.contains("true"));