diff options
Diffstat (limited to 'tests/specs')
74 files changed, 684 insertions, 0 deletions
diff --git a/tests/specs/info_tests/_054_info_local_imports/005_more_imports.ts b/tests/specs/info_tests/_054_info_local_imports/005_more_imports.ts new file mode 100644 index 000000000..c69556be1 --- /dev/null +++ b/tests/specs/info_tests/_054_info_local_imports/005_more_imports.ts @@ -0,0 +1,11 @@ +import { printHello3, returnsFoo2, returnsHi } from "./mod1.ts"; + +printHello3(); + +if (returnsHi() !== "Hi") { + throw Error("Unexpected"); +} + +if (returnsFoo2() !== "Foo") { + throw Error("Unexpected"); +} diff --git a/tests/specs/info_tests/_054_info_local_imports/054_info_local_imports.out b/tests/specs/info_tests/_054_info_local_imports/054_info_local_imports.out new file mode 100644 index 000000000..388168a8b --- /dev/null +++ b/tests/specs/info_tests/_054_info_local_imports/054_info_local_imports.out @@ -0,0 +1,9 @@ +local: [WILDCARD]005_more_imports.ts +type: TypeScript +dependencies: 3 unique +size: [WILDCARD] + +file://[WILDCARD]/005_more_imports.ts ([WILDCARD]) +└─┬ file://[WILDCARD]/mod1.ts ([WILDCARD]) + └─┬ file://[WILDCARD]/subdir2/mod2.ts ([WILDCARD]) + └── file://[WILDCARD]/print_hello.ts ([WILDCARD]) diff --git a/tests/specs/info_tests/_054_info_local_imports/__test__.jsonc b/tests/specs/info_tests/_054_info_local_imports/__test__.jsonc new file mode 100644 index 000000000..4bfdfe155 --- /dev/null +++ b/tests/specs/info_tests/_054_info_local_imports/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "info --quiet 005_more_imports.ts", + "output": "054_info_local_imports.out", + "exitCode": 0 +} diff --git a/tests/specs/info_tests/_054_info_local_imports/mod1.ts b/tests/specs/info_tests/_054_info_local_imports/mod1.ts new file mode 100644 index 000000000..5e58f432e --- /dev/null +++ b/tests/specs/info_tests/_054_info_local_imports/mod1.ts @@ -0,0 +1,17 @@ +import { printHello2, returnsFoo } from "./subdir2/mod2.ts"; + +export function returnsHi(): string { + return "Hi"; +} + +export function returnsFoo2(): string { + return returnsFoo(); +} + +export function printHello3() { + printHello2(); +} + +export function throwsError() { + throw Error("exception from mod1"); +} diff --git a/tests/specs/info_tests/_054_info_local_imports/mod2.ts b/tests/specs/info_tests/_054_info_local_imports/mod2.ts new file mode 100644 index 000000000..ce1adc0e8 --- /dev/null +++ b/tests/specs/info_tests/_054_info_local_imports/mod2.ts @@ -0,0 +1 @@ +export { printHello } from "./print_hello.ts"; diff --git a/tests/specs/info_tests/_054_info_local_imports/print_hello.ts b/tests/specs/info_tests/_054_info_local_imports/print_hello.ts new file mode 100644 index 000000000..b9c0ad527 --- /dev/null +++ b/tests/specs/info_tests/_054_info_local_imports/print_hello.ts @@ -0,0 +1,3 @@ +export function printHello() { + console.log("Hello"); +} diff --git a/tests/specs/info_tests/_054_info_local_imports/subdir2/dynamic_import.ts b/tests/specs/info_tests/_054_info_local_imports/subdir2/dynamic_import.ts new file mode 100644 index 000000000..59beb64c3 --- /dev/null +++ b/tests/specs/info_tests/_054_info_local_imports/subdir2/dynamic_import.ts @@ -0,0 +1,4 @@ +(async () => { + const { printHello } = await import("../mod2.ts"); + printHello(); +})(); diff --git a/tests/specs/info_tests/_054_info_local_imports/subdir2/mod2.ts b/tests/specs/info_tests/_054_info_local_imports/subdir2/mod2.ts new file mode 100644 index 000000000..9071d0aeb --- /dev/null +++ b/tests/specs/info_tests/_054_info_local_imports/subdir2/mod2.ts @@ -0,0 +1,9 @@ +import { printHello } from "../print_hello.ts"; + +export function returnsFoo(): string { + return "Foo"; +} + +export function printHello2() { + printHello(); +} diff --git a/tests/specs/info_tests/data_null_error/__test__.jsonc b/tests/specs/info_tests/data_null_error/__test__.jsonc new file mode 100644 index 000000000..782cca43d --- /dev/null +++ b/tests/specs/info_tests/data_null_error/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "info data_null_error/mod.ts", + "output": "data_null_error/data_null_error.out" +} diff --git a/tests/specs/info_tests/data_null_error/data_null_error/data_null_error.out b/tests/specs/info_tests/data_null_error/data_null_error/data_null_error.out new file mode 100644 index 000000000..065396f18 --- /dev/null +++ b/tests/specs/info_tests/data_null_error/data_null_error/data_null_error.out @@ -0,0 +1,7 @@ +local: [WILDCARD]mod.ts +type: TypeScript +dependencies: 1 unique +size: [WILDCARD] + +file://[WILDCARD]/mod.ts ([WILDCARD]) +└── file://[WILDCARD]/types.d.ts ([WILDCARD]) diff --git a/tests/specs/info_tests/data_null_error/data_null_error/mod.ts b/tests/specs/info_tests/data_null_error/data_null_error/mod.ts new file mode 100644 index 000000000..6e3e99bd4 --- /dev/null +++ b/tests/specs/info_tests/data_null_error/data_null_error/mod.ts @@ -0,0 +1 @@ +/// <reference path="./types.d.ts" /> diff --git a/tests/specs/info_tests/data_null_error/data_null_error/types.d.ts b/tests/specs/info_tests/data_null_error/data_null_error/types.d.ts new file mode 100644 index 000000000..6ecc85676 --- /dev/null +++ b/tests/specs/info_tests/data_null_error/data_null_error/types.d.ts @@ -0,0 +1 @@ +declare class Test {} diff --git a/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/__test__.jsonc b/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/__test__.jsonc new file mode 100644 index 000000000..71f823a46 --- /dev/null +++ b/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "info dynamic_imports_tmp_lit/main.js", + "output": "dynamic_imports_tmp_lit/main.info.out", + "exitCode": 0 +} diff --git a/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/main.info.out b/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/main.info.out new file mode 100644 index 000000000..57d730a64 --- /dev/null +++ b/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/main.info.out @@ -0,0 +1,10 @@ +local: [WILDCARD]main.js +type: JavaScript +dependencies: 4 unique +size: [WILDCARD] + +file:///[WILDCARD]/dynamic_imports_tmp_lit/main.js ([WILDCARD]) +├── file:///[WILDCARD]/dynamic_imports_tmp_lit/sub/a.js ([WILDCARD]) +├── file:///[WILDCARD]/dynamic_imports_tmp_lit/sub/b.ts ([WILDCARD]) +├── file:///[WILDCARD]/dynamic_imports_tmp_lit/other/data.json ([WILDCARD]) +└── file:///[WILDCARD]/dynamic_imports_tmp_lit/other/sub/data2.json ([WILDCARD]) diff --git a/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/main.js b/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/main.js new file mode 100644 index 000000000..3bda59772 --- /dev/null +++ b/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/main.js @@ -0,0 +1,14 @@ +const fileNames = [ + "a.js", + "b.ts", +]; + +for (const fileName of fileNames) { + await import(`./sub/${fileName}`); +} + +const jsonFileNames = ["data.json", "sub/data2.json"]; +for (const fileName of jsonFileNames) { + const mod = await import(`./other/${fileName}`, { with: { type: "json" } }); + console.log(mod.default); +} diff --git a/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/other/data.json b/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/other/data.json new file mode 100644 index 000000000..0131e01e4 --- /dev/null +++ b/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/other/data.json @@ -0,0 +1,3 @@ +{ + "data": 5 +} diff --git a/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/other/sub/data2.json b/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/other/sub/data2.json new file mode 100644 index 000000000..858a13cdd --- /dev/null +++ b/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/other/sub/data2.json @@ -0,0 +1,3 @@ +{ + "data": 1 +} diff --git a/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/sub/a.js b/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/sub/a.js new file mode 100644 index 000000000..7b2a34601 --- /dev/null +++ b/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/sub/a.js @@ -0,0 +1 @@ +console.log("a"); diff --git a/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/sub/b.ts b/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/sub/b.ts new file mode 100644 index 000000000..6d012e7f1 --- /dev/null +++ b/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/sub/b.ts @@ -0,0 +1 @@ +console.log("b"); diff --git a/tests/specs/info_tests/info_flag/041_info_flag.out b/tests/specs/info_tests/info_flag/041_info_flag.out new file mode 100644 index 000000000..3506a29e4 --- /dev/null +++ b/tests/specs/info_tests/info_flag/041_info_flag.out @@ -0,0 +1,6 @@ +DENO_DIR location: [WILDCARD] +Remote modules cache: [WILDCARD]deps +npm modules cache: [WILDCARD]npm +Emitted modules cache: [WILDCARD]gen +Language server registries cache: [WILDCARD]registries +Origin storage: [WILDCARD]location_data diff --git a/tests/specs/info_tests/info_flag/__test__.jsonc b/tests/specs/info_tests/info_flag/__test__.jsonc new file mode 100644 index 000000000..39b50c960 --- /dev/null +++ b/tests/specs/info_tests/info_flag/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "info", + "output": "041_info_flag.out" +} diff --git a/tests/specs/info_tests/info_flag_location/041_info_flag_location.out b/tests/specs/info_tests/info_flag_location/041_info_flag_location.out new file mode 100644 index 000000000..b9e72f659 --- /dev/null +++ b/tests/specs/info_tests/info_flag_location/041_info_flag_location.out @@ -0,0 +1,7 @@ +DENO_DIR location: [WILDCARD] +Remote modules cache: [WILDCARD]deps +npm modules cache: [WILDCARD]npm +Emitted modules cache: [WILDCARD]gen +Language server registries cache: [WILDCARD]registries +Origin storage: [WILDCARD]location_data[WILDCARD] +Local Storage: [WILDCARD]location_data[WILDCARD]local_storage diff --git a/tests/specs/info_tests/info_flag_location/__test__.jsonc b/tests/specs/info_tests/info_flag_location/__test__.jsonc new file mode 100644 index 000000000..436e7cd9a --- /dev/null +++ b/tests/specs/info_tests/info_flag_location/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "info --location https://deno.land", + "output": "041_info_flag_location.out" +} diff --git a/tests/specs/info_tests/info_flag_script_jsx/049_info_flag_script_jsx.out b/tests/specs/info_tests/info_flag_script_jsx/049_info_flag_script_jsx.out new file mode 100644 index 000000000..f49fc2356 --- /dev/null +++ b/tests/specs/info_tests/info_flag_script_jsx/049_info_flag_script_jsx.out @@ -0,0 +1,15 @@ +[WILDCARD] +local: [WILDCARD]http[WILDCARD]127.0.0.1_PORT4545[WILDCARD] +type: TypeScript +dependencies: 8 unique +size: [WILDCARD] + +http://127.0.0.1:4545/run/048_media_types_jsx.ts ([WILDCARD]) +├── http://localhost:4545/subdir/mt_text_typescript_tsx.t1.tsx ([WILDCARD]) +├── http://localhost:4545/subdir/mt_video_vdn_tsx.t2.tsx ([WILDCARD]) +├── http://localhost:4545/subdir/mt_video_mp2t_tsx.t3.tsx ([WILDCARD]) +├── http://localhost:4545/subdir/mt_application_x_typescript_tsx.t4.tsx ([WILDCARD]) +├── http://localhost:4545/subdir/mt_text_javascript_jsx.j1.jsx ([WILDCARD]) +├── http://localhost:4545/subdir/mt_application_ecmascript_jsx.j2.jsx ([WILDCARD]) +├── http://localhost:4545/subdir/mt_text_ecmascript_jsx.j3.jsx ([WILDCARD]) +└── http://localhost:4545/subdir/mt_application_x_javascript_jsx.j4.jsx ([WILDCARD]) diff --git a/tests/specs/info_tests/info_flag_script_jsx/__test__.jsonc b/tests/specs/info_tests/info_flag_script_jsx/__test__.jsonc new file mode 100644 index 000000000..b8dc305ae --- /dev/null +++ b/tests/specs/info_tests/info_flag_script_jsx/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "info http://127.0.0.1:4545/run/048_media_types_jsx.ts", + "output": "049_info_flag_script_jsx.out" +} diff --git a/tests/specs/info_tests/info_import_map/__test__.jsonc b/tests/specs/info_tests/info_import_map/__test__.jsonc new file mode 100644 index 000000000..725276925 --- /dev/null +++ b/tests/specs/info_tests/info_import_map/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "info preact/debug", + "output": "with_import_map.out", + "exitCode": 0 +} diff --git a/tests/specs/info_tests/info_import_map/deno.json b/tests/specs/info_tests/info_import_map/deno.json new file mode 100644 index 000000000..aaf7260c6 --- /dev/null +++ b/tests/specs/info_tests/info_import_map/deno.json @@ -0,0 +1,6 @@ +{ + "imports": { + "preact": "https://esm.sh/preact@10.15.1", + "preact/": "https://esm.sh/preact@10.15.1/" + } +} diff --git a/tests/specs/info_tests/info_import_map/deno.lock b/tests/specs/info_tests/info_import_map/deno.lock new file mode 100644 index 000000000..cb5c6ca45 --- /dev/null +++ b/tests/specs/info_tests/info_import_map/deno.lock @@ -0,0 +1,10 @@ +{ + "version": "3", + "remote": { + "https://esm.sh/preact@10.15.1": "4bfd0b2c5a2d432e0c8cda295d6b7304152ae08c85f7d0a22f91289c97085b89", + "https://esm.sh/preact@10.15.1/debug": "4bfd0b2c5a2d432e0c8cda295d6b7304152ae08c85f7d0a22f91289c97085b89", + "https://esm.sh/stable/preact@10.15.1/denonext/debug.js": "e8e5e198bd48c93d484c91c4c78af1900bd81d9bfcfd543e8ac75216f5404c10", + "https://esm.sh/stable/preact@10.15.1/denonext/devtools.js": "f61430e179a84483f8ea8dc098d7d0d46b2f0546de4027518bfcef197cd665c9", + "https://esm.sh/stable/preact@10.15.1/denonext/preact.mjs": "30710ac1d5ff3711ae0c04eddbeb706f34f82d97489f61aaf09897bc75d2a628" + } +} diff --git a/tests/specs/info_tests/info_import_map/main.tsx b/tests/specs/info_tests/info_import_map/main.tsx new file mode 100644 index 000000000..e38f14a58 --- /dev/null +++ b/tests/specs/info_tests/info_import_map/main.tsx @@ -0,0 +1,2 @@ +import { render } from "preact"; +console.log(render); diff --git a/tests/specs/info_tests/info_import_map/with_import_map.out b/tests/specs/info_tests/info_import_map/with_import_map.out new file mode 100644 index 000000000..29dc17737 --- /dev/null +++ b/tests/specs/info_tests/info_import_map/with_import_map.out @@ -0,0 +1,16 @@ +Download https://esm.sh/preact@10.15.1/debug +Download https://esm.sh/stable/preact@10.15.1/denonext/preact.mjs +Download https://esm.sh/stable/preact@10.15.1/denonext/devtools.js +Download https://esm.sh/stable/preact@10.15.1/denonext/debug.js +local: [WILDCARD] +type: JavaScript +dependencies: 3 unique +size: [WILDCARD] + +https://esm.sh/preact@10.15.1/debug [WILDCARD] +├── https://esm.sh/stable/preact@10.15.1/denonext/preact.mjs [WILDCARD] +├─┬ https://esm.sh/stable/preact@10.15.1/denonext/devtools.js [WILDCARD] +│ └── https://esm.sh/stable/preact@10.15.1/denonext/preact.mjs [WILDCARD] +└─┬ https://esm.sh/stable/preact@10.15.1/denonext/debug.js [WILDCARD] + ├── https://esm.sh/stable/preact@10.15.1/denonext/preact.mjs [WILDCARD] + └── https://esm.sh/stable/preact@10.15.1/denonext/devtools.js [WILDCARD] diff --git a/tests/specs/info_tests/info_json/__test__.jsonc b/tests/specs/info_tests/info_json/__test__.jsonc new file mode 100644 index 000000000..4b50dc32b --- /dev/null +++ b/tests/specs/info_tests/info_json/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "info --json", + "output": "info_json.out" +} diff --git a/tests/specs/info_tests/info_json/info_json.out b/tests/specs/info_tests/info_json/info_json.out new file mode 100644 index 000000000..607489ca3 --- /dev/null +++ b/tests/specs/info_tests/info_json/info_json.out @@ -0,0 +1,9 @@ +{ + "version": 1, + "denoDir": "[WILDCARD]", + "modulesCache": "[WILDCARD]deps", + "npmCache": "[WILDCARD]npm", + "typescriptCache": "[WILDCARD]gen", + "registryCache": "[WILDCARD]registries", + "originStorage": "[WILDCARD]location_data" +} diff --git a/tests/specs/info_tests/info_json_deps_order/076_info_json_deps_order.out b/tests/specs/info_tests/info_json_deps_order/076_info_json_deps_order.out new file mode 100644 index 000000000..33d58da16 --- /dev/null +++ b/tests/specs/info_tests/info_json_deps_order/076_info_json_deps_order.out @@ -0,0 +1,165 @@ +{ + "roots": [ + "file://[WILDCARD]/076_info_json_deps_order.ts" + ], + "modules": [ + { + "kind": "esm", + "dependencies": [ + { + "specifier": "./recursive_imports/A.ts", + "code": { + "specifier": "file://[WILDCARD]/recursive_imports/A.ts", + "span": { + "start": { + "line": 1, + "character": 18 + }, + "end": { + "line": 1, + "character": 44 + } + } + } + } + ], + "local": "[WILDCARD]076_info_json_deps_order.ts", + [WILDCARD] + "mediaType": "TypeScript", + "specifier": "file://[WILDCARD]/076_info_json_deps_order.ts" + }, + { + "kind": "esm", + "dependencies": [ + { + "specifier": "./B.ts", + "code": { + "specifier": "file://[WILDCARD]/recursive_imports/B.ts", + "span": { + "start": { + "line": 0, + "character": 18 + }, + "end": { + "line": 0, + "character": 26 + } + } + } + }, + { + "specifier": "./common.ts", + "code": { + "specifier": "file://[WILDCARD]/recursive_imports/common.ts", + "span": { + "start": { + "line": 1, + "character": 22 + }, + "end": { + "line": 1, + "character": 35 + } + } + } + } + ], + "local": "[WILDCARD]A.ts", + [WILDCARD] + "mediaType": "TypeScript", + "specifier": "file://[WILDCARD]/recursive_imports/A.ts" + }, + { + "kind": "esm", + "dependencies": [ + { + "specifier": "./C.ts", + "code": { + "specifier": "file://[WILDCARD]/recursive_imports/C.ts", + "span": { + "start": { + "line": 0, + "character": 18 + }, + "end": { + "line": 0, + "character": 26 + } + } + } + }, + { + "specifier": "./common.ts", + "code": { + "specifier": "file://[WILDCARD]/recursive_imports/common.ts", + "span": { + "start": { + "line": 1, + "character": 22 + }, + "end": { + "line": 1, + "character": 35 + } + } + } + } + ], + "local": "[WILDCARD]B.ts", + [WILDCARD] + "mediaType": "TypeScript", + "specifier": "file://[WILDCARD]/recursive_imports/B.ts" + }, + { + "kind": "esm", + "dependencies": [ + { + "specifier": "./A.ts", + "code": { + "specifier": "file://[WILDCARD]/recursive_imports/A.ts", + "span": { + "start": { + "line": 0, + "character": 18 + }, + "end": { + "line": 0, + "character": 26 + } + } + } + }, + { + "specifier": "./common.ts", + "code": { + "specifier": "file://[WILDCARD]/recursive_imports/common.ts", + "span": { + "start": { + "line": 1, + "character": 22 + }, + "end": { + "line": 1, + "character": 35 + } + } + } + } + ], + "local": "[WILDCARD]C.ts", + [WILDCARD] + "mediaType": "TypeScript", + "specifier": "file://[WILDCARD]/recursive_imports/C.ts" + }, + { + "kind": "esm", + "local": "[WILDCARD]common.ts", + [WILDCARD] + "mediaType": "TypeScript", + "specifier": "file://[WILDCARD]/recursive_imports/common.ts" + } + ], + "redirects": {}, + "version": 1, + "npmPackages": {} +} diff --git a/tests/specs/info_tests/info_json_deps_order/076_info_json_deps_order.ts b/tests/specs/info_tests/info_json_deps_order/076_info_json_deps_order.ts new file mode 100644 index 000000000..b1ae75e68 --- /dev/null +++ b/tests/specs/info_tests/info_json_deps_order/076_info_json_deps_order.ts @@ -0,0 +1,2 @@ +// deno-lint-ignore no-unused-vars +import { A } from "./recursive_imports/A.ts"; diff --git a/tests/specs/info_tests/info_json_deps_order/__test__.jsonc b/tests/specs/info_tests/info_json_deps_order/__test__.jsonc new file mode 100644 index 000000000..f474f4d38 --- /dev/null +++ b/tests/specs/info_tests/info_json_deps_order/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "info --json 076_info_json_deps_order.ts", + "output": "076_info_json_deps_order.out" +} diff --git a/tests/specs/info_tests/info_json_deps_order/recursive_imports/A.ts b/tests/specs/info_tests/info_json_deps_order/recursive_imports/A.ts new file mode 100644 index 000000000..43ecdbe5e --- /dev/null +++ b/tests/specs/info_tests/info_json_deps_order/recursive_imports/A.ts @@ -0,0 +1,7 @@ +import { B } from "./B.ts"; +import { thing } from "./common.ts"; + +export function A() { + thing(); + B(); +} diff --git a/tests/specs/info_tests/info_json_deps_order/recursive_imports/B.ts b/tests/specs/info_tests/info_json_deps_order/recursive_imports/B.ts new file mode 100644 index 000000000..9fff0fdc9 --- /dev/null +++ b/tests/specs/info_tests/info_json_deps_order/recursive_imports/B.ts @@ -0,0 +1,7 @@ +import { C } from "./C.ts"; +import { thing } from "./common.ts"; + +export function B() { + thing(); + C(); +} diff --git a/tests/specs/info_tests/info_json_deps_order/recursive_imports/C.ts b/tests/specs/info_tests/info_json_deps_order/recursive_imports/C.ts new file mode 100644 index 000000000..e47e77b41 --- /dev/null +++ b/tests/specs/info_tests/info_json_deps_order/recursive_imports/C.ts @@ -0,0 +1,8 @@ +import { A } from "./A.ts"; +import { thing } from "./common.ts"; + +export function C() { + if (A != null) { + thing(); + } +} diff --git a/tests/specs/info_tests/info_json_deps_order/recursive_imports/common.ts b/tests/specs/info_tests/info_json_deps_order/recursive_imports/common.ts new file mode 100644 index 000000000..2b16a7bf1 --- /dev/null +++ b/tests/specs/info_tests/info_json_deps_order/recursive_imports/common.ts @@ -0,0 +1,2 @@ +export function thing() { +} diff --git a/tests/specs/info_tests/info_json_location/__test__.jsonc b/tests/specs/info_tests/info_json_location/__test__.jsonc new file mode 100644 index 000000000..0c1acc3d9 --- /dev/null +++ b/tests/specs/info_tests/info_json_location/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "info --json --location https://deno.land", + "output": "info_json_location.out" +} diff --git a/tests/specs/info_tests/info_json_location/info_json_location.out b/tests/specs/info_tests/info_json_location/info_json_location.out new file mode 100644 index 000000000..004bf03db --- /dev/null +++ b/tests/specs/info_tests/info_json_location/info_json_location.out @@ -0,0 +1,10 @@ +{ + "version": 1, + "denoDir": "[WILDCARD]", + "modulesCache": "[WILDCARD]deps", + "npmCache": "[WILDCARD]npm", + "typescriptCache": "[WILDCARD]gen", + "registryCache": "[WILDCARD]registries", + "originStorage": "[WILDCARD]location_data[WILDCARD]", + "localStorage": "[WILDCARD]location_data[WILDCARD]local_storage" +} diff --git a/tests/specs/info_tests/info_missing_module/__test__.jsonc b/tests/specs/info_tests/info_missing_module/__test__.jsonc new file mode 100644 index 000000000..edc151972 --- /dev/null +++ b/tests/specs/info_tests/info_missing_module/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "info error_009_missing_js_module.js", + "output": "info_missing_module.out" +} diff --git a/tests/specs/info_tests/info_missing_module/error_009_missing_js_module.js b/tests/specs/info_tests/info_missing_module/error_009_missing_js_module.js new file mode 100644 index 000000000..e6ca88934 --- /dev/null +++ b/tests/specs/info_tests/info_missing_module/error_009_missing_js_module.js @@ -0,0 +1 @@ +import "./bad-module.js"; diff --git a/tests/specs/info_tests/info_missing_module/info_missing_module.out b/tests/specs/info_tests/info_missing_module/info_missing_module.out new file mode 100644 index 000000000..c62d690c1 --- /dev/null +++ b/tests/specs/info_tests/info_missing_module/info_missing_module.out @@ -0,0 +1,7 @@ +local: [WILDCARD]error_009_missing_js_module.js +type: JavaScript +dependencies: 0 unique +size: 26B + +file://[WILDCARD]/error_009_missing_js_module.js (26B) +└── file://[WILDCARD]/bad-module.js (missing) diff --git a/tests/specs/info_tests/info_recursive_modules/__test__.jsonc b/tests/specs/info_tests/info_recursive_modules/__test__.jsonc new file mode 100644 index 000000000..c4313a2fb --- /dev/null +++ b/tests/specs/info_tests/info_recursive_modules/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "info --quiet info_recursive_imports_test.ts", + "output": "info_recursive_imports_test.out", + "exitCode": 0 +} diff --git a/tests/specs/info_tests/info_recursive_modules/info_recursive_imports_test.out b/tests/specs/info_tests/info_recursive_modules/info_recursive_imports_test.out new file mode 100644 index 000000000..3340f3859 --- /dev/null +++ b/tests/specs/info_tests/info_recursive_modules/info_recursive_imports_test.out @@ -0,0 +1,13 @@ +local: [WILDCARD]info_recursive_imports_test.ts +type: TypeScript +dependencies: 4 unique +size: [WILDCARD] + +file://[WILDCARD]/info_recursive_imports_test.ts ([WILDCARD]) +└─┬ file://[WILDCARD]/recursive_imports/A.ts ([WILDCARD]) + ├─┬ file://[WILDCARD]/recursive_imports/B.ts ([WILDCARD]) + │ ├─┬ file://[WILDCARD]/recursive_imports/C.ts ([WILDCARD]) + │ │ ├── file://[WILDCARD]/recursive_imports/A.ts * + │ │ └── file://[WILDCARD]/recursive_imports/common.ts ([WILDCARD]) + │ └── file://[WILDCARD]/recursive_imports/common.ts * + └── file://[WILDCARD]/recursive_imports/common.ts * diff --git a/tests/specs/info_tests/info_recursive_modules/info_recursive_imports_test.ts b/tests/specs/info_tests/info_recursive_modules/info_recursive_imports_test.ts new file mode 100644 index 000000000..c9ba44755 --- /dev/null +++ b/tests/specs/info_tests/info_recursive_modules/info_recursive_imports_test.ts @@ -0,0 +1,5 @@ +import { A } from "./recursive_imports/A.ts"; + +export function test() { + A(); +} diff --git a/tests/specs/info_tests/info_recursive_modules/recursive_imports/A.ts b/tests/specs/info_tests/info_recursive_modules/recursive_imports/A.ts new file mode 100644 index 000000000..43ecdbe5e --- /dev/null +++ b/tests/specs/info_tests/info_recursive_modules/recursive_imports/A.ts @@ -0,0 +1,7 @@ +import { B } from "./B.ts"; +import { thing } from "./common.ts"; + +export function A() { + thing(); + B(); +} diff --git a/tests/specs/info_tests/info_recursive_modules/recursive_imports/B.ts b/tests/specs/info_tests/info_recursive_modules/recursive_imports/B.ts new file mode 100644 index 000000000..9fff0fdc9 --- /dev/null +++ b/tests/specs/info_tests/info_recursive_modules/recursive_imports/B.ts @@ -0,0 +1,7 @@ +import { C } from "./C.ts"; +import { thing } from "./common.ts"; + +export function B() { + thing(); + C(); +} diff --git a/tests/specs/info_tests/info_recursive_modules/recursive_imports/C.ts b/tests/specs/info_tests/info_recursive_modules/recursive_imports/C.ts new file mode 100644 index 000000000..e47e77b41 --- /dev/null +++ b/tests/specs/info_tests/info_recursive_modules/recursive_imports/C.ts @@ -0,0 +1,8 @@ +import { A } from "./A.ts"; +import { thing } from "./common.ts"; + +export function C() { + if (A != null) { + thing(); + } +} diff --git a/tests/specs/info_tests/info_recursive_modules/recursive_imports/common.ts b/tests/specs/info_tests/info_recursive_modules/recursive_imports/common.ts new file mode 100644 index 000000000..2b16a7bf1 --- /dev/null +++ b/tests/specs/info_tests/info_recursive_modules/recursive_imports/common.ts @@ -0,0 +1,2 @@ +export function thing() { +} diff --git a/tests/specs/info_tests/info_type_import/__test__.jsonc b/tests/specs/info_tests/info_type_import/__test__.jsonc new file mode 100644 index 000000000..2092ecf08 --- /dev/null +++ b/tests/specs/info_tests/info_type_import/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "info info_type_import.ts", + "output": "info_type_import.out" +} diff --git a/tests/specs/info_tests/info_type_import/info_type_import.out b/tests/specs/info_tests/info_type_import/info_type_import.out new file mode 100644 index 000000000..0423efe82 --- /dev/null +++ b/tests/specs/info_tests/info_type_import/info_type_import.out @@ -0,0 +1,7 @@ +local: [WILDCARD]info_type_import.ts +type: TypeScript +dependencies: 1 unique +size: [WILDCARD] + +[WILDCARD]info_type_import.ts ([WILDCARD]) +└── [WILDCARD]type_and_code.ts ([WILDCARD]) diff --git a/tests/specs/info_tests/info_type_import/info_type_import.ts b/tests/specs/info_tests/info_type_import/info_type_import.ts new file mode 100644 index 000000000..5d8ca21ce --- /dev/null +++ b/tests/specs/info_tests/info_type_import/info_type_import.ts @@ -0,0 +1,3 @@ +import { AnInterface as _, isAnInterface } from "./type_and_code.ts"; + +isAnInterface({}); diff --git a/tests/specs/info_tests/info_type_import/type_and_code.ts b/tests/specs/info_tests/info_type_import/type_and_code.ts new file mode 100644 index 000000000..b14713419 --- /dev/null +++ b/tests/specs/info_tests/info_type_import/type_and_code.ts @@ -0,0 +1,7 @@ +export interface AnInterface { + a: string; +} + +export function isAnInterface(value: unknown): value is AnInterface { + return value && typeof value === "object" && "a" in value; +} diff --git a/tests/specs/info_tests/json_file/__test__.jsonc b/tests/specs/info_tests/json_file/__test__.jsonc new file mode 100644 index 000000000..61289da94 --- /dev/null +++ b/tests/specs/info_tests/json_file/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "info --quiet --json json_output/main.ts", + "output": "json_output/main.out", + "exitCode": 0 +} diff --git a/tests/specs/info_tests/json_file/json_output/main.out b/tests/specs/info_tests/json_file/json_output/main.out new file mode 100644 index 000000000..d4c2f234d --- /dev/null +++ b/tests/specs/info_tests/json_file/json_output/main.out @@ -0,0 +1,92 @@ +{ + "roots": [ + "file://[WILDCARD]/json_output/main.ts" + ], + "modules": [ + { + "kind": "esm", + "dependencies": [ + { + "specifier": "../mod1.ts", + "code": { + "specifier": "file://[WILDCARD]/mod1.ts", + "span": { + "start": { + "line": 0, + "character": 52 + }, + "end": { + "line": 0, + "character": 64 + } + } + } + } + ], + "local": "[WILDCARD]main.ts", + [WILDCARD] + "mediaType": "TypeScript", + "specifier": "file://[WILDCARD]/json_output/main.ts" + }, + { + "kind": "esm", + "dependencies": [ + { + "specifier": "./subdir2/mod2.ts", + "code": { + "specifier": "file://[WILDCARD]/subdir2/mod2.ts", + "span": { + "start": { + "line": 0, + "character": 40 + }, + "end": { + "line": 0, + "character": 59 + } + } + } + } + ], + "local": "[WILDCARD]mod1.ts", + [WILDCARD] + "mediaType": "TypeScript", + "specifier": "file://[WILDCARD]/mod1.ts" + }, + { + "kind": "esm", + "local": "[WILDCARD]print_hello.ts", + [WILDCARD] + "mediaType": "TypeScript", + "specifier": "file://[WILDCARD]/print_hello.ts" + }, + { + "kind": "esm", + "dependencies": [ + { + "specifier": "../print_hello.ts", + "code": { + "specifier": "file://[WILDCARD]/print_hello.ts", + "span": { + "start": { + "line": 0, + "character": 27 + }, + "end": { + "line": 0, + "character": 46 + } + } + } + } + ], + "local": "[WILDCARD]mod2.ts", + [WILDCARD] + "mediaType": "TypeScript", + "specifier": "file://[WILDCARD]/subdir2/mod2.ts" + } + ], + "redirects": {}, + "version": 1, + "npmPackages": {} +} diff --git a/tests/specs/info_tests/json_file/json_output/main.ts b/tests/specs/info_tests/json_file/json_output/main.ts new file mode 100644 index 000000000..d9029af8a --- /dev/null +++ b/tests/specs/info_tests/json_file/json_output/main.ts @@ -0,0 +1,11 @@ +import { printHello3, returnsFoo2, returnsHi } from "../mod1.ts"; + +printHello3(); + +if (returnsHi() !== "Hi") { + throw Error("Unexpected"); +} + +if (returnsFoo2() !== "Foo") { + throw Error("Unexpected"); +} diff --git a/tests/specs/info_tests/json_file/mod1.ts b/tests/specs/info_tests/json_file/mod1.ts new file mode 100644 index 000000000..5e58f432e --- /dev/null +++ b/tests/specs/info_tests/json_file/mod1.ts @@ -0,0 +1,17 @@ +import { printHello2, returnsFoo } from "./subdir2/mod2.ts"; + +export function returnsHi(): string { + return "Hi"; +} + +export function returnsFoo2(): string { + return returnsFoo(); +} + +export function printHello3() { + printHello2(); +} + +export function throwsError() { + throw Error("exception from mod1"); +} diff --git a/tests/specs/info_tests/json_file/mod2.ts b/tests/specs/info_tests/json_file/mod2.ts new file mode 100644 index 000000000..ce1adc0e8 --- /dev/null +++ b/tests/specs/info_tests/json_file/mod2.ts @@ -0,0 +1 @@ +export { printHello } from "./print_hello.ts"; diff --git a/tests/specs/info_tests/json_file/print_hello.ts b/tests/specs/info_tests/json_file/print_hello.ts new file mode 100644 index 000000000..b9c0ad527 --- /dev/null +++ b/tests/specs/info_tests/json_file/print_hello.ts @@ -0,0 +1,3 @@ +export function printHello() { + console.log("Hello"); +} diff --git a/tests/specs/info_tests/json_file/subdir2/dynamic_import.ts b/tests/specs/info_tests/json_file/subdir2/dynamic_import.ts new file mode 100644 index 000000000..59beb64c3 --- /dev/null +++ b/tests/specs/info_tests/json_file/subdir2/dynamic_import.ts @@ -0,0 +1,4 @@ +(async () => { + const { printHello } = await import("../mod2.ts"); + printHello(); +})(); diff --git a/tests/specs/info_tests/json_file/subdir2/mod2.ts b/tests/specs/info_tests/json_file/subdir2/mod2.ts new file mode 100644 index 000000000..9071d0aeb --- /dev/null +++ b/tests/specs/info_tests/json_file/subdir2/mod2.ts @@ -0,0 +1,9 @@ +import { printHello } from "../print_hello.ts"; + +export function returnsFoo(): string { + return "Foo"; +} + +export function printHello2() { + printHello(); +} diff --git a/tests/specs/info_tests/multiple_imports/__test__.jsonc b/tests/specs/info_tests/multiple_imports/__test__.jsonc new file mode 100644 index 000000000..b110b2d4c --- /dev/null +++ b/tests/specs/info_tests/multiple_imports/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "info http://127.0.0.1:4545/run/019_media_types.ts", + "output": "multiple_imports.out" +} diff --git a/tests/specs/info_tests/multiple_imports/multiple_imports.out b/tests/specs/info_tests/multiple_imports/multiple_imports.out new file mode 100644 index 000000000..cb13318ca --- /dev/null +++ b/tests/specs/info_tests/multiple_imports/multiple_imports.out @@ -0,0 +1,15 @@ +[WILDCARD] +local: [WILDCARD]http[WILDCARD]127.0.0.1_PORT4545[WILDCARD] +type: TypeScript +dependencies: 8 unique +size: [WILDCARD] + +http://127.0.0.1:4545/run/019_media_types.ts ([WILDCARD]) +├── http://localhost:4545/subdir/mt_text_typescript.t1.ts ([WILDCARD]) +├── http://localhost:4545/subdir/mt_video_vdn.t2.ts ([WILDCARD]) +├── http://localhost:4545/subdir/mt_video_mp2t.t3.ts ([WILDCARD]) +├── http://localhost:4545/subdir/mt_application_x_typescript.t4.ts ([WILDCARD]) +├── http://localhost:4545/subdir/mt_text_javascript.j1.js ([WILDCARD]) +├── http://localhost:4545/subdir/mt_application_ecmascript.j2.js ([WILDCARD]) +├── http://localhost:4545/subdir/mt_text_ecmascript.j3.js ([WILDCARD]) +└── http://localhost:4545/subdir/mt_application_x_javascript.j4.js ([WILDCARD]) diff --git a/tests/specs/info_tests/types_header_direct/__test__.jsonc b/tests/specs/info_tests/types_header_direct/__test__.jsonc new file mode 100644 index 000000000..7f9b462ef --- /dev/null +++ b/tests/specs/info_tests/types_header_direct/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "info --reload type_directives_01.ts", + "output": "types_header.out" +} diff --git a/tests/specs/info_tests/types_header_direct/type_directives_01.ts b/tests/specs/info_tests/types_header_direct/type_directives_01.ts new file mode 100644 index 000000000..71305824c --- /dev/null +++ b/tests/specs/info_tests/types_header_direct/type_directives_01.ts @@ -0,0 +1,3 @@ +import * as foo from "http://127.0.0.1:4545/xTypeScriptTypes.js"; + +console.log(foo.foo); diff --git a/tests/specs/info_tests/types_header_direct/types_header.out b/tests/specs/info_tests/types_header_direct/types_header.out new file mode 100644 index 000000000..722e02f77 --- /dev/null +++ b/tests/specs/info_tests/types_header_direct/types_header.out @@ -0,0 +1,9 @@ +[WILDCARD] +local: [WILDCARD]type_directives_01.ts +type: TypeScript +dependencies: 2 unique +size: [WILDCARD] + +[WILDCARD]/type_directives_01.ts ([WILDCARD]) +└─┬ http://127.0.0.1:4545/xTypeScriptTypes.js ([WILDCARD]) + └── http://127.0.0.1:4545/xTypeScriptTypes.d.ts ([WILDCARD]) diff --git a/tests/specs/info_tests/with_config_override/__test__.jsonc b/tests/specs/info_tests/with_config_override/__test__.jsonc new file mode 100644 index 000000000..02c7d2a78 --- /dev/null +++ b/tests/specs/info_tests/with_config_override/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "info with_config/test.ts --config with_config/deno-override.json --import-map with_config/import_map.json", + "output": "with_config/with_config.out" +} diff --git a/tests/specs/info_tests/with_config_override/with_config/deno-override.json b/tests/specs/info_tests/with_config_override/with_config/deno-override.json new file mode 100644 index 000000000..ee44ba947 --- /dev/null +++ b/tests/specs/info_tests/with_config_override/with_config/deno-override.json @@ -0,0 +1,3 @@ +{ + "importMap": "import_map.json" +} diff --git a/tests/specs/info_tests/with_config_override/with_config/deno.json b/tests/specs/info_tests/with_config_override/with_config/deno.json new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/tests/specs/info_tests/with_config_override/with_config/deno.json @@ -0,0 +1 @@ +{} diff --git a/tests/specs/info_tests/with_config_override/with_config/import_map.json b/tests/specs/info_tests/with_config_override/with_config/import_map.json new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/tests/specs/info_tests/with_config_override/with_config/import_map.json @@ -0,0 +1 @@ +{} diff --git a/tests/specs/info_tests/with_config_override/with_config/test.ts b/tests/specs/info_tests/with_config_override/with_config/test.ts new file mode 100644 index 000000000..85ce559e8 --- /dev/null +++ b/tests/specs/info_tests/with_config_override/with_config/test.ts @@ -0,0 +1 @@ +console.log("foo"); diff --git a/tests/specs/info_tests/with_config_override/with_config/with_config.out b/tests/specs/info_tests/with_config_override/with_config/with_config.out new file mode 100644 index 000000000..95a1f30bc --- /dev/null +++ b/tests/specs/info_tests/with_config_override/with_config/with_config.out @@ -0,0 +1,7 @@ +Warning the configuration file "[WILDCARD]/deno-override.json" contains an entry for "importMap" that is being ignored. +local: [WILDCARD]test.ts +type: TypeScript +dependencies: 0 unique +size: [WILDCARD] + +file:///[WILDCARD]/test.ts ([WILDCARD]) |