diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2022-05-17 23:53:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-17 23:53:42 +0200 |
commit | 9a85a95c435968e5bdf6e71192be3ed239fd2205 (patch) | |
tree | 7c51e96bd0f6f7a2565f688bef85de82b5fdf790 /cli/tests/integration/compile_tests.rs | |
parent | 330c820ae8d7826dfe3d88c01ba07728121fa021 (diff) |
feat: subcommands type-check only local files by default (#14623)
This commit changes default mode of type-checking to "local"
and adds "--check" flag to following subcommands:
- deno bench
- deno bundle
- deno cache
- deno compile
- deno eval
- deno install
- deno test
Diffstat (limited to 'cli/tests/integration/compile_tests.rs')
-rw-r--r-- | cli/tests/integration/compile_tests.rs | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/cli/tests/integration/compile_tests.rs b/cli/tests/integration/compile_tests.rs index 2f75659cf..a3f2e8697 100644 --- a/cli/tests/integration/compile_tests.rs +++ b/cli/tests/integration/compile_tests.rs @@ -479,3 +479,52 @@ fn skip_rebundle() { assert!(output.status.success()); assert_eq!(output.stdout, "Hello World\n".as_bytes()); } + +#[test] +fn check_local_by_default() { + let _guard = util::http_server(); + let dir = TempDir::new(); + let exe = if cfg!(windows) { + dir.path().join("welcome.exe") + } else { + dir.path().join("welcome") + }; + let status = util::deno_cmd() + .current_dir(util::root_path()) + .arg("compile") + .arg("--unstable") + .arg("--output") + .arg(&exe) + .arg(util::testdata_path().join("./compile/check_local_by_default.ts")) + .status() + .unwrap(); + assert!(status.success()); +} + +#[test] +fn check_local_by_default2() { + let _guard = util::http_server(); + let dir = TempDir::new(); + let exe = if cfg!(windows) { + dir.path().join("welcome.exe") + } else { + dir.path().join("welcome") + }; + let output = util::deno_cmd() + .current_dir(util::root_path()) + .env("NO_COLOR", "1") + .arg("compile") + .arg("--unstable") + .arg("--output") + .arg(&exe) + .arg(util::testdata_path().join("./compile/check_local_by_default2.ts")) + .output() + .unwrap(); + assert!(!output.status.success()); + let stdout = String::from_utf8(output.stdout).unwrap(); + let stderr = String::from_utf8(output.stderr).unwrap(); + assert!(stdout.is_empty()); + assert!(stderr.contains( + r#"error: TS2322 [ERROR]: Type '12' is not assignable to type '"b"'."# + )); +} |