2021-10-04 19:35:55 -04:00
|
|
|
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
|
|
|
|
|
|
|
|
use crate::itest;
|
2021-10-08 11:11:33 -04:00
|
|
|
use test_util as util;
|
2021-10-04 19:35:55 -04:00
|
|
|
|
2021-10-06 13:07:04 -04:00
|
|
|
itest!(globals {
|
|
|
|
args: "run --compat --unstable --allow-read --allow-env compat/globals.ts",
|
|
|
|
output: "compat/globals.out",
|
|
|
|
});
|
|
|
|
|
2021-10-04 19:35:55 -04:00
|
|
|
itest!(fs_promises {
|
2021-10-18 13:36:28 -04:00
|
|
|
args: "run --compat --unstable -A compat/fs_promises.mjs",
|
2021-10-04 19:35:55 -04:00
|
|
|
output: "compat/fs_promises.out",
|
|
|
|
});
|
|
|
|
|
2021-10-05 19:25:13 -04:00
|
|
|
itest!(node_prefix_fs_promises {
|
2021-10-18 13:36:28 -04:00
|
|
|
args: "run --compat --unstable -A compat/node_fs_promises.mjs",
|
2021-10-05 19:25:13 -04:00
|
|
|
output: "compat/fs_promises.out",
|
|
|
|
});
|
|
|
|
|
2021-10-08 11:11:33 -04:00
|
|
|
#[test]
|
|
|
|
fn globals_in_repl() {
|
2021-10-11 17:14:46 -04:00
|
|
|
let (out, _err) = util::run_and_collect_output_with_args(
|
2021-10-08 11:11:33 -04:00
|
|
|
true,
|
|
|
|
vec!["repl", "--compat", "--unstable", "--quiet"],
|
|
|
|
Some(vec!["global == window"]),
|
|
|
|
None,
|
|
|
|
false,
|
|
|
|
);
|
|
|
|
assert!(out.contains("true"));
|
|
|
|
}
|
2021-10-20 18:23:57 -04:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn node_compat_url() {
|
|
|
|
let (out, err) = util::run_and_collect_output_with_args(
|
|
|
|
false,
|
|
|
|
vec!["repl", "--compat", "--unstable", "--quiet"],
|
|
|
|
None,
|
|
|
|
Some(vec![(
|
|
|
|
"DENO_NODE_COMPAT_URL".to_string(),
|
|
|
|
"file:///non_existent/".to_string(),
|
|
|
|
)]),
|
|
|
|
false,
|
|
|
|
);
|
|
|
|
assert!(out.is_empty());
|
|
|
|
assert!(!err.is_empty());
|
|
|
|
assert!(err.contains("file:///non_existent/node/global.ts"));
|
|
|
|
}
|