summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/integration/check_tests.rs5
-rw-r--r--cli/tests/testdata/046_jsx_test.tsx8
-rw-r--r--cli/tests/testdata/error_for_await.ts2
-rw-r--r--cli/tests/testdata/lsp/code_action_response_no_disabled.json20
-rw-r--r--cli/tests/testdata/lsp/code_action_response_refactor.json2
-rw-r--r--cli/tests/testdata/module_detection_force.ts3
-rw-r--r--cli/tests/testdata/module_detection_force_import.ts2
-rw-r--r--cli/tests/testdata/subdir/polyfill.ts2
-rw-r--r--cli/tests/testdata/subdir/single_module.ts1
-rw-r--r--cli/tests/testdata/subdir/subdir2/dynamic_import.ts2
-rw-r--r--cli/tests/testdata/worker_message_before_close.js2
11 files changed, 36 insertions, 13 deletions
diff --git a/cli/tests/integration/check_tests.rs b/cli/tests/integration/check_tests.rs
index f605a733a..dca41a1e4 100644
--- a/cli/tests/integration/check_tests.rs
+++ b/cli/tests/integration/check_tests.rs
@@ -32,3 +32,8 @@ itest!(check_all_local {
output_str: Some(""),
http_server: true,
});
+
+itest!(module_detection_force {
+ args: "check --quiet module_detection_force.ts",
+ output_str: Some(""),
+});
diff --git a/cli/tests/testdata/046_jsx_test.tsx b/cli/tests/testdata/046_jsx_test.tsx
index a96e90baf..5ed3ff2fa 100644
--- a/cli/tests/testdata/046_jsx_test.tsx
+++ b/cli/tests/testdata/046_jsx_test.tsx
@@ -1,6 +1,8 @@
-declare namespace JSX {
- interface IntrinsicElements {
- [elemName: string]: any;
+declare global {
+ export namespace JSX {
+ interface IntrinsicElements {
+ [elemName: string]: any;
+ }
}
}
const React = {
diff --git a/cli/tests/testdata/error_for_await.ts b/cli/tests/testdata/error_for_await.ts
index 6e8c5203f..64c81abe4 100644
--- a/cli/tests/testdata/error_for_await.ts
+++ b/cli/tests/testdata/error_for_await.ts
@@ -10,5 +10,3 @@ function handleConn(conn: Deno.Conn) {
event.respondWith(new Response("html", { status: 200 }));
}
}
-
-export {};
diff --git a/cli/tests/testdata/lsp/code_action_response_no_disabled.json b/cli/tests/testdata/lsp/code_action_response_no_disabled.json
index c69bd1120..11d2136b5 100644
--- a/cli/tests/testdata/lsp/code_action_response_no_disabled.json
+++ b/cli/tests/testdata/lsp/code_action_response_no_disabled.json
@@ -1,5 +1,25 @@
[
{
+ "title": "Extract to function in module scope",
+ "kind": "refactor.extract.function",
+ "isPreferred": false,
+ "data": {
+ "specifier": "file:///a/file.ts",
+ "range": {
+ "start": {
+ "line": 0,
+ "character": 0
+ },
+ "end": {
+ "line": 14,
+ "character": 0
+ }
+ },
+ "refactorName": "Extract Symbol",
+ "actionName": "function_scope_0"
+ }
+ },
+ {
"title": "Move to a new file",
"kind": "refactor.move.newFile",
"isPreferred": false,
diff --git a/cli/tests/testdata/lsp/code_action_response_refactor.json b/cli/tests/testdata/lsp/code_action_response_refactor.json
index c2797812e..d0d9fb0ee 100644
--- a/cli/tests/testdata/lsp/code_action_response_refactor.json
+++ b/cli/tests/testdata/lsp/code_action_response_refactor.json
@@ -1,6 +1,6 @@
[
{
- "title": "Extract to function in global scope",
+ "title": "Extract to function in module scope",
"kind": "refactor.extract.function",
"isPreferred": false,
"data": {
diff --git a/cli/tests/testdata/module_detection_force.ts b/cli/tests/testdata/module_detection_force.ts
new file mode 100644
index 000000000..7729ae366
--- /dev/null
+++ b/cli/tests/testdata/module_detection_force.ts
@@ -0,0 +1,3 @@
+const a = 1;
+await import("./module_detection_force_import.ts");
+console.log(a);
diff --git a/cli/tests/testdata/module_detection_force_import.ts b/cli/tests/testdata/module_detection_force_import.ts
new file mode 100644
index 000000000..66b229870
--- /dev/null
+++ b/cli/tests/testdata/module_detection_force_import.ts
@@ -0,0 +1,2 @@
+const a = 2;
+console.log(a);
diff --git a/cli/tests/testdata/subdir/polyfill.ts b/cli/tests/testdata/subdir/polyfill.ts
index e1cd923cb..7af67c4c0 100644
--- a/cli/tests/testdata/subdir/polyfill.ts
+++ b/cli/tests/testdata/subdir/polyfill.ts
@@ -2,8 +2,6 @@ declare global {
const polyfill: () => void;
}
-export {};
-
// deno-lint-ignore no-explicit-any
(globalThis as any).polyfill = () => {
console.log("polyfill");
diff --git a/cli/tests/testdata/subdir/single_module.ts b/cli/tests/testdata/subdir/single_module.ts
index f41b0a4b5..940a3ff0e 100644
--- a/cli/tests/testdata/subdir/single_module.ts
+++ b/cli/tests/testdata/subdir/single_module.ts
@@ -1,2 +1 @@
console.log("Hello world!");
-export {}; // TODO(ry) This shouldn't be necessary.
diff --git a/cli/tests/testdata/subdir/subdir2/dynamic_import.ts b/cli/tests/testdata/subdir/subdir2/dynamic_import.ts
index 573887b71..59beb64c3 100644
--- a/cli/tests/testdata/subdir/subdir2/dynamic_import.ts
+++ b/cli/tests/testdata/subdir/subdir2/dynamic_import.ts
@@ -2,5 +2,3 @@
const { printHello } = await import("../mod2.ts");
printHello();
})();
-
-export {};
diff --git a/cli/tests/testdata/worker_message_before_close.js b/cli/tests/testdata/worker_message_before_close.js
index 13ca6c9c7..a8f5d09d5 100644
--- a/cli/tests/testdata/worker_message_before_close.js
+++ b/cli/tests/testdata/worker_message_before_close.js
@@ -24,5 +24,3 @@ globalThis.addEventListener("unload", () => {
);
}
});
-
-export {};