From 6825d7f13d51006967c2638b4433fb582cd6ddbc Mon Sep 17 00:00:00 2001 From: Casper Beyer Date: Fri, 2 Oct 2020 19:13:23 +0800 Subject: fix(cli/repl): use a default referrer when empty (#7794) This makes use of a default referrer when its empty in repl mode so that dynamic imports work in the global evaluation context. Co-authored-by: Bartek Iwanczuk --- cli/tests/integration_tests.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'cli/tests/integration_tests.rs') diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index 20e43ca29..2e2f91d0a 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -1252,6 +1252,18 @@ fn repl_test_multiline() { assert!(err.is_empty()); } +#[test] +fn repl_test_import() { + let (out, _) = util::run_and_collect_output( + true, + "repl", + Some(vec!["import('./subdir/auto_print_hello.ts')"]), + Some(vec![("NO_COLOR".to_owned(), "1".to_owned())]), + false, + ); + assert!(out.contains("hello!\n")); +} + #[test] fn repl_test_eval_unterminated() { let (out, err) = util::run_and_collect_output( -- cgit v1.2.3