diff options
Diffstat (limited to 'cli/tests/testdata/test')
45 files changed, 743 insertions, 0 deletions
diff --git a/cli/tests/testdata/test/allow_all.out b/cli/tests/testdata/test/allow_all.out new file mode 100644 index 000000000..9b7367b94 --- /dev/null +++ b/cli/tests/testdata/test/allow_all.out @@ -0,0 +1,18 @@ +[WILDCARD] +running 14 tests from [WILDCARD] +test read false ... ok [WILDCARD] +test read true ... ok [WILDCARD] +test write false ... ok [WILDCARD] +test write true ... ok [WILDCARD] +test net false ... ok [WILDCARD] +test net true ... ok [WILDCARD] +test env false ... ok [WILDCARD] +test env true ... ok [WILDCARD] +test run false ... ok [WILDCARD] +test run true ... ok [WILDCARD] +test ffi false ... ok [WILDCARD] +test ffi true ... ok [WILDCARD] +test hrtime false ... ok [WILDCARD] +test hrtime true ... ok [WILDCARD] + +test result: ok. 14 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out [WILDCARD] diff --git a/cli/tests/testdata/test/allow_all.ts b/cli/tests/testdata/test/allow_all.ts new file mode 100644 index 000000000..abe55a8d5 --- /dev/null +++ b/cli/tests/testdata/test/allow_all.ts @@ -0,0 +1,35 @@ +import { assertEquals } from "../../../../test_util/std/testing/asserts.ts"; + +const permissions: Deno.PermissionName[] = [ + "read", + "write", + "net", + "env", + "run", + "ffi", + "hrtime", +]; + +for (const name of permissions) { + Deno.test({ + name: `${name} false`, + permissions: { + [name]: false, + }, + async fn() { + const status = await Deno.permissions.query({ name }); + assertEquals(status.state, "denied"); + }, + }); + + Deno.test({ + name: `${name} true`, + permissions: { + [name]: true, + }, + async fn() { + const status = await Deno.permissions.query({ name }); + assertEquals(status.state, "granted"); + }, + }); +} diff --git a/cli/tests/testdata/test/allow_none.out b/cli/tests/testdata/test/allow_none.out new file mode 100644 index 000000000..b79c7e6bf --- /dev/null +++ b/cli/tests/testdata/test/allow_none.out @@ -0,0 +1,51 @@ +[WILDCARD] +running 7 tests from [WILDCARD] +test read ... FAILED [WILDCARD] +test write ... FAILED [WILDCARD] +test net ... FAILED [WILDCARD] +test env ... FAILED [WILDCARD] +test run ... FAILED [WILDCARD] +test ffi ... FAILED [WILDCARD] +test hrtime ... FAILED [WILDCARD] + +failures: + +read +PermissionDenied: Can't escalate parent thread permissions +[WILDCARD] + +write +PermissionDenied: Can't escalate parent thread permissions +[WILDCARD] + +net +PermissionDenied: Can't escalate parent thread permissions +[WILDCARD] + +env +PermissionDenied: Can't escalate parent thread permissions +[WILDCARD] + +run +PermissionDenied: Can't escalate parent thread permissions +[WILDCARD] + +ffi +PermissionDenied: Can't escalate parent thread permissions +[WILDCARD] + +hrtime +PermissionDenied: Can't escalate parent thread permissions +[WILDCARD] + +failures: + + read + write + net + env + run + ffi + hrtime + +test result: FAILED. 0 passed; 7 failed; 0 ignored; 0 measured; 0 filtered out [WILDCARD] diff --git a/cli/tests/testdata/test/allow_none.ts b/cli/tests/testdata/test/allow_none.ts new file mode 100644 index 000000000..3153b9755 --- /dev/null +++ b/cli/tests/testdata/test/allow_none.ts @@ -0,0 +1,23 @@ +import { unreachable } from "../../../../test_util/std/testing/asserts.ts"; + +const permissions: Deno.PermissionName[] = [ + "read", + "write", + "net", + "env", + "run", + "ffi", + "hrtime", +]; + +for (const name of permissions) { + Deno.test({ + name, + permissions: { + [name]: true, + }, + fn() { + unreachable(); + }, + }); +} diff --git a/cli/tests/testdata/test/clear_timeout.out b/cli/tests/testdata/test/clear_timeout.out new file mode 100644 index 000000000..c9f459dbe --- /dev/null +++ b/cli/tests/testdata/test/clear_timeout.out @@ -0,0 +1,8 @@ +Check [WILDCARD]/test/clear_timeout.ts +running 3 tests from [WILDCARD]/test/clear_timeout.ts +test test 1 ... ok ([WILDCARD]) +test test 2 ... ok ([WILDCARD]) +test test 3 ... ok ([WILDCARD]) + +test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + diff --git a/cli/tests/testdata/test/clear_timeout.ts b/cli/tests/testdata/test/clear_timeout.ts new file mode 100644 index 000000000..00056e853 --- /dev/null +++ b/cli/tests/testdata/test/clear_timeout.ts @@ -0,0 +1,5 @@ +clearTimeout(setTimeout(() => {}, 1000)); + +Deno.test("test 1", () => {}); +Deno.test("test 2", () => {}); +Deno.test("test 3", () => {}); diff --git a/cli/tests/testdata/test/doc.out b/cli/tests/testdata/test/doc.out new file mode 100644 index 000000000..91ecbd4d4 --- /dev/null +++ b/cli/tests/testdata/test/doc.out @@ -0,0 +1,10 @@ +Check [WILDCARD]/doc.ts$2-5.ts +Check [WILDCARD]/doc.ts$6-9.js +Check [WILDCARD]/doc.ts$10-13.jsx +Check [WILDCARD]/doc.ts$14-17.ts +Check [WILDCARD]/doc.ts$18-21.tsx +Check [WILDCARD]/doc.ts$30-35.ts +error: TS2367 [ERROR]: This condition will always return 'false' since the types 'string' and 'number' have no overlap. +console.assert(check() == 42); + ~~~~~~~~~~~~~ + at [WILDCARD]/doc.ts$30-35.ts:3:16 diff --git a/cli/tests/testdata/test/doc.ts b/cli/tests/testdata/test/doc.ts new file mode 100644 index 000000000..52fe6bdf0 --- /dev/null +++ b/cli/tests/testdata/test/doc.ts @@ -0,0 +1,38 @@ +/** + * ``` + * import * as doc from "./doc.ts"; + * ``` + * + * ```js + * import * as doc from "./doc.ts"; + * ``` + * + * ```jsx + * import * as doc from "./doc.ts"; + * ``` + * + * ```ts + * import * as doc from "./doc.ts"; + * ``` + * + * ```tsx + * import * as doc from "./doc.ts"; + * ``` + * + * ```text + * import * as doc from "./doc.ts"; + * ``` + * + * @module doc + */ + +/** + * ``` + * import { check } from "./doc.ts"; + * + * console.assert(check() == 42); + * ``` + */ +export function check(): string { + return "check"; +} diff --git a/cli/tests/testdata/test/doc_markdown.out b/cli/tests/testdata/test/doc_markdown.out new file mode 100644 index 000000000..9d2c35974 --- /dev/null +++ b/cli/tests/testdata/test/doc_markdown.out @@ -0,0 +1,7 @@ +Check [WILDCARD]/test/doc_markdown/doc.md$11-14.js +Check [WILDCARD]/test/doc_markdown/doc.md$17-20.ts +Check [WILDCARD]/test/doc_markdown/doc.md$23-26.ts +error: TS2322 [ERROR]: Type 'number' is not assignable to type 'string'. +const a: string = 42; + ^ + at [WILDCARD]/test/doc_markdown/doc.md$23-26.ts:1:7 diff --git a/cli/tests/testdata/test/doc_markdown/doc.md b/cli/tests/testdata/test/doc_markdown/doc.md new file mode 100644 index 000000000..e5afb841b --- /dev/null +++ b/cli/tests/testdata/test/doc_markdown/doc.md @@ -0,0 +1,25 @@ +# Documentation + +The following block does not have a language attribute and should be ignored: + +``` +This is a fenced block without attributes, it's invalid and it should be ignored. +``` + +The following block should be given a js extension on extraction: + +```js +console.log("js"); +``` + +The following block should be given a ts extension on extraction: + +```ts +console.log("ts"); +``` + +The following example will trigger the type-checker to fail: + +```ts +const a: string = 42; +``` diff --git a/cli/tests/testdata/test/exit_sanitizer.out b/cli/tests/testdata/test/exit_sanitizer.out new file mode 100644 index 000000000..f331d7a70 --- /dev/null +++ b/cli/tests/testdata/test/exit_sanitizer.out @@ -0,0 +1,35 @@ +Check [WILDCARD]/test/exit_sanitizer.ts +running 3 tests from [WILDCARD]/test/exit_sanitizer.ts +test exit(0) ... FAILED ([WILDCARD]) +test exit(1) ... FAILED ([WILDCARD]) +test exit(2) ... FAILED ([WILDCARD]) + +failures: + +exit(0) +AssertionError: Test case attempted to exit with exit code: 0 + at [WILDCARD] + at [WILDCARD]/test/exit_sanitizer.ts:2:8 + at [WILDCARD] + +exit(1) +AssertionError: Test case attempted to exit with exit code: 1 + at [WILDCARD] + at [WILDCARD]/test/exit_sanitizer.ts:6:8 + at [WILDCARD] + +exit(2) +AssertionError: Test case attempted to exit with exit code: 2 + at [WILDCARD] + at [WILDCARD]/test/exit_sanitizer.ts:10:8 + at [WILDCARD] + +failures: + + exit(0) + exit(1) + exit(2) + +test result: FAILED. 0 passed; 3 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + +error: Test failed diff --git a/cli/tests/testdata/test/exit_sanitizer.ts b/cli/tests/testdata/test/exit_sanitizer.ts new file mode 100644 index 000000000..186406a9d --- /dev/null +++ b/cli/tests/testdata/test/exit_sanitizer.ts @@ -0,0 +1,11 @@ +Deno.test("exit(0)", function () { + Deno.exit(0); +}); + +Deno.test("exit(1)", function () { + Deno.exit(1); +}); + +Deno.test("exit(2)", function () { + Deno.exit(2); +}); diff --git a/cli/tests/testdata/test/fail.out b/cli/tests/testdata/test/fail.out new file mode 100644 index 000000000..66d471cdf --- /dev/null +++ b/cli/tests/testdata/test/fail.out @@ -0,0 +1,81 @@ +Check [WILDCARD]/test/fail.ts +running 10 tests from [WILDCARD]/test/fail.ts +test test 0 ... FAILED ([WILDCARD]) +test test 1 ... FAILED ([WILDCARD]) +test test 2 ... FAILED ([WILDCARD]) +test test 3 ... FAILED ([WILDCARD]) +test test 4 ... FAILED ([WILDCARD]) +test test 5 ... FAILED ([WILDCARD]) +test test 6 ... FAILED ([WILDCARD]) +test test 7 ... FAILED ([WILDCARD]) +test test 8 ... FAILED ([WILDCARD]) +test test 9 ... FAILED ([WILDCARD]) + +failures: + +test 0 +Error + at [WILDCARD]/test/fail.ts:2:9 + at [WILDCARD] + +test 1 +Error + at [WILDCARD]/test/fail.ts:5:9 + at [WILDCARD] + +test 2 +Error + at [WILDCARD]/test/fail.ts:8:9 + at [WILDCARD] + +test 3 +Error + at [WILDCARD]/test/fail.ts:11:9 + at [WILDCARD] + +test 4 +Error + at [WILDCARD]/test/fail.ts:14:9 + at [WILDCARD] + +test 5 +Error + at [WILDCARD]/test/fail.ts:17:9 + at [WILDCARD] + +test 6 +Error + at [WILDCARD]/test/fail.ts:20:9 + at [WILDCARD] + +test 7 +Error + at [WILDCARD]/test/fail.ts:23:9 + at [WILDCARD] + +test 8 +Error + at [WILDCARD]/test/fail.ts:26:9 + at [WILDCARD] + +test 9 +Error + at [WILDCARD]/test/fail.ts:29:9 + at [WILDCARD] + +failures: + + test 0 + test 1 + test 2 + test 3 + test 4 + test 5 + test 6 + test 7 + test 8 + test 9 + +test result: FAILED. 0 passed; 10 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + +error: Test failed diff --git a/cli/tests/testdata/test/fail.ts b/cli/tests/testdata/test/fail.ts new file mode 100644 index 000000000..9340db556 --- /dev/null +++ b/cli/tests/testdata/test/fail.ts @@ -0,0 +1,30 @@ +Deno.test("test 0", () => { + throw new Error(); +}); +Deno.test("test 1", () => { + throw new Error(); +}); +Deno.test("test 2", () => { + throw new Error(); +}); +Deno.test("test 3", () => { + throw new Error(); +}); +Deno.test("test 4", () => { + throw new Error(); +}); +Deno.test("test 5", () => { + throw new Error(); +}); +Deno.test("test 6", () => { + throw new Error(); +}); +Deno.test("test 7", () => { + throw new Error(); +}); +Deno.test("test 8", () => { + throw new Error(); +}); +Deno.test("test 9", () => { + throw new Error(); +}); diff --git a/cli/tests/testdata/test/fail_fast.out b/cli/tests/testdata/test/fail_fast.out new file mode 100644 index 000000000..c97f854fa --- /dev/null +++ b/cli/tests/testdata/test/fail_fast.out @@ -0,0 +1,18 @@ +Check [WILDCARD]/test/fail_fast.ts +running 10 tests from [WILDCARD]/test/fail_fast.ts +test test 1 ... FAILED ([WILDCARD]) + +failures: + +test 1 +Error + at [WILDCARD]/test/fail_fast.ts:2:9 + at [WILDCARD] + +failures: + + test 1 + +test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + +error: Test failed diff --git a/cli/tests/testdata/test/fail_fast.ts b/cli/tests/testdata/test/fail_fast.ts new file mode 100644 index 000000000..637e825ec --- /dev/null +++ b/cli/tests/testdata/test/fail_fast.ts @@ -0,0 +1,30 @@ +Deno.test("test 1", () => { + throw new Error(); +}); +Deno.test("test 2", () => { + throw new Error(); +}); +Deno.test("test 3", () => { + throw new Error(); +}); +Deno.test("test 4", () => { + throw new Error(); +}); +Deno.test("test 5", () => { + throw new Error(); +}); +Deno.test("test 6", () => { + throw new Error(); +}); +Deno.test("test 7", () => { + throw new Error(); +}); +Deno.test("test 8", () => { + throw new Error(); +}); +Deno.test("test 9", () => { + throw new Error(); +}); +Deno.test("test 0", () => { + throw new Error(); +}); diff --git a/cli/tests/testdata/test/fail_fast_with_val.out b/cli/tests/testdata/test/fail_fast_with_val.out new file mode 100644 index 000000000..a902e4c7b --- /dev/null +++ b/cli/tests/testdata/test/fail_fast_with_val.out @@ -0,0 +1,23 @@ +[WILDCARD] +running 10 tests from [WILDCARD]/test/fail_fast_with_val.ts +test test 1 ... FAILED ([WILDCARD]) +test test 2 ... FAILED ([WILDCARD]) + +failures: + +test 1 +Error + at [WILDCARD]/test/fail_fast_with_val.ts:2:9 + at [WILDCARD] + +test 2 +Error + at [WILDCARD]/test/fail_fast_with_val.ts:5:9 + at [WILDCARD] + +failures: + + test 1 + test 2 + +test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) diff --git a/cli/tests/testdata/test/fail_fast_with_val.ts b/cli/tests/testdata/test/fail_fast_with_val.ts new file mode 100644 index 000000000..637e825ec --- /dev/null +++ b/cli/tests/testdata/test/fail_fast_with_val.ts @@ -0,0 +1,30 @@ +Deno.test("test 1", () => { + throw new Error(); +}); +Deno.test("test 2", () => { + throw new Error(); +}); +Deno.test("test 3", () => { + throw new Error(); +}); +Deno.test("test 4", () => { + throw new Error(); +}); +Deno.test("test 5", () => { + throw new Error(); +}); +Deno.test("test 6", () => { + throw new Error(); +}); +Deno.test("test 7", () => { + throw new Error(); +}); +Deno.test("test 8", () => { + throw new Error(); +}); +Deno.test("test 9", () => { + throw new Error(); +}); +Deno.test("test 0", () => { + throw new Error(); +}); diff --git a/cli/tests/testdata/test/finally_timeout.out b/cli/tests/testdata/test/finally_timeout.out new file mode 100644 index 000000000..570e9108f --- /dev/null +++ b/cli/tests/testdata/test/finally_timeout.out @@ -0,0 +1,19 @@ +Check [WILDCARD]/test/finally_timeout.ts +running 2 tests from [WILDCARD]/test/finally_timeout.ts +test error ... FAILED ([WILDCARD]) +test success ... ok ([WILDCARD]) + +failures: + +error +Error: fail + at [WILDCARD]/test/finally_timeout.ts:4:11 + at [WILDCARD] + +failures: + + error + +test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + +error: Test failed diff --git a/cli/tests/testdata/test/finally_timeout.ts b/cli/tests/testdata/test/finally_timeout.ts new file mode 100644 index 000000000..dcc0a4d64 --- /dev/null +++ b/cli/tests/testdata/test/finally_timeout.ts @@ -0,0 +1,11 @@ +Deno.test("error", function () { + const timer = setTimeout(() => null, 10000); + try { + throw new Error("fail"); + } finally { + clearTimeout(timer); + } +}); + +Deno.test("success", function () { +}); diff --git a/cli/tests/testdata/test/ignore.out b/cli/tests/testdata/test/ignore.out new file mode 100644 index 000000000..a7c68261d --- /dev/null +++ b/cli/tests/testdata/test/ignore.out @@ -0,0 +1,15 @@ +Check [WILDCARD]/test/ignore.ts +running 10 tests from [WILDCARD]/test/ignore.ts +test test 0 ... ignored ([WILDCARD]) +test test 1 ... ignored ([WILDCARD]) +test test 2 ... ignored ([WILDCARD]) +test test 3 ... ignored ([WILDCARD]) +test test 4 ... ignored ([WILDCARD]) +test test 5 ... ignored ([WILDCARD]) +test test 6 ... ignored ([WILDCARD]) +test test 7 ... ignored ([WILDCARD]) +test test 8 ... ignored ([WILDCARD]) +test test 9 ... ignored ([WILDCARD]) + +test result: ok. 0 passed; 0 failed; 10 ignored; 0 measured; 0 filtered out ([WILDCARD]) + diff --git a/cli/tests/testdata/test/ignore.ts b/cli/tests/testdata/test/ignore.ts new file mode 100644 index 000000000..01113a129 --- /dev/null +++ b/cli/tests/testdata/test/ignore.ts @@ -0,0 +1,9 @@ +for (let i = 0; i < 10; i++) { + Deno.test({ + name: `test ${i}`, + ignore: true, + fn() { + throw new Error("unreachable"); + }, + }); +} diff --git a/cli/tests/testdata/test/ignore_permissions.out b/cli/tests/testdata/test/ignore_permissions.out new file mode 100644 index 000000000..c4d273d8f --- /dev/null +++ b/cli/tests/testdata/test/ignore_permissions.out @@ -0,0 +1,6 @@ +Check [WILDCARD]/test/ignore_permissions.ts +running 1 test from [WILDCARD]/test/ignore_permissions.ts +test ignore ... ignored ([WILDCARD]) + +test result: ok. 0 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out ([WILDCARD]) + diff --git a/cli/tests/testdata/test/ignore_permissions.ts b/cli/tests/testdata/test/ignore_permissions.ts new file mode 100644 index 000000000..ff3084441 --- /dev/null +++ b/cli/tests/testdata/test/ignore_permissions.ts @@ -0,0 +1,16 @@ +Deno.test({ + name: "ignore", + permissions: { + read: true, + write: true, + net: true, + env: true, + run: true, + ffi: true, + hrtime: true, + }, + ignore: true, + fn() { + throw new Error("unreachable"); + }, +}); diff --git a/cli/tests/testdata/test/meta.out b/cli/tests/testdata/test/meta.out new file mode 100644 index 000000000..a8c7acd63 --- /dev/null +++ b/cli/tests/testdata/test/meta.out @@ -0,0 +1,7 @@ +Check [WILDCARD]/test/meta.ts +import.meta.main: false +import.meta.url: [WILDCARD]/test/meta.ts +running 0 tests from [WILDCARD]/test/meta.ts + +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + diff --git a/cli/tests/testdata/test/meta.ts b/cli/tests/testdata/test/meta.ts new file mode 100644 index 000000000..e32fdeea6 --- /dev/null +++ b/cli/tests/testdata/test/meta.ts @@ -0,0 +1,2 @@ +console.log("import.meta.main: %s", import.meta.main); +console.log("import.meta.url: %s", import.meta.url); diff --git a/cli/tests/testdata/test/no_check.out b/cli/tests/testdata/test/no_check.out new file mode 100644 index 000000000..9daab7ac4 --- /dev/null +++ b/cli/tests/testdata/test/no_check.out @@ -0,0 +1,8 @@ + +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + +error: Uncaught TypeError: Cannot read properties of undefined (reading 'fn') +Deno.test(); + ^ + at [WILDCARD] + at [WILDCARD]/test/no_check.ts:1:6 diff --git a/cli/tests/testdata/test/no_check.ts b/cli/tests/testdata/test/no_check.ts new file mode 100644 index 000000000..79d75f989 --- /dev/null +++ b/cli/tests/testdata/test/no_check.ts @@ -0,0 +1 @@ +Deno.test(); diff --git a/cli/tests/testdata/test/no_color.ts b/cli/tests/testdata/test/no_color.ts new file mode 100644 index 000000000..38c531ee9 --- /dev/null +++ b/cli/tests/testdata/test/no_color.ts @@ -0,0 +1,17 @@ +Deno.test({ + name: "success", + fn() {}, +}); + +Deno.test({ + name: "fail", + fn() { + throw new Error("fail"); + }, +}); + +Deno.test({ + name: "ignored", + ignore: true, + fn() {}, +}); diff --git a/cli/tests/testdata/test/no_run.out b/cli/tests/testdata/test/no_run.out new file mode 100644 index 000000000..5edf03fe0 --- /dev/null +++ b/cli/tests/testdata/test/no_run.out @@ -0,0 +1,5 @@ +Check [WILDCARD]/test/no_run.ts +error: TS2322 [ERROR]: Type 'number' is not assignable to type 'string'. +const _value: string = 1; + ~~~~~~ + at [WILDCARD]/test/no_run.ts:1:7 diff --git a/cli/tests/testdata/test/no_run.ts b/cli/tests/testdata/test/no_run.ts new file mode 100644 index 000000000..b75915753 --- /dev/null +++ b/cli/tests/testdata/test/no_run.ts @@ -0,0 +1 @@ +const _value: string = 1; diff --git a/cli/tests/testdata/test/only.out b/cli/tests/testdata/test/only.out new file mode 100644 index 000000000..dc78cae80 --- /dev/null +++ b/cli/tests/testdata/test/only.out @@ -0,0 +1,7 @@ +Check [WILDCARD]/test/only.ts +running 1 test from [WILDCARD]/test/only.ts +test only ... ok ([WILDCARD]) + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 2 filtered out ([WILDCARD]) + +error: Test failed because the "only" option was used diff --git a/cli/tests/testdata/test/only.ts b/cli/tests/testdata/test/only.ts new file mode 100644 index 000000000..03c4dcac3 --- /dev/null +++ b/cli/tests/testdata/test/only.ts @@ -0,0 +1,15 @@ +Deno.test({ + name: "before", + fn() {}, +}); + +Deno.test({ + only: true, + name: "only", + fn() {}, +}); + +Deno.test({ + name: "after", + fn() {}, +}); diff --git a/cli/tests/testdata/test/pass.out b/cli/tests/testdata/test/pass.out new file mode 100644 index 000000000..cf81ac2e7 --- /dev/null +++ b/cli/tests/testdata/test/pass.out @@ -0,0 +1,15 @@ +Check [WILDCARD]/test/pass.ts +running 10 tests from [WILDCARD]/test/pass.ts +test test 0 ... ok ([WILDCARD]) +test test 1 ... ok ([WILDCARD]) +test test 2 ... ok ([WILDCARD]) +test test 3 ... ok ([WILDCARD]) +test test 4 ... ok ([WILDCARD]) +test test 5 ... ok ([WILDCARD]) +test test 6 ... ok ([WILDCARD]) +test test 7 ... ok ([WILDCARD]) +test test 8 ... ok ([WILDCARD]) +test test 9 ... ok ([WILDCARD]) + +test result: ok. 10 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + diff --git a/cli/tests/testdata/test/pass.ts b/cli/tests/testdata/test/pass.ts new file mode 100644 index 000000000..288cc7c83 --- /dev/null +++ b/cli/tests/testdata/test/pass.ts @@ -0,0 +1,10 @@ +Deno.test("test 0", () => {}); +Deno.test("test 1", () => {}); +Deno.test("test 2", () => {}); +Deno.test("test 3", () => {}); +Deno.test("test 4", () => {}); +Deno.test("test 5", () => {}); +Deno.test("test 6", () => {}); +Deno.test("test 7", () => {}); +Deno.test("test 8", () => {}); +Deno.test("test 9", () => {}); diff --git a/cli/tests/testdata/test/quiet.out b/cli/tests/testdata/test/quiet.out new file mode 100644 index 000000000..05302fb2c --- /dev/null +++ b/cli/tests/testdata/test/quiet.out @@ -0,0 +1,8 @@ +running 4 tests from [WILDCARD]/test/quiet.ts +test console.log ... ok ([WILDCARD]) +test console.error ... ok ([WILDCARD]) +test console.info ... ok ([WILDCARD]) +test console.warn ... ok ([WILDCARD]) + +test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + diff --git a/cli/tests/testdata/test/quiet.ts b/cli/tests/testdata/test/quiet.ts new file mode 100644 index 000000000..f40805bfb --- /dev/null +++ b/cli/tests/testdata/test/quiet.ts @@ -0,0 +1,15 @@ +Deno.test("console.log", function () { + console.log("log"); +}); + +Deno.test("console.error", function () { + console.error("error"); +}); + +Deno.test("console.info", function () { + console.info("info"); +}); + +Deno.test("console.warn", function () { + console.info("warn"); +}); diff --git a/cli/tests/testdata/test/shuffle.out b/cli/tests/testdata/test/shuffle.out new file mode 100644 index 000000000..04dd08ee2 --- /dev/null +++ b/cli/tests/testdata/test/shuffle.out @@ -0,0 +1,39 @@ +Check [WILDCARD]/test/shuffle/foo_test.ts +Check [WILDCARD]/test/shuffle/baz_test.ts +Check [WILDCARD]/test/shuffle/bar_test.ts +running 10 tests from [WILDCARD]/test/shuffle/foo_test.ts +test test 2 ... ok ([WILDCARD]) +test test 3 ... ok ([WILDCARD]) +test test 6 ... ok ([WILDCARD]) +test test 9 ... ok ([WILDCARD]) +test test 8 ... ok ([WILDCARD]) +test test 7 ... ok ([WILDCARD]) +test test 5 ... ok ([WILDCARD]) +test test 4 ... ok ([WILDCARD]) +test test 1 ... ok ([WILDCARD]) +test test 0 ... ok ([WILDCARD]) +running 10 tests from [WILDCARD]/test/shuffle/baz_test.ts +test test 2 ... ok ([WILDCARD]) +test test 3 ... ok ([WILDCARD]) +test test 6 ... ok ([WILDCARD]) +test test 9 ... ok ([WILDCARD]) +test test 8 ... ok ([WILDCARD]) +test test 7 ... ok ([WILDCARD]) +test test 5 ... ok ([WILDCARD]) +test test 4 ... ok ([WILDCARD]) +test test 1 ... ok ([WILDCARD]) +test test 0 ... ok ([WILDCARD]) +running 10 tests from [WILDCARD]/test/shuffle/bar_test.ts +test test 2 ... ok ([WILDCARD]) +test test 3 ... ok ([WILDCARD]) +test test 6 ... ok ([WILDCARD]) +test test 9 ... ok ([WILDCARD]) +test test 8 ... ok ([WILDCARD]) +test test 7 ... ok ([WILDCARD]) +test test 5 ... ok ([WILDCARD]) +test test 4 ... ok ([WILDCARD]) +test test 1 ... ok ([WILDCARD]) +test test 0 ... ok ([WILDCARD]) + +test result: ok. 30 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + diff --git a/cli/tests/testdata/test/shuffle/bar_test.ts b/cli/tests/testdata/test/shuffle/bar_test.ts new file mode 100644 index 000000000..ca118dc0d --- /dev/null +++ b/cli/tests/testdata/test/shuffle/bar_test.ts @@ -0,0 +1,3 @@ +for (let i = 0; i < 10; i++) { + Deno.test(`test ${i}`, () => {}); +} diff --git a/cli/tests/testdata/test/shuffle/baz_test.ts b/cli/tests/testdata/test/shuffle/baz_test.ts new file mode 100644 index 000000000..ca118dc0d --- /dev/null +++ b/cli/tests/testdata/test/shuffle/baz_test.ts @@ -0,0 +1,3 @@ +for (let i = 0; i < 10; i++) { + Deno.test(`test ${i}`, () => {}); +} diff --git a/cli/tests/testdata/test/shuffle/foo_test.ts b/cli/tests/testdata/test/shuffle/foo_test.ts new file mode 100644 index 000000000..ca118dc0d --- /dev/null +++ b/cli/tests/testdata/test/shuffle/foo_test.ts @@ -0,0 +1,3 @@ +for (let i = 0; i < 10; i++) { + Deno.test(`test ${i}`, () => {}); +} diff --git a/cli/tests/testdata/test/unhandled_rejection.out b/cli/tests/testdata/test/unhandled_rejection.out new file mode 100644 index 000000000..fae353a28 --- /dev/null +++ b/cli/tests/testdata/test/unhandled_rejection.out @@ -0,0 +1,10 @@ +Check [WILDCARD]/test/unhandled_rejection.ts + +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + +error: Uncaught (in promise) Error: rejection + reject(new Error("rejection")); + ^ + at [WILDCARD]/test/unhandled_rejection.ts:2:10 + at new Promise (<anonymous>) + at [WILDCARD]/test/unhandled_rejection.ts:1:1 diff --git a/cli/tests/testdata/test/unhandled_rejection.ts b/cli/tests/testdata/test/unhandled_rejection.ts new file mode 100644 index 000000000..32f3111ea --- /dev/null +++ b/cli/tests/testdata/test/unhandled_rejection.ts @@ -0,0 +1,3 @@ +new Promise((_resolve, reject) => { + reject(new Error("rejection")); +}); diff --git a/cli/tests/testdata/test/unresolved_promise.out b/cli/tests/testdata/test/unresolved_promise.out new file mode 100644 index 000000000..cd505bcbf --- /dev/null +++ b/cli/tests/testdata/test/unresolved_promise.out @@ -0,0 +1,6 @@ +Check [WILDCARD]/test/unresolved_promise.ts +running 2 tests from [WILDCARD]/test/unresolved_promise.ts +test unresolved promise ... +test result: FAILED. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + +error: Module evaluation is still pending but there are no pending ops or dynamic imports. This situation is often caused by unresolved promise. diff --git a/cli/tests/testdata/test/unresolved_promise.ts b/cli/tests/testdata/test/unresolved_promise.ts new file mode 100644 index 000000000..8f50e907a --- /dev/null +++ b/cli/tests/testdata/test/unresolved_promise.ts @@ -0,0 +1,11 @@ +Deno.test({ + name: "unresolved promise", + fn() { + return new Promise((_resolve, _reject) => {}); + }, +}); + +Deno.test({ + name: "ok", + fn() {}, +}); |
