summaryrefslogtreecommitdiff
path: root/tests/specs/test
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2024-09-16 14:39:58 +0100
committerGitHub <noreply@github.com>2024-09-16 15:39:58 +0200
commit968f441da32ae5fc3783a4f9bcda3d34fa276b4d (patch)
tree9dee28c5203fd326ddc0c60020e97bd1a6a12748 /tests/specs/test
parent8fa92228bb748bdc59e0fe003108dcaea0a18d10 (diff)
test: rewrite some ignored tests to spec tests (#25652)
Ref https://github.com/denoland/deno/issues/25241 Rewritten these tests: - check::package_json_basic - check::package_json_fail_check - check::package_json_with_deno_json - info::package_json_basic - test::package_json_basic - run::package_json_auto_discovered_for_npm_binary - run::package_json_with_deno_json
Diffstat (limited to 'tests/specs/test')
-rw-r--r--tests/specs/test/package_json_basic/__test__.jsonc13
-rw-r--r--tests/specs/test/package_json_basic/install.out3
-rw-r--r--tests/specs/test/package_json_basic/lib.test.ts7
-rw-r--r--tests/specs/test/package_json_basic/lib.ts9
-rw-r--r--tests/specs/test/package_json_basic/package.json5
-rw-r--r--tests/specs/test/package_json_basic/test.out6
-rw-r--r--tests/specs/test/package_json_basic_auto_install/__test__.jsonc9
-rw-r--r--tests/specs/test/package_json_basic_auto_install/deno.json3
-rw-r--r--tests/specs/test/package_json_basic_auto_install/lib.test.ts7
-rw-r--r--tests/specs/test/package_json_basic_auto_install/lib.ts9
-rw-r--r--tests/specs/test/package_json_basic_auto_install/package.json5
-rw-r--r--tests/specs/test/package_json_basic_auto_install/test.out9
12 files changed, 85 insertions, 0 deletions
diff --git a/tests/specs/test/package_json_basic/__test__.jsonc b/tests/specs/test/package_json_basic/__test__.jsonc
new file mode 100644
index 000000000..64e43afa5
--- /dev/null
+++ b/tests/specs/test/package_json_basic/__test__.jsonc
@@ -0,0 +1,13 @@
+{
+ "tempDir": true,
+ "steps": [
+ {
+ "args": "install",
+ "output": "install.out"
+ },
+ {
+ "args": "test",
+ "output": "test.out"
+ }
+ ]
+}
diff --git a/tests/specs/test/package_json_basic/install.out b/tests/specs/test/package_json_basic/install.out
new file mode 100644
index 000000000..b8114c12a
--- /dev/null
+++ b/tests/specs/test/package_json_basic/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/test/package_json_basic/lib.test.ts b/tests/specs/test/package_json_basic/lib.test.ts
new file mode 100644
index 000000000..4e833e1f3
--- /dev/null
+++ b/tests/specs/test/package_json_basic/lib.test.ts
@@ -0,0 +1,7 @@
+import { add } from "./lib.ts";
+
+Deno.test("should add", () => {
+ if (add(1, 2) !== 3) {
+ throw new Error("Fail");
+ }
+});
diff --git a/tests/specs/test/package_json_basic/lib.ts b/tests/specs/test/package_json_basic/lib.ts
new file mode 100644
index 000000000..1deed81f7
--- /dev/null
+++ b/tests/specs/test/package_json_basic/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/test/package_json_basic/package.json b/tests/specs/test/package_json_basic/package.json
new file mode 100644
index 000000000..54ca824d6
--- /dev/null
+++ b/tests/specs/test/package_json_basic/package.json
@@ -0,0 +1,5 @@
+{
+ "dependencies": {
+ "@denotest/esm-basic": "*"
+ }
+}
diff --git a/tests/specs/test/package_json_basic/test.out b/tests/specs/test/package_json_basic/test.out
new file mode 100644
index 000000000..1ff57c150
--- /dev/null
+++ b/tests/specs/test/package_json_basic/test.out
@@ -0,0 +1,6 @@
+Check file://[WILDCARD]/lib.test.ts
+running 1 test from [WILDCARD]lib.test.ts
+should add ... ok ([WILDCARD])
+
+ok | 1 passed | 0 failed ([WILDCARD])
+
diff --git a/tests/specs/test/package_json_basic_auto_install/__test__.jsonc b/tests/specs/test/package_json_basic_auto_install/__test__.jsonc
new file mode 100644
index 000000000..d80f3222a
--- /dev/null
+++ b/tests/specs/test/package_json_basic_auto_install/__test__.jsonc
@@ -0,0 +1,9 @@
+{
+ "tempDir": true,
+ "steps": [
+ {
+ "args": "test",
+ "output": "test.out"
+ }
+ ]
+}
diff --git a/tests/specs/test/package_json_basic_auto_install/deno.json b/tests/specs/test/package_json_basic_auto_install/deno.json
new file mode 100644
index 000000000..fbd70ec48
--- /dev/null
+++ b/tests/specs/test/package_json_basic_auto_install/deno.json
@@ -0,0 +1,3 @@
+{
+ "nodeModulesDir": "auto"
+}
diff --git a/tests/specs/test/package_json_basic_auto_install/lib.test.ts b/tests/specs/test/package_json_basic_auto_install/lib.test.ts
new file mode 100644
index 000000000..4e833e1f3
--- /dev/null
+++ b/tests/specs/test/package_json_basic_auto_install/lib.test.ts
@@ -0,0 +1,7 @@
+import { add } from "./lib.ts";
+
+Deno.test("should add", () => {
+ if (add(1, 2) !== 3) {
+ throw new Error("Fail");
+ }
+});
diff --git a/tests/specs/test/package_json_basic_auto_install/lib.ts b/tests/specs/test/package_json_basic_auto_install/lib.ts
new file mode 100644
index 000000000..1deed81f7
--- /dev/null
+++ b/tests/specs/test/package_json_basic_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/test/package_json_basic_auto_install/package.json b/tests/specs/test/package_json_basic_auto_install/package.json
new file mode 100644
index 000000000..54ca824d6
--- /dev/null
+++ b/tests/specs/test/package_json_basic_auto_install/package.json
@@ -0,0 +1,5 @@
+{
+ "dependencies": {
+ "@denotest/esm-basic": "*"
+ }
+}
diff --git a/tests/specs/test/package_json_basic_auto_install/test.out b/tests/specs/test/package_json_basic_auto_install/test.out
new file mode 100644
index 000000000..2f109ef38
--- /dev/null
+++ b/tests/specs/test/package_json_basic_auto_install/test.out
@@ -0,0 +1,9 @@
+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]/lib.test.ts
+running 1 test from [WILDCARD]lib.test.ts
+should add ... ok ([WILDCARD])
+
+ok | 1 passed | 0 failed ([WILDCARD])
+