From d9b130410b78face988e2fa5c3939e3584bc02f7 Mon Sep 17 00:00:00 2001 From: VishnuJin <45007338+VishnuJin@users.noreply.github.com> Date: Tue, 4 Jan 2022 00:40:17 +0530 Subject: feat(compat) preload Node.js built-in modules in global vars REPL (#13127) This commit adds preloading of built-in Node.js modules in the REPL if running with "deno repl --compat --unstable". --- cli/tests/integration/compat_tests.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'cli/tests/integration') diff --git a/cli/tests/integration/compat_tests.rs b/cli/tests/integration/compat_tests.rs index 714329dc2..7eff64f12 100644 --- a/cli/tests/integration/compat_tests.rs +++ b/cli/tests/integration/compat_tests.rs @@ -132,3 +132,15 @@ fn node_compat_url() { assert!(!err.is_empty()); assert!(err.contains("file:///non_existent/node/global.ts")); } + +#[test] +fn native_modules_as_global_vars() { + let (out, _err) = util::run_and_collect_output_with_args( + true, + vec!["repl", "--compat", "--unstable", "--quiet"], + Some(vec!["if(cluster && v8 && sys) { true } else { false }"]), + None, + false, + ); + assert!(out.contains("true")); +} -- cgit v1.2.3