diff options
author | Matt Mastracci <matthew@mastracci.com> | 2024-02-10 13:22:13 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-10 20:22:13 +0000 |
commit | f5e46c9bf2f50d66a953fa133161fc829cecff06 (patch) | |
tree | 8faf2f5831c1c7b11d842cd9908d141082c869a5 /cli/tests/testdata/run/top_level_await | |
parent | d2477f780630a812bfd65e3987b70c0d309385bb (diff) |
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.
Diffstat (limited to 'cli/tests/testdata/run/top_level_await')
28 files changed, 0 insertions, 186 deletions
diff --git a/cli/tests/testdata/run/top_level_await/circular.js b/cli/tests/testdata/run/top_level_await/circular.js deleted file mode 100644 index ff2964b6a..000000000 --- a/cli/tests/testdata/run/top_level_await/circular.js +++ /dev/null @@ -1,8 +0,0 @@ -import { foo } from "./tla3/timeout_loop.js"; - -export const collection = []; - -const mod = await import("./tla3/b.js"); - -console.log("foo in main", foo); -console.log("mod", mod); diff --git a/cli/tests/testdata/run/top_level_await/circular.out b/cli/tests/testdata/run/top_level_await/circular.out deleted file mode 100644 index c88978961..000000000 --- a/cli/tests/testdata/run/top_level_await/circular.out +++ /dev/null @@ -1,10 +0,0 @@ -timeout loop 0 -timeout loop 1 -timeout loop 2 -timeout loop 3 -timeout loop 4 -timeout loop 5 -error: Top-level await promise never resolved -const mod = await import("./tla3/b.js"); - ^ - at <anonymous> ([WILDCARD]/top_level_await/circular.js:5:13) diff --git a/cli/tests/testdata/run/top_level_await/loop.js b/cli/tests/testdata/run/top_level_await/loop.js deleted file mode 100644 index 415db5ec7..000000000 --- a/cli/tests/testdata/run/top_level_await/loop.js +++ /dev/null @@ -1,20 +0,0 @@ -const importsDir = Deno.readDirSync( - Deno.realPathSync("./run/top_level_await/tla2"), -); - -const resolvedPaths = []; - -for (const { name } of importsDir) { - const filePath = Deno.realPathSync(`./run/top_level_await/tla2/${name}`); - resolvedPaths.push(filePath); -} - -resolvedPaths.sort(); - -for (const filePath of resolvedPaths) { - console.log("loading", filePath); - const mod = await import(`file://${filePath}`); - console.log("loaded", mod); -} - -console.log("all loaded"); diff --git a/cli/tests/testdata/run/top_level_await/loop.out b/cli/tests/testdata/run/top_level_await/loop.out deleted file mode 100644 index 1bdffbf66..000000000 --- a/cli/tests/testdata/run/top_level_await/loop.out +++ /dev/null @@ -1,5 +0,0 @@ -loading [WILDCARD]a.js -loaded [Module: null prototype] { default: [class Foo] } -loading [WILDCARD]b.js -loaded [Module: null prototype] { default: [class Bar] } -all loaded diff --git a/cli/tests/testdata/run/top_level_await/nested.out b/cli/tests/testdata/run/top_level_await/nested.out deleted file mode 100644 index 8a1218a10..000000000 --- a/cli/tests/testdata/run/top_level_await/nested.out +++ /dev/null @@ -1,5 +0,0 @@ -1 -2 -3 -4 -5 diff --git a/cli/tests/testdata/run/top_level_await/nested/a.js b/cli/tests/testdata/run/top_level_await/nested/a.js deleted file mode 100644 index 74837d4ba..000000000 --- a/cli/tests/testdata/run/top_level_await/nested/a.js +++ /dev/null @@ -1,3 +0,0 @@ -console.log(2); -await import("./b.js"); -console.log(4); diff --git a/cli/tests/testdata/run/top_level_await/nested/b.js b/cli/tests/testdata/run/top_level_await/nested/b.js deleted file mode 100644 index 3bd241b50..000000000 --- a/cli/tests/testdata/run/top_level_await/nested/b.js +++ /dev/null @@ -1 +0,0 @@ -console.log(3); diff --git a/cli/tests/testdata/run/top_level_await/nested/main.js b/cli/tests/testdata/run/top_level_await/nested/main.js deleted file mode 100644 index ed46a4717..000000000 --- a/cli/tests/testdata/run/top_level_await/nested/main.js +++ /dev/null @@ -1,3 +0,0 @@ -console.log(1); -await import("./a.js"); -console.log(5); diff --git a/cli/tests/testdata/run/top_level_await/order.js b/cli/tests/testdata/run/top_level_await/order.js deleted file mode 100644 index 30659cdfb..000000000 --- a/cli/tests/testdata/run/top_level_await/order.js +++ /dev/null @@ -1,21 +0,0 @@ -// Ported from Node -// https://github.com/nodejs/node/blob/54746bb763ebea0dc7e99d88ff4b379bcd680964/test/es-module/test-esm-tla.mjs - -const { default: order } = await import("./tla/parent.js"); - -console.log("order", JSON.stringify(order)); - -if ( - !( - order[0] === "order" && - order[1] === "b" && - order[2] === "c" && - order[3] === "d" && - order[4] === "a" && - order[5] === "parent" - ) -) { - throw new Error("TLA wrong order"); -} - -console.log("TLA order correct"); diff --git a/cli/tests/testdata/run/top_level_await/order.out b/cli/tests/testdata/run/top_level_await/order.out deleted file mode 100644 index 4cc27858c..000000000 --- a/cli/tests/testdata/run/top_level_await/order.out +++ /dev/null @@ -1,2 +0,0 @@ -order ["order","b","c","d","a","parent"] -TLA order correct diff --git a/cli/tests/testdata/run/top_level_await/tla/a.js b/cli/tests/testdata/run/top_level_await/tla/a.js deleted file mode 100644 index c3ef3f7db..000000000 --- a/cli/tests/testdata/run/top_level_await/tla/a.js +++ /dev/null @@ -1,3 +0,0 @@ -import order from "./order.js"; - -order.push("b"); diff --git a/cli/tests/testdata/run/top_level_await/tla/b.js b/cli/tests/testdata/run/top_level_await/tla/b.js deleted file mode 100644 index 3271c92d8..000000000 --- a/cli/tests/testdata/run/top_level_await/tla/b.js +++ /dev/null @@ -1,7 +0,0 @@ -import order from "./order.js"; - -await new Promise((resolve) => { - setTimeout(resolve, 200); -}); - -order.push("a"); diff --git a/cli/tests/testdata/run/top_level_await/tla/c.js b/cli/tests/testdata/run/top_level_await/tla/c.js deleted file mode 100644 index 806eb0a8b..000000000 --- a/cli/tests/testdata/run/top_level_await/tla/c.js +++ /dev/null @@ -1,3 +0,0 @@ -import order from "./order.js"; - -order.push("c"); diff --git a/cli/tests/testdata/run/top_level_await/tla/d.js b/cli/tests/testdata/run/top_level_await/tla/d.js deleted file mode 100644 index 283ebf817..000000000 --- a/cli/tests/testdata/run/top_level_await/tla/d.js +++ /dev/null @@ -1,8 +0,0 @@ -import order from "./order.js"; - -const end = Date.now() + 500; -while (end < Date.now()) { - // pass -} - -order.push("d"); diff --git a/cli/tests/testdata/run/top_level_await/tla/order.js b/cli/tests/testdata/run/top_level_await/tla/order.js deleted file mode 100644 index f213a562c..000000000 --- a/cli/tests/testdata/run/top_level_await/tla/order.js +++ /dev/null @@ -1 +0,0 @@ -export default ["order"]; diff --git a/cli/tests/testdata/run/top_level_await/tla/parent.js b/cli/tests/testdata/run/top_level_await/tla/parent.js deleted file mode 100644 index 1ecc15463..000000000 --- a/cli/tests/testdata/run/top_level_await/tla/parent.js +++ /dev/null @@ -1,9 +0,0 @@ -import order from "./order.js"; -import "./a.js"; -import "./b.js"; -import "./c.js"; -import "./d.js"; - -order.push("parent"); - -export default order; diff --git a/cli/tests/testdata/run/top_level_await/tla2/a.js b/cli/tests/testdata/run/top_level_await/tla2/a.js deleted file mode 100644 index d07bcb94d..000000000 --- a/cli/tests/testdata/run/top_level_await/tla2/a.js +++ /dev/null @@ -1,5 +0,0 @@ -export default class Foo { - constructor(message) { - this.message = message; - } -} diff --git a/cli/tests/testdata/run/top_level_await/tla2/b.js b/cli/tests/testdata/run/top_level_await/tla2/b.js deleted file mode 100644 index 68e357c1e..000000000 --- a/cli/tests/testdata/run/top_level_await/tla2/b.js +++ /dev/null @@ -1,5 +0,0 @@ -export default class Bar { - constructor(message) { - this.message = message; - } -} diff --git a/cli/tests/testdata/run/top_level_await/tla3/b.js b/cli/tests/testdata/run/top_level_await/tla3/b.js deleted file mode 100644 index d0349545e..000000000 --- a/cli/tests/testdata/run/top_level_await/tla3/b.js +++ /dev/null @@ -1,7 +0,0 @@ -import { foo } from "./timeout_loop.js"; -import { collection } from "../circular.js"; - -console.log("collection in b", collection); -console.log("foo in b", foo); - -export const a = "a"; diff --git a/cli/tests/testdata/run/top_level_await/tla3/timeout_loop.js b/cli/tests/testdata/run/top_level_await/tla3/timeout_loop.js deleted file mode 100644 index 860e6cd2a..000000000 --- a/cli/tests/testdata/run/top_level_await/tla3/timeout_loop.js +++ /dev/null @@ -1,23 +0,0 @@ -export const foo = "foo"; - -export function delay(ms) { - return new Promise((res) => - setTimeout(() => { - res(); - }, ms) - ); -} - -let i = 0; - -async function timeoutLoop() { - await delay(1000); - console.log("timeout loop", i); - i++; - if (i > 5) { - return; - } - timeoutLoop(); -} - -timeoutLoop(); diff --git a/cli/tests/testdata/run/top_level_await/top_level_await.js b/cli/tests/testdata/run/top_level_await/top_level_await.js deleted file mode 100644 index ea319ea12..000000000 --- a/cli/tests/testdata/run/top_level_await/top_level_await.js +++ /dev/null @@ -1,3 +0,0 @@ -const buf = await Deno.readFile("./assets/hello.txt"); -const n = await Deno.stdout.write(buf); -console.log(`\n\nwrite ${n}`); diff --git a/cli/tests/testdata/run/top_level_await/top_level_await.out b/cli/tests/testdata/run/top_level_await/top_level_await.out deleted file mode 100644 index 4b65d15fe..000000000 --- a/cli/tests/testdata/run/top_level_await/top_level_await.out +++ /dev/null @@ -1,3 +0,0 @@ -Hello world! - -write 12 diff --git a/cli/tests/testdata/run/top_level_await/top_level_await.ts b/cli/tests/testdata/run/top_level_await/top_level_await.ts deleted file mode 100644 index 8d47ceb21..000000000 --- a/cli/tests/testdata/run/top_level_await/top_level_await.ts +++ /dev/null @@ -1,3 +0,0 @@ -const buf: Uint8Array = await Deno.readFile("./assets/hello.txt"); -const n: number = await Deno.stdout.write(buf); -console.log(`\n\nwrite ${n}`); diff --git a/cli/tests/testdata/run/top_level_await/top_level_for_await.js b/cli/tests/testdata/run/top_level_await/top_level_for_await.js deleted file mode 100644 index a330f6c71..000000000 --- a/cli/tests/testdata/run/top_level_await/top_level_for_await.js +++ /dev/null @@ -1,10 +0,0 @@ -function* asyncGenerator() { - let i = 0; - while (i < 3) { - yield i++; - } -} - -for await (const num of asyncGenerator()) { - console.log(num); -} diff --git a/cli/tests/testdata/run/top_level_await/top_level_for_await.out b/cli/tests/testdata/run/top_level_await/top_level_for_await.out deleted file mode 100644 index 4539bbf2d..000000000 --- a/cli/tests/testdata/run/top_level_await/top_level_for_await.out +++ /dev/null @@ -1,3 +0,0 @@ -0 -1 -2 diff --git a/cli/tests/testdata/run/top_level_await/top_level_for_await.ts b/cli/tests/testdata/run/top_level_await/top_level_for_await.ts deleted file mode 100644 index 9179322d7..000000000 --- a/cli/tests/testdata/run/top_level_await/top_level_for_await.ts +++ /dev/null @@ -1,10 +0,0 @@ -async function* asyncGenerator(): AsyncIterableIterator<number> { - let i = 0; - while (i < 3) { - yield i++; - } -} - -for await (const num of asyncGenerator()) { - console.log(num); -} diff --git a/cli/tests/testdata/run/top_level_await/unresolved.js b/cli/tests/testdata/run/top_level_await/unresolved.js deleted file mode 100644 index 231a8cd63..000000000 --- a/cli/tests/testdata/run/top_level_await/unresolved.js +++ /dev/null @@ -1 +0,0 @@ -await new Promise(() => {}); diff --git a/cli/tests/testdata/run/top_level_await/unresolved.out b/cli/tests/testdata/run/top_level_await/unresolved.out deleted file mode 100644 index 1f4ea5d38..000000000 --- a/cli/tests/testdata/run/top_level_await/unresolved.out +++ /dev/null @@ -1,4 +0,0 @@ -error: Top-level await promise never resolved -await new Promise(() => {}); -^ - at <anonymous> ([WILDCARD]top_level_await/unresolved.js:1:1) |