Skip to content

Commit

Permalink
chore: deprecate check itests (#25963)
Browse files Browse the repository at this point in the history
  • Loading branch information
MohammadSu1 authored Oct 2, 2024
1 parent d116709 commit 3c193ae
Show file tree
Hide file tree
Showing 73 changed files with 178 additions and 107 deletions.
105 changes: 0 additions & 105 deletions tests/integration/check_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use deno_lockfile::NewLockfileOptions;
use deno_semver::jsr::JsrDepPackageReq;
use test_util as util;
use test_util::itest;
use util::env_vars_for_npm_tests;
use util::TestContext;
use util::TestContextBuilder;

Expand All @@ -21,104 +20,6 @@ itest!(check_all_local {
http_server: true,
});

itest!(module_detection_force {
args: "check --quiet check/module_detection_force/main.ts",
output_str: Some(""),
});

// Regression test for https://github.com/denoland/deno/issues/14937.
itest!(declaration_header_file_with_no_exports {
args: "check --quiet check/declaration_header_file_with_no_exports.ts",
output_str: Some(""),
});

itest!(check_jsximportsource_importmap_config {
args: "check --quiet --config check/jsximportsource_importmap_config/deno.json check/jsximportsource_importmap_config/main.tsx",
output_str: Some(""),
});

itest!(jsx_not_checked {
args: "check check/jsx_not_checked/main.jsx",
output: "check/jsx_not_checked/main.out",
envs: env_vars_for_npm_tests(),
http_server: true,
exit_code: 1,
});

itest!(check_npm_install_diagnostics {
args: "check --quiet check/npm_install_diagnostics/main.ts",
output: "check/npm_install_diagnostics/main.out",
envs: vec![("NO_COLOR".to_string(), "1".to_string())],
exit_code: 1,
});

itest!(check_static_response_json {
args: "check --quiet check/response_json.ts",
exit_code: 0,
});

itest!(check_node_builtin_modules_ts {
args: "check --quiet check/node_builtin_modules/mod.ts",
output: "check/node_builtin_modules/mod.ts.out",
envs: env_vars_for_npm_tests(),
exit_code: 1,
http_server: true,
});

itest!(check_node_builtin_modules_js {
args: "check --quiet check/node_builtin_modules/mod.js",
output: "check/node_builtin_modules/mod.js.out",
envs: env_vars_for_npm_tests(),
exit_code: 1,
http_server: true,
});

itest!(check_no_error_truncation {
args: "check --quiet check/no_error_truncation/main.ts --config check/no_error_truncation/deno.json",
output: "check/no_error_truncation/main.out",
envs: vec![("NO_COLOR".to_string(), "1".to_string())],
exit_code: 1,
});

itest!(check_broadcast_channel {
args: "check --quiet check/broadcast_channel.ts",
exit_code: 0,
});

itest!(check_deno_not_found {
args: "check --quiet check/deno_not_found/main.ts",
output: "check/deno_not_found/main.out",
exit_code: 1,
});

itest!(check_with_exclude_option_by_dir {
args:
"check --quiet --config check/exclude_option/deno.exclude_dir.json check/exclude_option/ignored/index.ts",
output_str: Some(""),
exit_code: 0,
});

itest!(check_with_exclude_option_by_glob {
args:
"check --quiet --config check/exclude_option/deno.exclude_glob.json check/exclude_option/ignored/index.ts",
output_str: Some(""),
exit_code: 0,
});

itest!(check_without_exclude_option {
args:
"check --quiet --config check/exclude_option/deno.json check/exclude_option/ignored/index.ts",
output: "check/exclude_option/exclude_option.ts.error.out",
exit_code: 1,
});

itest!(check_imported_files_listed_in_exclude_option {
args:
"check --quiet --config check/exclude_option/deno.exclude_dir.json check/exclude_option/index.ts",
output: "check/exclude_option/exclude_option.ts.error.out",
exit_code: 1,
});

#[test]
fn cache_switching_config_then_no_config() {
let context = TestContext::default();
Expand Down Expand Up @@ -241,12 +142,6 @@ fn ts_no_recheck_on_redirect() {
output.assert_matches_text("Hello\n");
}

itest!(check_dts {
args: "check --quiet check/dts/check_dts.d.ts",
output: "check/dts/check_dts.out",
exit_code: 1,
});

#[test]
fn check_error_in_dep_then_fix() {
let test_context = TestContextBuilder::new().use_temp_cwd().build();
Expand Down
5 changes: 5 additions & 0 deletions tests/specs/check/check_broadcast_channel/__test__.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"args": "check --quiet broadcast_channel.ts",
"output": "",
"exitCode": 0
}
File renamed without changes.
5 changes: 5 additions & 0 deletions tests/specs/check/check_deno_not_found/__test__.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"args": "check --quiet deno_not_found/main.ts",
"output": "deno_not_found/main.out",
"exitCode": 1
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: TS2304 [ERROR]: Cannot find name 'Deno'. Do you need to change your target library? Try changing the 'lib' compiler option to include 'deno.ns' or add a triple-slash directive to the top of your entrypoint (main file): /// <reference lib="deno.ns" />
Deno;
~~~~
at file:///[WILDCARD]/check/deno_not_found/main.ts:4:1
at file:///[WILDCARD]/deno_not_found/main.ts:4:1
File renamed without changes.
5 changes: 5 additions & 0 deletions tests/specs/check/check_dts/__test__.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"args": "check --quiet dts/check_dts.d.ts",
"output": "dts/check_dts.out",
"exitCode": 1
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"args": "check --quiet --config exclude_option/deno.exclude_dir.json exclude_option/index.ts",
"output": "exclude_option/exclude_option.ts.error.out",
"exitCode": 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"args": "check --quiet --config jsximportsource_importmap_config/deno.json jsximportsource_importmap_config/main.tsx",
"output": ""
}
5 changes: 5 additions & 0 deletions tests/specs/check/check_no_error_truncation/__test__.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"args": "check --quiet no_error_truncation/main.ts --config no_error_truncation/deno.json",
"output": "no_error_truncation/main.out",
"exitCode": 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"args": "check --quiet node_builtin_modules/mod.js",
"output": "node_builtin_modules/mod.js.out",
"exitCode": 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"args": "check --quiet node_builtin_modules/mod.ts",
"output": "node_builtin_modules/mod.ts.out",
"exitCode": 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// @ts-check
import fs from "node:fs";
const _data = fs.readFileSync("./node_builtin.js", 123);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
error: TS2769 [ERROR]: No overload matches this call.
[WILDCARD]
const _data = fs.readFileSync("./node_builtin.js", 123);
~~~
at file:///[WILDCARD]/node_builtin_modules/mod.js:3:52
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import fs from "node:fs";
const _data = fs.readFileSync("./node_builtin.js", 123);

// check node:module specifically because for deno check it should
// resolve to the @types/node package, but at runtime it uses a different
// builtin object than deno_std
import { builtinModules } from "node:module";
// should error about being string[]
const _testString: number[] = builtinModules;
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
error: TS2769 [ERROR]: No overload matches this call.
[WILDCARD]
const _data = fs.readFileSync("./node_builtin.js", 123);
~~~
at file:///[WILDCARD]/node_builtin_modules/mod.ts:2:52

TS2322 [ERROR]: Type 'string[]' is not assignable to type 'number[]'.
Type 'string' is not assignable to type 'number'.
const _testString: number[] = builtinModules;
~~~~~~~~~~~
at file:///[WILDCARD]/node_builtin_modules/mod.ts:9:7

Found 2 errors.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"args": "check --quiet npm_install_diagnostics/main.ts",
"output": "npm_install_diagnostics/main.out",
"exitCode": 1
}
5 changes: 5 additions & 0 deletions tests/specs/check/check_static_response_json/__test__.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"args": "check --quiet response_json.ts",
"output": "",
"exitCode": 0
}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"args": "check --quiet --config exclude_option/deno.exclude_dir.json exclude_option/ignored/index.ts",
"output": "",
"exitCode": 0
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"exclude": [
"ignored"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"exclude": [
"ignored/**/*"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"exclude": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
error: TS2304 [ERROR]: Cannot find name 'nothing'.
export { nothing };
~~~~~~~
at [WILDCARD]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { nothing };
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { nothing } from "./ignored/index.ts";

const foo = 1;

export { foo, nothing };
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"args": "check --quiet --config exclude_option/deno.exclude_glob.json exclude_option/ignored/index.ts",
"output": "",
"exitCode": 0
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"exclude": [
"ignored"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"exclude": [
"ignored/**/*"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"exclude": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
error: TS2304 [ERROR]: Cannot find name 'nothing'.
export { nothing };
~~~~~~~
at [WILDCARD]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { nothing };
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { nothing } from "./ignored/index.ts";

const foo = 1;

export { foo, nothing };
5 changes: 5 additions & 0 deletions tests/specs/check/check_without_exclude_option/__test__.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"args": "check --quiet --config exclude_option/deno.json exclude_option/ignored/index.ts",
"output": "exclude_option/exclude_option.ts.error.out",
"exitCode": 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"exclude": [
"ignored"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"exclude": [
"ignored/**/*"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"exclude": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
error: TS2304 [ERROR]: Cannot find name 'nothing'.
export { nothing };
~~~~~~~
at [WILDCARD]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { nothing };
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { nothing } from "./ignored/index.ts";

const foo = 1;

export { foo, nothing };
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"args": "check --quiet declaration_header_file_with_no_exports.ts",
"output": ""
}
5 changes: 5 additions & 0 deletions tests/specs/check/jsx_not_checked/__test__.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"args": "check jsx_not_checked/main.jsx",
"output": "jsx_not_checked/main.out",
"exitCode": 1
}
4 changes: 4 additions & 0 deletions tests/specs/check/module_detection_force/__test__.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"args": "check --quiet module_detection_force/main.ts",
"output": ""
}
2 changes: 1 addition & 1 deletion tools/lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ async function ensureNoNewITests() {
"bench_tests.rs": 0,
"cache_tests.rs": 0,
"cert_tests.rs": 0,
"check_tests.rs": 18,
"check_tests.rs": 2,
"compile_tests.rs": 0,
"coverage_tests.rs": 0,
"eval_tests.rs": 0,
Expand Down

0 comments on commit 3c193ae

Please sign in to comment.