diff options
Diffstat (limited to 'cli')
-rw-r--r-- | cli/tests/integration/cert_tests.rs | 5 | ||||
-rw-r--r-- | cli/tests/integration/compile_tests.rs | 6 | ||||
-rw-r--r-- | cli/tests/integration/fmt_tests.rs | 10 | ||||
-rw-r--r-- | cli/tests/integration/info_tests.rs | 4 | ||||
-rw-r--r-- | cli/tests/integration/install_tests.rs | 8 | ||||
-rw-r--r-- | cli/tests/integration/npm_tests.rs | 2 | ||||
-rw-r--r-- | cli/tests/integration/repl_tests.rs | 12 | ||||
-rw-r--r-- | cli/tests/integration/run_tests.rs | 11 | ||||
-rw-r--r-- | cli/tools/upgrade.rs | 11 |
9 files changed, 37 insertions, 32 deletions
diff --git a/cli/tests/integration/cert_tests.rs b/cli/tests/integration/cert_tests.rs index 4ccc38809..2b0807848 100644 --- a/cli/tests/integration/cert_tests.rs +++ b/cli/tests/integration/cert_tests.rs @@ -9,6 +9,7 @@ use std::io::Cursor; use std::io::Read; use std::sync::Arc; use test_util as util; +use util::testdata_path; use util::TestContext; itest_flaky!(cafile_url_imports { @@ -75,7 +76,7 @@ fn cafile_env_fetch() { let module_url = Url::parse("https://localhost:5545/cert/cafile_url_imports.ts").unwrap(); let context = TestContext::with_http_server(); - let cafile = context.testdata_path().join("tls/RootCA.pem"); + let cafile = testdata_path().join("tls/RootCA.pem"); context .new_command() @@ -91,7 +92,7 @@ fn cafile_fetch() { let module_url = Url::parse("http://localhost:4545/cert/cafile_url_imports.ts").unwrap(); let context = TestContext::with_http_server(); - let cafile = context.testdata_path().join("tls/RootCA.pem"); + let cafile = testdata_path().join("tls/RootCA.pem"); context .new_command() .args(format!("cache --quiet --cert {} {}", cafile, module_url,)) diff --git a/cli/tests/integration/compile_tests.rs b/cli/tests/integration/compile_tests.rs index 78249079d..1d0a36145 100644 --- a/cli/tests/integration/compile_tests.rs +++ b/cli/tests/integration/compile_tests.rs @@ -3,6 +3,7 @@ use test_util as util; use util::assert_contains; use util::assert_not_contains; +use util::testdata_path; use util::TestContext; use util::TestContextBuilder; @@ -705,7 +706,7 @@ fn dynamic_import_unanalyzable() { context .new_command() - .cwd(util::root_path().join("cli")) + .current_dir(util::root_path().join("cli")) .name(&exe) .env("NO_COLOR", "") .run() @@ -935,11 +936,10 @@ fn run_npm_bin_compile_test(opts: RunNpmBinCompileOptions) { let context = TestContextBuilder::for_npm().use_temp_cwd().build(); let temp_dir = context.temp_dir(); - let testdata_path = context.testdata_path(); let main_specifier = if opts.input_specifier.starts_with("npm:") { opts.input_specifier.to_string() } else { - testdata_path.join(opts.input_specifier).to_string() + testdata_path().join(opts.input_specifier).to_string() }; let mut args = vec!["compile".to_string()]; diff --git a/cli/tests/integration/fmt_tests.rs b/cli/tests/integration/fmt_tests.rs index edebedc27..b8c77c529 100644 --- a/cli/tests/integration/fmt_tests.rs +++ b/cli/tests/integration/fmt_tests.rs @@ -31,7 +31,7 @@ fn fmt_test() { let output = context .new_command() - .cwd(&testdata_fmt_dir) + .current_dir(&testdata_fmt_dir) .args_vec(vec![ "fmt".to_string(), format!( @@ -50,7 +50,7 @@ fn fmt_test() { // Check without ignore. let output = context .new_command() - .cwd(&testdata_fmt_dir) + .current_dir(&testdata_fmt_dir) .args_vec(vec![ "fmt".to_string(), "--check".to_string(), @@ -66,7 +66,7 @@ fn fmt_test() { // Format the source file. let output = context .new_command() - .cwd(&testdata_fmt_dir) + .current_dir(&testdata_fmt_dir) .args_vec(vec![ "fmt".to_string(), badly_formatted_js.to_string(), @@ -95,7 +95,7 @@ fn fmt_stdin_syntax_error() { .current_dir(util::testdata_path()) .arg("fmt") .arg("-") - .set_stdin_text("import { example }") + .stdin_text("import { example }") .split_output() .run(); assert!(output.stdout().is_empty()); @@ -141,7 +141,7 @@ fn fmt_auto_ignore_git_and_node_modules() { let output = context .new_command() - .cwd(t) + .current_dir(t) .env("NO_COLOR", "1") .args("fmt") .run(); diff --git a/cli/tests/integration/info_tests.rs b/cli/tests/integration/info_tests.rs index bfba40080..47c5cc1d0 100644 --- a/cli/tests/integration/info_tests.rs +++ b/cli/tests/integration/info_tests.rs @@ -11,7 +11,7 @@ fn info_with_compiled_source() { let output = context .new_command() - .cwd(util::testdata_path()) + .current_dir(util::testdata_path()) .args_vec(["cache", module_path]) .run(); output.assert_exit_code(0); @@ -19,7 +19,7 @@ fn info_with_compiled_source() { let output = context .new_command() - .cwd(util::testdata_path()) + .current_dir(util::testdata_path()) .args_vec(["info", module_path]) .split_output() .run(); diff --git a/cli/tests/integration/install_tests.rs b/cli/tests/integration/install_tests.rs index d9a7a4fb6..ae1cb4bf7 100644 --- a/cli/tests/integration/install_tests.rs +++ b/cli/tests/integration/install_tests.rs @@ -83,7 +83,7 @@ fn install_custom_dir_env_var() { context .new_command() - .cwd(util::root_path()) // different cwd + .current_dir(util::root_path()) // different cwd .args("install --check --name echo_test http://localhost:4545/echo.ts") .envs([ ("HOME", temp_dir_str.as_str()), @@ -124,7 +124,7 @@ fn installer_test_local_module_run() { context .new_command() - .cwd(util::root_path()) + .current_dir(util::root_path()) .args_vec([ "install", "--name", @@ -152,7 +152,7 @@ fn installer_test_local_module_run() { let output = context .new_command() .name(&file_path) - .cwd(temp_dir.path()) + .current_dir(temp_dir.path()) .args("foo") .env("PATH", util::target_dir()) .run(); @@ -183,7 +183,7 @@ fn installer_test_remote_module_run() { let output = context .new_command() .name(&bin_file_path) - .cwd(root_dir) + .current_dir(root_dir) .args("foo") .env("PATH", util::target_dir()) .run(); diff --git a/cli/tests/integration/npm_tests.rs b/cli/tests/integration/npm_tests.rs index f49e3e988..fe3e6cd0f 100644 --- a/cli/tests/integration/npm_tests.rs +++ b/cli/tests/integration/npm_tests.rs @@ -2135,7 +2135,7 @@ fn top_level_install_package_json_explicit_opt_in() { let output = test_context .new_command() .args("run -") - .stdin("console.log(5)") + .stdin_text("console.log(5)") .run(); output.assert_matches_text(concat!( "Initialize @denotest/esm-basic@1.0.0\n", diff --git a/cli/tests/integration/repl_tests.rs b/cli/tests/integration/repl_tests.rs index c161477d5..a4675c388 100644 --- a/cli/tests/integration/repl_tests.rs +++ b/cli/tests/integration/repl_tests.rs @@ -890,7 +890,7 @@ fn repl_with_quiet_flag() { #[test] fn repl_unit_tests() { util::with_pty(&["repl"], |mut console| { - console.write_line( + console.write_line_raw( "\ console.log('Hello from outside of test!'); \ Deno.test('test1', async (t) => { \ @@ -912,11 +912,11 @@ fn repl_unit_tests() { console.expect(" step1 ... ok ("); console.expect("test1 ... ok ("); console.expect("test2 ... FAILED ("); - console.expect(" ERRORS "); + console.expect("ERRORS"); console.expect("test2 => <anonymous>:6:6"); console.expect("error: Error: some message"); console.expect(" at <anonymous>:7:9"); - console.expect(" FAILURES "); + console.expect("FAILURES"); console.expect("test2 => <anonymous>:6:6"); console.expect("FAILED | 1 passed (1 step) | 1 failed ("); console.expect("undefined"); @@ -1058,11 +1058,13 @@ fn package_json_uncached_no_error() { // should support getting the package now though console .write_line("import { getValue, setValue } from '@denotest/esm-basic';"); - console.expect_all(&["undefined", "Initialize"]); + console.expect_all(&["undefined", "Download"]); console.write_line("setValue(12 + 30);"); console.expect("undefined"); console.write_line("getValue()"); - console.expect("42") + console.expect("42"); + + assert!(temp_dir.path().join("node_modules").exists()); }); } diff --git a/cli/tests/integration/run_tests.rs b/cli/tests/integration/run_tests.rs index 43c893071..be3f74df0 100644 --- a/cli/tests/integration/run_tests.rs +++ b/cli/tests/integration/run_tests.rs @@ -908,11 +908,7 @@ fn lock_no_declaration_files() { .run(); output.assert_matches_file("lockfile/no_dts/main.cache.out"); let lockfile = context.temp_dir().path().join("deno.lock"); - lockfile.assert_matches_file( - context - .testdata_path() - .join("lockfile/no_dts/deno.lock.out"), - ); + lockfile.assert_matches_file("lockfile/no_dts/deno.lock.out"); } #[test] @@ -2093,10 +2089,7 @@ console.log("executing javascript"); "#; let mut p = util::deno_cmd() - .arg("run") - .args(["--ext", "js"]) - .arg("--check") - .arg("-") + .args("run --ext js --check -") .stdin(std::process::Stdio::piped()) .stdout_piped() .spawn() diff --git a/cli/tools/upgrade.rs b/cli/tools/upgrade.rs index cd886fbd7..c5efa771b 100644 --- a/cli/tools/upgrade.rs +++ b/cli/tools/upgrade.rs @@ -593,7 +593,16 @@ fn get_url( UpgradeCheckKind::Execution => "", UpgradeCheckKind::Lsp => "?lsp", }; - format!("https://dl.deno.land/{}{}", file_name, query_param) + format!("{}/{}{}", base_upgrade_url(), file_name, query_param) +} + +fn base_upgrade_url() -> Cow<'static, str> { + // this is used to get the current version + if let Ok(url) = env::var("DENO_DONT_USE_INTERNAL_BASE_UPGRADE_URL") { + Cow::Owned(url) + } else { + Cow::Borrowed("https://dl.deno.land") + } } async fn download_package( |