summaryrefslogtreecommitdiff
path: root/cli/tests/testdata
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/testdata')
-rw-r--r--cli/tests/testdata/npm/node_modules_import/main.out2
-rw-r--r--cli/tests/testdata/npm/node_modules_import/main.ts13
-rw-r--r--cli/tests/testdata/npm/node_modules_import/main_check.out11
-rw-r--r--cli/tests/testdata/npm/node_modules_import/package.json5
-rw-r--r--cli/tests/testdata/npm/registry/@denotest/esm-basic/1.0.0/main.d.mts2
-rw-r--r--cli/tests/testdata/npm/registry/@denotest/esm-basic/1.0.0/main.mjs9
-rw-r--r--cli/tests/testdata/npm/registry/@denotest/esm-basic/1.0.0/package.json7
-rw-r--r--cli/tests/testdata/package_json/basic/fail_check.check.out4
-rw-r--r--cli/tests/testdata/package_json/basic/fail_check.ts3
-rw-r--r--cli/tests/testdata/package_json/basic/main.bench.out11
-rw-r--r--cli/tests/testdata/package_json/basic/main.bench.ts7
-rw-r--r--cli/tests/testdata/package_json/basic/main.cache.out2
-rw-r--r--cli/tests/testdata/package_json/basic/main.check.out3
-rw-r--r--cli/tests/testdata/package_json/basic/main.info.out7
-rw-r--r--cli/tests/testdata/package_json/basic/main.test.out9
-rw-r--r--cli/tests/testdata/package_json/basic/main.test.ts7
-rw-r--r--cli/tests/testdata/package_json/basic/main.ts11
-rw-r--r--cli/tests/testdata/package_json/basic/package.json5
18 files changed, 118 insertions, 0 deletions
diff --git a/cli/tests/testdata/npm/node_modules_import/main.out b/cli/tests/testdata/npm/node_modules_import/main.out
new file mode 100644
index 000000000..51993f072
--- /dev/null
+++ b/cli/tests/testdata/npm/node_modules_import/main.out
@@ -0,0 +1,2 @@
+2
+2
diff --git a/cli/tests/testdata/npm/node_modules_import/main.ts b/cli/tests/testdata/npm/node_modules_import/main.ts
new file mode 100644
index 000000000..ed433ed04
--- /dev/null
+++ b/cli/tests/testdata/npm/node_modules_import/main.ts
@@ -0,0 +1,13 @@
+import * as myImport1 from "@denotest/esm-basic";
+import * as myImport2 from "./node_modules/@denotest/esm-basic/main.mjs";
+
+myImport1.setValue(5);
+myImport2.setValue(2);
+
+// these should both give type errors
+const value1: string = myImport1.getValue();
+const value2: string = myImport2.getValue();
+
+// these should both be equal because it should be mutating the same module
+console.log(value1);
+console.log(value2);
diff --git a/cli/tests/testdata/npm/node_modules_import/main_check.out b/cli/tests/testdata/npm/node_modules_import/main_check.out
new file mode 100644
index 000000000..4442a97ba
--- /dev/null
+++ b/cli/tests/testdata/npm/node_modules_import/main_check.out
@@ -0,0 +1,11 @@
+error: TS2322 [ERROR]: Type 'number' is not assignable to type 'string'.
+const value1: string = myImport1.getValue();
+ ~~~~~~
+ at file:///[WILDCARD]/npm/node_modules_import/main.ts:8:7
+
+TS2322 [ERROR]: Type 'number' is not assignable to type 'string'.
+const value2: string = myImport2.getValue();
+ ~~~~~~
+ at file:///[WILDCARD]/npm/node_modules_import/main.ts:9:7
+
+Found 2 errors.
diff --git a/cli/tests/testdata/npm/node_modules_import/package.json b/cli/tests/testdata/npm/node_modules_import/package.json
new file mode 100644
index 000000000..ed77298e0
--- /dev/null
+++ b/cli/tests/testdata/npm/node_modules_import/package.json
@@ -0,0 +1,5 @@
+{
+ "dependencies": {
+ "@denotest/esm-basic": "^1"
+ }
+}
diff --git a/cli/tests/testdata/npm/registry/@denotest/esm-basic/1.0.0/main.d.mts b/cli/tests/testdata/npm/registry/@denotest/esm-basic/1.0.0/main.d.mts
new file mode 100644
index 000000000..fa7814911
--- /dev/null
+++ b/cli/tests/testdata/npm/registry/@denotest/esm-basic/1.0.0/main.d.mts
@@ -0,0 +1,2 @@
+export declare function setValue(val: number): void;
+export declare function getValue(): number;
diff --git a/cli/tests/testdata/npm/registry/@denotest/esm-basic/1.0.0/main.mjs b/cli/tests/testdata/npm/registry/@denotest/esm-basic/1.0.0/main.mjs
new file mode 100644
index 000000000..23df4221c
--- /dev/null
+++ b/cli/tests/testdata/npm/registry/@denotest/esm-basic/1.0.0/main.mjs
@@ -0,0 +1,9 @@
+let value = 0;
+
+export function setValue(newValue) {
+ value = newValue;
+}
+
+export function getValue() {
+ return value;
+}
diff --git a/cli/tests/testdata/npm/registry/@denotest/esm-basic/1.0.0/package.json b/cli/tests/testdata/npm/registry/@denotest/esm-basic/1.0.0/package.json
new file mode 100644
index 000000000..757ac2db9
--- /dev/null
+++ b/cli/tests/testdata/npm/registry/@denotest/esm-basic/1.0.0/package.json
@@ -0,0 +1,7 @@
+{
+ "name": "@denotest/esm-basic",
+ "version": "1.0.0",
+ "type": "module",
+ "main": "main.mjs",
+ "types": "main.d.mts"
+}
diff --git a/cli/tests/testdata/package_json/basic/fail_check.check.out b/cli/tests/testdata/package_json/basic/fail_check.check.out
new file mode 100644
index 000000000..03997a051
--- /dev/null
+++ b/cli/tests/testdata/package_json/basic/fail_check.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/cli/tests/testdata/package_json/basic/fail_check.ts b/cli/tests/testdata/package_json/basic/fail_check.ts
new file mode 100644
index 000000000..ce849d92f
--- /dev/null
+++ b/cli/tests/testdata/package_json/basic/fail_check.ts
@@ -0,0 +1,3 @@
+import { getValue } from "./main.ts";
+
+const _test: string = getValue();
diff --git a/cli/tests/testdata/package_json/basic/main.bench.out b/cli/tests/testdata/package_json/basic/main.bench.out
new file mode 100644
index 000000000..db0db2114
--- /dev/null
+++ b/cli/tests/testdata/package_json/basic/main.bench.out
@@ -0,0 +1,11 @@
+Download http://localhost:4545/npm/registry/@denotest/esm-basic
+Download http://localhost:4545/npm/registry/@denotest/esm-basic/1.0.0.tgz
+Check file:///[WILDCARD]/main.bench.ts
+0
+cpu: [WILDCARD]
+runtime: [WILDCARD]
+
+file:///[WILDCARD]/main.bench.ts
+[WILDCARD]
+-------------------------------------------------- -----------------------------
+should add [WILDCARD]
diff --git a/cli/tests/testdata/package_json/basic/main.bench.ts b/cli/tests/testdata/package_json/basic/main.bench.ts
new file mode 100644
index 000000000..51bfc7bba
--- /dev/null
+++ b/cli/tests/testdata/package_json/basic/main.bench.ts
@@ -0,0 +1,7 @@
+import { add } from "./main.ts";
+
+Deno.bench("should add", () => {
+ if (add(1, 2) !== 3) {
+ throw new Error("Fail");
+ }
+});
diff --git a/cli/tests/testdata/package_json/basic/main.cache.out b/cli/tests/testdata/package_json/basic/main.cache.out
new file mode 100644
index 000000000..4be62e9eb
--- /dev/null
+++ b/cli/tests/testdata/package_json/basic/main.cache.out
@@ -0,0 +1,2 @@
+Download http://localhost:4545/npm/registry/@denotest/esm-basic
+Download http://localhost:4545/npm/registry/@denotest/esm-basic/1.0.0.tgz
diff --git a/cli/tests/testdata/package_json/basic/main.check.out b/cli/tests/testdata/package_json/basic/main.check.out
new file mode 100644
index 000000000..09c377314
--- /dev/null
+++ b/cli/tests/testdata/package_json/basic/main.check.out
@@ -0,0 +1,3 @@
+Download http://localhost:4545/npm/registry/@denotest/esm-basic
+Download http://localhost:4545/npm/registry/@denotest/esm-basic/1.0.0.tgz
+Check file://[WILDCARD]/main.ts
diff --git a/cli/tests/testdata/package_json/basic/main.info.out b/cli/tests/testdata/package_json/basic/main.info.out
new file mode 100644
index 000000000..48c10a0ba
--- /dev/null
+++ b/cli/tests/testdata/package_json/basic/main.info.out
@@ -0,0 +1,7 @@
+local: [WILDCARD]main.ts
+type: TypeScript
+dependencies: 1 unique
+size: [WILDCARD]
+
+file://[WILDCARD]/package_json/basic/main.ts ([WILDCARD])
+└── npm:@denotest/esm-basic@1.0.0 ([WILDCARD])
diff --git a/cli/tests/testdata/package_json/basic/main.test.out b/cli/tests/testdata/package_json/basic/main.test.out
new file mode 100644
index 000000000..b04420b3b
--- /dev/null
+++ b/cli/tests/testdata/package_json/basic/main.test.out
@@ -0,0 +1,9 @@
+Download http://localhost:4545/npm/registry/@denotest/esm-basic
+Download http://localhost:4545/npm/registry/@denotest/esm-basic/1.0.0.tgz
+Check file://[WILDCARD]/main.test.ts
+0
+running 1 test from [WILDCARD]main.test.ts
+should add ... ok ([WILDCARD])
+
+ok | 1 passed | 0 failed ([WILDCARD])
+
diff --git a/cli/tests/testdata/package_json/basic/main.test.ts b/cli/tests/testdata/package_json/basic/main.test.ts
new file mode 100644
index 000000000..298ce1f5b
--- /dev/null
+++ b/cli/tests/testdata/package_json/basic/main.test.ts
@@ -0,0 +1,7 @@
+import { add } from "./main.ts";
+
+Deno.test("should add", () => {
+ if (add(1, 2) !== 3) {
+ throw new Error("Fail");
+ }
+});
diff --git a/cli/tests/testdata/package_json/basic/main.ts b/cli/tests/testdata/package_json/basic/main.ts
new file mode 100644
index 000000000..5911fe32d
--- /dev/null
+++ b/cli/tests/testdata/package_json/basic/main.ts
@@ -0,0 +1,11 @@
+import * as test from "@denotest/esm-basic";
+
+console.log(test.getValue());
+
+export function add(a: number, b: number) {
+ return a + b;
+}
+
+export function getValue() {
+ return test.getValue();
+}
diff --git a/cli/tests/testdata/package_json/basic/package.json b/cli/tests/testdata/package_json/basic/package.json
new file mode 100644
index 000000000..54ca824d6
--- /dev/null
+++ b/cli/tests/testdata/package_json/basic/package.json
@@ -0,0 +1,5 @@
+{
+ "dependencies": {
+ "@denotest/esm-basic": "*"
+ }
+}