diff options
Diffstat (limited to 'tests/specs/check')
25 files changed, 155 insertions, 0 deletions
diff --git a/tests/specs/check/package_json/__test__.jsonc b/tests/specs/check/package_json/__test__.jsonc new file mode 100644 index 000000000..29a964b9f --- /dev/null +++ b/tests/specs/check/package_json/__test__.jsonc @@ -0,0 +1,13 @@ +{ + "tempDir": true, + "steps": [ + { + "args": "install", + "output": "install.out" + }, + { + "args": "check main.ts", + "output": "check.out" + } + ] +} diff --git a/tests/specs/check/package_json/check.out b/tests/specs/check/package_json/check.out new file mode 100644 index 000000000..bb9406725 --- /dev/null +++ b/tests/specs/check/package_json/check.out @@ -0,0 +1 @@ +Check file://[WILDCARD]/main.ts diff --git a/tests/specs/check/package_json/install.out b/tests/specs/check/package_json/install.out new file mode 100644 index 000000000..b8114c12a --- /dev/null +++ b/tests/specs/check/package_json/install.out @@ -0,0 +1,3 @@ +Download http://localhost:4260/@denotest/esm-basic +Download http://localhost:4260/@denotest/esm-basic/1.0.0.tgz +Initialize @denotest/esm-basic@1.0.0 diff --git a/tests/specs/check/package_json/lib.ts b/tests/specs/check/package_json/lib.ts new file mode 100644 index 000000000..1deed81f7 --- /dev/null +++ b/tests/specs/check/package_json/lib.ts @@ -0,0 +1,9 @@ +import * as test from "@denotest/esm-basic"; + +export function add(a: number, b: number) { + return a + b; +} + +export function getValue() { + return test.getValue(); +} diff --git a/tests/specs/check/package_json/main.ts b/tests/specs/check/package_json/main.ts new file mode 100644 index 000000000..e241f3002 --- /dev/null +++ b/tests/specs/check/package_json/main.ts @@ -0,0 +1,3 @@ +import { getValue } from "./lib.ts"; + +console.log(getValue()); diff --git a/tests/specs/check/package_json/package.json b/tests/specs/check/package_json/package.json new file mode 100644 index 000000000..54ca824d6 --- /dev/null +++ b/tests/specs/check/package_json/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "@denotest/esm-basic": "*" + } +} diff --git a/tests/specs/check/package_json_auto_install/__test__.jsonc b/tests/specs/check/package_json_auto_install/__test__.jsonc new file mode 100644 index 000000000..3fa33cdb7 --- /dev/null +++ b/tests/specs/check/package_json_auto_install/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "tempDir": true, + "steps": [ + { + "args": "check main.ts", + "output": "check.out" + } + ] +} diff --git a/tests/specs/check/package_json_auto_install/check.out b/tests/specs/check/package_json_auto_install/check.out new file mode 100644 index 000000000..db9bd198c --- /dev/null +++ b/tests/specs/check/package_json_auto_install/check.out @@ -0,0 +1,4 @@ +Download http://localhost:4260/@denotest/esm-basic +Download http://localhost:4260/@denotest/esm-basic/1.0.0.tgz +Initialize @denotest/esm-basic@1.0.0 +Check file://[WILDCARD]/main.ts diff --git a/tests/specs/check/package_json_auto_install/deno.json b/tests/specs/check/package_json_auto_install/deno.json new file mode 100644 index 000000000..fbd70ec48 --- /dev/null +++ b/tests/specs/check/package_json_auto_install/deno.json @@ -0,0 +1,3 @@ +{ + "nodeModulesDir": "auto" +} diff --git a/tests/specs/check/package_json_auto_install/lib.ts b/tests/specs/check/package_json_auto_install/lib.ts new file mode 100644 index 000000000..1deed81f7 --- /dev/null +++ b/tests/specs/check/package_json_auto_install/lib.ts @@ -0,0 +1,9 @@ +import * as test from "@denotest/esm-basic"; + +export function add(a: number, b: number) { + return a + b; +} + +export function getValue() { + return test.getValue(); +} diff --git a/tests/specs/check/package_json_auto_install/main.ts b/tests/specs/check/package_json_auto_install/main.ts new file mode 100644 index 000000000..e241f3002 --- /dev/null +++ b/tests/specs/check/package_json_auto_install/main.ts @@ -0,0 +1,3 @@ +import { getValue } from "./lib.ts"; + +console.log(getValue()); diff --git a/tests/specs/check/package_json_auto_install/package.json b/tests/specs/check/package_json_auto_install/package.json new file mode 100644 index 000000000..54ca824d6 --- /dev/null +++ b/tests/specs/check/package_json_auto_install/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "@denotest/esm-basic": "*" + } +} diff --git a/tests/specs/check/package_json_fail_check/__test__.jsonc b/tests/specs/check/package_json_fail_check/__test__.jsonc new file mode 100644 index 000000000..e5b4a4db0 --- /dev/null +++ b/tests/specs/check/package_json_fail_check/__test__.jsonc @@ -0,0 +1,14 @@ +{ + "tempDir": true, + "steps": [ + { + "args": "install", + "output": "install.out" + }, + { + "args": "check --quiet fail_check.ts", + "output": "fail_check.out", + "exitCode": 1 + } + ] +} diff --git a/tests/specs/check/package_json_fail_check/fail_check.out b/tests/specs/check/package_json_fail_check/fail_check.out new file mode 100644 index 000000000..03997a051 --- /dev/null +++ b/tests/specs/check/package_json_fail_check/fail_check.out @@ -0,0 +1,4 @@ +error: TS2322 [ERROR]: Type 'number' is not assignable to type 'string'. +const _test: string = getValue(); + ~~~~~ + at file:///[WILDCARD]/fail_check.ts:3:7 diff --git a/tests/specs/check/package_json_fail_check/fail_check.ts b/tests/specs/check/package_json_fail_check/fail_check.ts new file mode 100644 index 000000000..cef10763d --- /dev/null +++ b/tests/specs/check/package_json_fail_check/fail_check.ts @@ -0,0 +1,3 @@ +import { getValue } from "./lib.ts"; + +const _test: string = getValue(); diff --git a/tests/specs/check/package_json_fail_check/install.out b/tests/specs/check/package_json_fail_check/install.out new file mode 100644 index 000000000..b8114c12a --- /dev/null +++ b/tests/specs/check/package_json_fail_check/install.out @@ -0,0 +1,3 @@ +Download http://localhost:4260/@denotest/esm-basic +Download http://localhost:4260/@denotest/esm-basic/1.0.0.tgz +Initialize @denotest/esm-basic@1.0.0 diff --git a/tests/specs/check/package_json_fail_check/lib.ts b/tests/specs/check/package_json_fail_check/lib.ts new file mode 100644 index 000000000..1deed81f7 --- /dev/null +++ b/tests/specs/check/package_json_fail_check/lib.ts @@ -0,0 +1,9 @@ +import * as test from "@denotest/esm-basic"; + +export function add(a: number, b: number) { + return a + b; +} + +export function getValue() { + return test.getValue(); +} diff --git a/tests/specs/check/package_json_fail_check/package.json b/tests/specs/check/package_json_fail_check/package.json new file mode 100644 index 000000000..54ca824d6 --- /dev/null +++ b/tests/specs/check/package_json_fail_check/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "@denotest/esm-basic": "*" + } +} diff --git a/tests/specs/check/package_json_with_deno_json/__test__.jsonc b/tests/specs/check/package_json_with_deno_json/__test__.jsonc new file mode 100644 index 000000000..13752ebee --- /dev/null +++ b/tests/specs/check/package_json_with_deno_json/__test__.jsonc @@ -0,0 +1,14 @@ +{ + "tempDir": true, + "steps": [ + { + "args": "install", + "output": "install.out" + }, + { + "args": "check --quiet main.ts", + "output": "check.out", + "exitCode": 1 + } + ] +} diff --git a/tests/specs/check/package_json_with_deno_json/check.out b/tests/specs/check/package_json_with_deno_json/check.out new file mode 100644 index 000000000..53b6869c0 --- /dev/null +++ b/tests/specs/check/package_json_with_deno_json/check.out @@ -0,0 +1,11 @@ +error: TS2322 [ERROR]: Type 'number' is not assignable to type 'string'. +const _strValue1: string = NUMBER_VALUE; + ~~~~~~~~~~ + at file:///[WILDCARD]/main.ts:8:7 + +TS2322 [ERROR]: Type 'number' is not assignable to type 'string'. +const _strValue2: string = test.getValue(); + ~~~~~~~~~~ + at file:///[WILDCARD]/main.ts:9:7 + +Found 2 errors. diff --git a/tests/specs/check/package_json_with_deno_json/deno.json b/tests/specs/check/package_json_with_deno_json/deno.json new file mode 100644 index 000000000..8a89da280 --- /dev/null +++ b/tests/specs/check/package_json_with_deno_json/deno.json @@ -0,0 +1,5 @@ +{ + "imports": { + "other": "./other.ts" + } +} diff --git a/tests/specs/check/package_json_with_deno_json/install.out b/tests/specs/check/package_json_with_deno_json/install.out new file mode 100644 index 000000000..b8114c12a --- /dev/null +++ b/tests/specs/check/package_json_with_deno_json/install.out @@ -0,0 +1,3 @@ +Download http://localhost:4260/@denotest/esm-basic +Download http://localhost:4260/@denotest/esm-basic/1.0.0.tgz +Initialize @denotest/esm-basic@1.0.0 diff --git a/tests/specs/check/package_json_with_deno_json/main.ts b/tests/specs/check/package_json_with_deno_json/main.ts new file mode 100644 index 000000000..7768ff3fc --- /dev/null +++ b/tests/specs/check/package_json_with_deno_json/main.ts @@ -0,0 +1,9 @@ +import { NUMBER_VALUE } from "other"; +import * as test from "@denotest/esm-basic"; + +test.setValue(2); +console.log(test.getValue()); + +// these should cause type errors +const _strValue1: string = NUMBER_VALUE; +const _strValue2: string = test.getValue(); diff --git a/tests/specs/check/package_json_with_deno_json/other.ts b/tests/specs/check/package_json_with_deno_json/other.ts new file mode 100644 index 000000000..997d84adf --- /dev/null +++ b/tests/specs/check/package_json_with_deno_json/other.ts @@ -0,0 +1,3 @@ +console.log(1); + +export const NUMBER_VALUE = 1; diff --git a/tests/specs/check/package_json_with_deno_json/package.json b/tests/specs/check/package_json_with_deno_json/package.json new file mode 100644 index 000000000..54ca824d6 --- /dev/null +++ b/tests/specs/check/package_json_with_deno_json/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "@denotest/esm-basic": "*" + } +} |
