From f5e46c9bf2f50d66a953fa133161fc829cecff06 Mon Sep 17 00:00:00 2001 From: Matt Mastracci Date: Sat, 10 Feb 2024 13:22:13 -0700 Subject: chore: move cli/tests/ -> tests/ (#22369) This looks like a massive PR, but it's only a move from cli/tests -> tests, and updates of relative paths for files. This is the first step towards aggregate all of the integration test files under tests/, which will lead to a set of integration tests that can run without the CLI binary being built. While we could leave these tests under `cli`, it would require us to keep a more complex directory structure for the various test runners. In addition, we have a lot of complexity to ignore various test files in the `cli` project itself (cargo publish exclusion rules, autotests = false, etc). And finally, the `tests/` folder will eventually house the `test_ffi`, `test_napi` and other testing code, reducing the size of the root repo directory. For easier review, the extremely large and noisy "move" is in the first commit (with no changes -- just a move), while the remainder of the changes to actual files is in the second commit. --- tests/testdata/module_graph/file_tests-a.mjs | 3 +++ tests/testdata/module_graph/file_tests-b-mod.js | 1 + tests/testdata/module_graph/file_tests-b.ts | 1 + tests/testdata/module_graph/file_tests-c-mod.ts | 1 + tests/testdata/module_graph/file_tests-checkwithconfig.ts | 5 +++++ tests/testdata/module_graph/file_tests-diag.ts | 4 ++++ tests/testdata/module_graph/file_tests-dynamicimport.ts | 5 +++++ tests/testdata/module_graph/file_tests-importjson.ts | 3 +++ tests/testdata/module_graph/file_tests-importremap.ts | 3 +++ tests/testdata/module_graph/file_tests-main.ts | 4 ++++ tests/testdata/module_graph/file_tests-some.json | 5 +++++ tests/testdata/module_graph/file_typesref.d.ts | 1 + tests/testdata/module_graph/file_typesref.js | 3 +++ .../module_graph/https_deno.land-std-http-server.ts | 5 +++++ tests/testdata/module_graph/https_deno.land-x-a-mod.ts | 1 + tests/testdata/module_graph/https_deno.land-x-a.ts | 1 + tests/testdata/module_graph/https_deno.land-x-import_map.ts | 4 ++++ tests/testdata/module_graph/https_deno.land-x-jquery.js | 3 +++ tests/testdata/module_graph/https_deno.land-x-lib-a.ts | 1 + tests/testdata/module_graph/https_deno.land-x-lib-b.js | 1 + tests/testdata/module_graph/https_deno.land-x-lib-c.d.ts | 1 + tests/testdata/module_graph/https_deno.land-x-lib-c.js | 3 +++ tests/testdata/module_graph/https_deno.land-x-lib-mod.d.ts | 9 +++++++++ tests/testdata/module_graph/https_deno.land-x-lib-mod.js | 5 +++++ tests/testdata/module_graph/https_deno.land-x-mod.ts | 3 +++ tests/testdata/module_graph/https_deno.land-x-transpile.tsx | 5 +++++ tests/testdata/module_graph/https_unpkg.com-lodash-index.js | 3 +++ tests/testdata/module_graph/lockfile.json | 8 ++++++++ tests/testdata/module_graph/lockfile_fail.json | 8 ++++++++ tests/testdata/module_graph/tsconfig.json | 6 ++++++ tests/testdata/module_graph/tsconfig_01.json | 13 +++++++++++++ 31 files changed, 119 insertions(+) create mode 100644 tests/testdata/module_graph/file_tests-a.mjs create mode 100644 tests/testdata/module_graph/file_tests-b-mod.js create mode 100644 tests/testdata/module_graph/file_tests-b.ts create mode 100644 tests/testdata/module_graph/file_tests-c-mod.ts create mode 100644 tests/testdata/module_graph/file_tests-checkwithconfig.ts create mode 100644 tests/testdata/module_graph/file_tests-diag.ts create mode 100644 tests/testdata/module_graph/file_tests-dynamicimport.ts create mode 100644 tests/testdata/module_graph/file_tests-importjson.ts create mode 100644 tests/testdata/module_graph/file_tests-importremap.ts create mode 100644 tests/testdata/module_graph/file_tests-main.ts create mode 100644 tests/testdata/module_graph/file_tests-some.json create mode 100644 tests/testdata/module_graph/file_typesref.d.ts create mode 100644 tests/testdata/module_graph/file_typesref.js create mode 100644 tests/testdata/module_graph/https_deno.land-std-http-server.ts create mode 100644 tests/testdata/module_graph/https_deno.land-x-a-mod.ts create mode 100644 tests/testdata/module_graph/https_deno.land-x-a.ts create mode 100644 tests/testdata/module_graph/https_deno.land-x-import_map.ts create mode 100644 tests/testdata/module_graph/https_deno.land-x-jquery.js create mode 100644 tests/testdata/module_graph/https_deno.land-x-lib-a.ts create mode 100644 tests/testdata/module_graph/https_deno.land-x-lib-b.js create mode 100644 tests/testdata/module_graph/https_deno.land-x-lib-c.d.ts create mode 100644 tests/testdata/module_graph/https_deno.land-x-lib-c.js create mode 100644 tests/testdata/module_graph/https_deno.land-x-lib-mod.d.ts create mode 100644 tests/testdata/module_graph/https_deno.land-x-lib-mod.js create mode 100644 tests/testdata/module_graph/https_deno.land-x-mod.ts create mode 100644 tests/testdata/module_graph/https_deno.land-x-transpile.tsx create mode 100644 tests/testdata/module_graph/https_unpkg.com-lodash-index.js create mode 100644 tests/testdata/module_graph/lockfile.json create mode 100644 tests/testdata/module_graph/lockfile_fail.json create mode 100644 tests/testdata/module_graph/tsconfig.json create mode 100644 tests/testdata/module_graph/tsconfig_01.json (limited to 'tests/testdata/module_graph') diff --git a/tests/testdata/module_graph/file_tests-a.mjs b/tests/testdata/module_graph/file_tests-a.mjs new file mode 100644 index 000000000..72b3a67bc --- /dev/null +++ b/tests/testdata/module_graph/file_tests-a.mjs @@ -0,0 +1,3 @@ +import * as b from "./b.ts"; + +console.log(b); diff --git a/tests/testdata/module_graph/file_tests-b-mod.js b/tests/testdata/module_graph/file_tests-b-mod.js new file mode 100644 index 000000000..59d168993 --- /dev/null +++ b/tests/testdata/module_graph/file_tests-b-mod.js @@ -0,0 +1 @@ +export const b = "b"; diff --git a/tests/testdata/module_graph/file_tests-b.ts b/tests/testdata/module_graph/file_tests-b.ts new file mode 100644 index 000000000..59d168993 --- /dev/null +++ b/tests/testdata/module_graph/file_tests-b.ts @@ -0,0 +1 @@ +export const b = "b"; diff --git a/tests/testdata/module_graph/file_tests-c-mod.ts b/tests/testdata/module_graph/file_tests-c-mod.ts new file mode 100644 index 000000000..7f2cfac77 --- /dev/null +++ b/tests/testdata/module_graph/file_tests-c-mod.ts @@ -0,0 +1 @@ +export const c = "c"; diff --git a/tests/testdata/module_graph/file_tests-checkwithconfig.ts b/tests/testdata/module_graph/file_tests-checkwithconfig.ts new file mode 100644 index 000000000..e7af5fa19 --- /dev/null +++ b/tests/testdata/module_graph/file_tests-checkwithconfig.ts @@ -0,0 +1,5 @@ +import { ServerRequest } from "https://deno.land/std/http/server.ts"; + +export default (req: ServerRequest) => { + req.respond({ body: `Hello, from Deno v${Deno.version.deno}!` }); +}; diff --git a/tests/testdata/module_graph/file_tests-diag.ts b/tests/testdata/module_graph/file_tests-diag.ts new file mode 100644 index 000000000..ba365234a --- /dev/null +++ b/tests/testdata/module_graph/file_tests-diag.ts @@ -0,0 +1,4 @@ +import * as c from "./c/mod.ts"; + +// deno-lint-ignore no-undef +consol.log(c); diff --git a/tests/testdata/module_graph/file_tests-dynamicimport.ts b/tests/testdata/module_graph/file_tests-dynamicimport.ts new file mode 100644 index 000000000..b5c9f080f --- /dev/null +++ b/tests/testdata/module_graph/file_tests-dynamicimport.ts @@ -0,0 +1,5 @@ +try { + await import("bare_module_specifier"); +} catch (err) { + console.log(err); +} diff --git a/tests/testdata/module_graph/file_tests-importjson.ts b/tests/testdata/module_graph/file_tests-importjson.ts new file mode 100644 index 000000000..c2bc2bca7 --- /dev/null +++ b/tests/testdata/module_graph/file_tests-importjson.ts @@ -0,0 +1,3 @@ +import * as config from "./some.json"; + +console.log(config); diff --git a/tests/testdata/module_graph/file_tests-importremap.ts b/tests/testdata/module_graph/file_tests-importremap.ts new file mode 100644 index 000000000..17f012673 --- /dev/null +++ b/tests/testdata/module_graph/file_tests-importremap.ts @@ -0,0 +1,3 @@ +import * as a from "https://deno.land/x/a/mod.ts"; + +console.log(a); diff --git a/tests/testdata/module_graph/file_tests-main.ts b/tests/testdata/module_graph/file_tests-main.ts new file mode 100644 index 000000000..aa8eef1b8 --- /dev/null +++ b/tests/testdata/module_graph/file_tests-main.ts @@ -0,0 +1,4 @@ +// @deno-types="https://deno.land/x/lib/mod.d.ts" +import * as lib from "https://deno.land/x/lib/mod.js"; + +console.log(lib); diff --git a/tests/testdata/module_graph/file_tests-some.json b/tests/testdata/module_graph/file_tests-some.json new file mode 100644 index 000000000..567c4ba21 --- /dev/null +++ b/tests/testdata/module_graph/file_tests-some.json @@ -0,0 +1,5 @@ +{ + "config": { + "debug": true + } +} diff --git a/tests/testdata/module_graph/file_typesref.d.ts b/tests/testdata/module_graph/file_typesref.d.ts new file mode 100644 index 000000000..8ae31dde3 --- /dev/null +++ b/tests/testdata/module_graph/file_typesref.d.ts @@ -0,0 +1 @@ +export const a: "a"; diff --git a/tests/testdata/module_graph/file_typesref.js b/tests/testdata/module_graph/file_typesref.js new file mode 100644 index 000000000..79da24cae --- /dev/null +++ b/tests/testdata/module_graph/file_typesref.js @@ -0,0 +1,3 @@ +/// + +export const a = "a"; diff --git a/tests/testdata/module_graph/https_deno.land-std-http-server.ts b/tests/testdata/module_graph/https_deno.land-std-http-server.ts new file mode 100644 index 000000000..0b3c995ec --- /dev/null +++ b/tests/testdata/module_graph/https_deno.land-std-http-server.ts @@ -0,0 +1,5 @@ +export class ServerRequest { + respond(value: { body: string }) { + console.log(value); + } +} diff --git a/tests/testdata/module_graph/https_deno.land-x-a-mod.ts b/tests/testdata/module_graph/https_deno.land-x-a-mod.ts new file mode 100644 index 000000000..1e334d399 --- /dev/null +++ b/tests/testdata/module_graph/https_deno.land-x-a-mod.ts @@ -0,0 +1 @@ +export * as b from "../b/mod.js"; diff --git a/tests/testdata/module_graph/https_deno.land-x-a.ts b/tests/testdata/module_graph/https_deno.land-x-a.ts new file mode 100644 index 000000000..a6e3cea80 --- /dev/null +++ b/tests/testdata/module_graph/https_deno.land-x-a.ts @@ -0,0 +1 @@ +export const a = "hello"; diff --git a/tests/testdata/module_graph/https_deno.land-x-import_map.ts b/tests/testdata/module_graph/https_deno.land-x-import_map.ts new file mode 100644 index 000000000..e285d863a --- /dev/null +++ b/tests/testdata/module_graph/https_deno.land-x-import_map.ts @@ -0,0 +1,4 @@ +import * as $ from "jquery"; +import * as _ from "lodash"; + +console.log($, _); diff --git a/tests/testdata/module_graph/https_deno.land-x-jquery.js b/tests/testdata/module_graph/https_deno.land-x-jquery.js new file mode 100644 index 000000000..71896157a --- /dev/null +++ b/tests/testdata/module_graph/https_deno.land-x-jquery.js @@ -0,0 +1,3 @@ +const $ = {}; + +export default $; diff --git a/tests/testdata/module_graph/https_deno.land-x-lib-a.ts b/tests/testdata/module_graph/https_deno.land-x-lib-a.ts new file mode 100644 index 000000000..a0a6f8e94 --- /dev/null +++ b/tests/testdata/module_graph/https_deno.land-x-lib-a.ts @@ -0,0 +1 @@ +export const a: string[] = []; diff --git a/tests/testdata/module_graph/https_deno.land-x-lib-b.js b/tests/testdata/module_graph/https_deno.land-x-lib-b.js new file mode 100644 index 000000000..13cacdd8b --- /dev/null +++ b/tests/testdata/module_graph/https_deno.land-x-lib-b.js @@ -0,0 +1 @@ +export const b = []; diff --git a/tests/testdata/module_graph/https_deno.land-x-lib-c.d.ts b/tests/testdata/module_graph/https_deno.land-x-lib-c.d.ts new file mode 100644 index 000000000..fac988e49 --- /dev/null +++ b/tests/testdata/module_graph/https_deno.land-x-lib-c.d.ts @@ -0,0 +1 @@ +export const c: string[]; diff --git a/tests/testdata/module_graph/https_deno.land-x-lib-c.js b/tests/testdata/module_graph/https_deno.land-x-lib-c.js new file mode 100644 index 000000000..620ca0b66 --- /dev/null +++ b/tests/testdata/module_graph/https_deno.land-x-lib-c.js @@ -0,0 +1,3 @@ +/// + +export const c = []; diff --git a/tests/testdata/module_graph/https_deno.land-x-lib-mod.d.ts b/tests/testdata/module_graph/https_deno.land-x-lib-mod.d.ts new file mode 100644 index 000000000..76ed81df0 --- /dev/null +++ b/tests/testdata/module_graph/https_deno.land-x-lib-mod.d.ts @@ -0,0 +1,9 @@ +export * as a from "./a.ts"; +export * as b from "./b.js"; +export * as c from "./c.js"; + +export interface A { + a: string; +} + +export const mod: A[]; diff --git a/tests/testdata/module_graph/https_deno.land-x-lib-mod.js b/tests/testdata/module_graph/https_deno.land-x-lib-mod.js new file mode 100644 index 000000000..505162094 --- /dev/null +++ b/tests/testdata/module_graph/https_deno.land-x-lib-mod.js @@ -0,0 +1,5 @@ +export * as a from "./a.ts"; +export * as b from "./b.js"; +export * as c from "./c.js"; + +export const mod = []; diff --git a/tests/testdata/module_graph/https_deno.land-x-mod.ts b/tests/testdata/module_graph/https_deno.land-x-mod.ts new file mode 100644 index 000000000..35d76ef75 --- /dev/null +++ b/tests/testdata/module_graph/https_deno.land-x-mod.ts @@ -0,0 +1,3 @@ +import * as a from "./a.ts"; + +console.log(a); diff --git a/tests/testdata/module_graph/https_deno.land-x-transpile.tsx b/tests/testdata/module_graph/https_deno.land-x-transpile.tsx new file mode 100644 index 000000000..02955bad8 --- /dev/null +++ b/tests/testdata/module_graph/https_deno.land-x-transpile.tsx @@ -0,0 +1,5 @@ +export default class A { + render() { + return
Hello world!
; + } +} diff --git a/tests/testdata/module_graph/https_unpkg.com-lodash-index.js b/tests/testdata/module_graph/https_unpkg.com-lodash-index.js new file mode 100644 index 000000000..d16c126a6 --- /dev/null +++ b/tests/testdata/module_graph/https_unpkg.com-lodash-index.js @@ -0,0 +1,3 @@ +const _ = {}; + +export default _; diff --git a/tests/testdata/module_graph/lockfile.json b/tests/testdata/module_graph/lockfile.json new file mode 100644 index 000000000..03cfe1185 --- /dev/null +++ b/tests/testdata/module_graph/lockfile.json @@ -0,0 +1,8 @@ +{ + "https://deno.land/x/lib/a.ts": "4437fee72a750d9540a9575ea6426761d0aa1beedfa308fb1bc38701d97011b8", + "https://deno.land/x/lib/b.js": "093cc4164ca7a9adb11597ad291e021634f0b2d8c048137f7e9fb0d709499028", + "https://deno.land/x/lib/c.d.ts": "a95647377477cc663559f5e857bf318c584622ed1295a8ccb0c091d06bee0456", + "https://deno.land/x/lib/c.js": "4ff934f4b3b06f320c3130326376d9f2435e2ecedd582940ca90938137d004e1", + "https://deno.land/x/lib/mod.d.ts": "e54b994fbf63cb7f01076ea54f2ed67b185f2a48e8ff71d74bd9c8180a338eb7", + "https://deno.land/x/lib/mod.js": "3f6fcb8ef83ed6c66e71774d5079d14d22a6948dc6e5358ac30e0ab55e1a6404" +} diff --git a/tests/testdata/module_graph/lockfile_fail.json b/tests/testdata/module_graph/lockfile_fail.json new file mode 100644 index 000000000..c0019fba4 --- /dev/null +++ b/tests/testdata/module_graph/lockfile_fail.json @@ -0,0 +1,8 @@ +{ + "https://deno.land/x/lib/a.ts": "4437fee72a750d9540a9575ea6426761d0aa1beedfa308fb1bc38701d97011b8", + "https://deno.land/x/lib/b.js": "093cc4164ca7a9adb11597ad291e021634f0b2d8c048137f7e9fb0d709499028", + "https://deno.land/x/lib/c.d.ts": "a95647377477cc663559f5e857bf318c584622ed1295a8ccb0c091d06bee0456", + "https://deno.land/x/lib/c.js": "4ff934f4b3b06f320c3130326376d9f2435e2ecedd582940ca90938137d004e1", + "https://deno.land/x/lib/mod.d.ts": "e54b994fbf63cb7f01076ea54f2ed67b185f2a48e8ff71d74bd9c8180a338eb7", + "https://deno.land/x/lib/mod.js": "3f6fcb8ef83fd6c66e71774d5079d14d22a6948dc6e5358ac30e0ab55e1a6404" +} diff --git a/tests/testdata/module_graph/tsconfig.json b/tests/testdata/module_graph/tsconfig.json new file mode 100644 index 000000000..a4c5f4f33 --- /dev/null +++ b/tests/testdata/module_graph/tsconfig.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "target": "ES5", + "jsx": "preserve" + } +} diff --git a/tests/testdata/module_graph/tsconfig_01.json b/tests/testdata/module_graph/tsconfig_01.json new file mode 100644 index 000000000..f7496d475 --- /dev/null +++ b/tests/testdata/module_graph/tsconfig_01.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "strict": false, + "noImplicitAny": false, + "noImplicitThis": false, + "alwaysStrict": false, + "strictNullChecks": false, + "strictFunctionTypes": true, + "strictPropertyInitialization": false, + "experimentalDecorators": true, + "emitDecoratorMetadata": true + } +} -- cgit v1.2.3