summaryrefslogtreecommitdiff
path: root/tests/specs/workspaces
diff options
context:
space:
mode:
Diffstat (limited to 'tests/specs/workspaces')
-rw-r--r--tests/specs/workspaces/patch/__test__.jsonc13
-rw-r--r--tests/specs/workspaces/patch/add/deno.json5
-rw-r--r--tests/specs/workspaces/patch/add/mod.test.ts9
-rw-r--r--tests/specs/workspaces/patch/add/mod.ts4
-rw-r--r--tests/specs/workspaces/patch/test.out10
-rw-r--r--tests/specs/workspaces/patch/workspace/deno.json6
-rw-r--r--tests/specs/workspaces/patch/workspace/my-pkg/deno.json8
-rw-r--r--tests/specs/workspaces/patch/workspace/my-pkg/mod.test.ts7
-rw-r--r--tests/specs/workspaces/patch/workspace/my-pkg/mod.ts1
9 files changed, 63 insertions, 0 deletions
diff --git a/tests/specs/workspaces/patch/__test__.jsonc b/tests/specs/workspaces/patch/__test__.jsonc
new file mode 100644
index 000000000..90a54086e
--- /dev/null
+++ b/tests/specs/workspaces/patch/__test__.jsonc
@@ -0,0 +1,13 @@
+{
+ "cwd": "./workspace",
+ "tests": {
+ "lint": {
+ "args": "lint",
+ "output": "Checked 2 files\n"
+ },
+ "test": {
+ "args": "test",
+ "output": "test.out"
+ }
+ }
+}
diff --git a/tests/specs/workspaces/patch/add/deno.json b/tests/specs/workspaces/patch/add/deno.json
new file mode 100644
index 000000000..05d24d7b5
--- /dev/null
+++ b/tests/specs/workspaces/patch/add/deno.json
@@ -0,0 +1,5 @@
+{
+ "name": "@denotest/add",
+ "version": "1.0.0",
+ "exports": "./mod.ts"
+}
diff --git a/tests/specs/workspaces/patch/add/mod.test.ts b/tests/specs/workspaces/patch/add/mod.test.ts
new file mode 100644
index 000000000..3d3804e07
--- /dev/null
+++ b/tests/specs/workspaces/patch/add/mod.test.ts
@@ -0,0 +1,9 @@
+import { add } from "./mod.ts";
+
+// this test should not be run or linted
+Deno.test("add", () => {
+ let unusedVar = 5; // purposefully causing a lint error to ensure it's not linted
+ if (add(1, 2) !== 3) {
+ throw new Error("fail");
+ }
+});
diff --git a/tests/specs/workspaces/patch/add/mod.ts b/tests/specs/workspaces/patch/add/mod.ts
new file mode 100644
index 000000000..97a779a44
--- /dev/null
+++ b/tests/specs/workspaces/patch/add/mod.ts
@@ -0,0 +1,4 @@
+export function add(a: number, b: number): number {
+ console.log("adding", a, "and", b);
+ return a + b;
+}
diff --git a/tests/specs/workspaces/patch/test.out b/tests/specs/workspaces/patch/test.out
new file mode 100644
index 000000000..c35ac0e45
--- /dev/null
+++ b/tests/specs/workspaces/patch/test.out
@@ -0,0 +1,10 @@
+Check file:///[WILDLINE]/my-pkg/mod.test.ts
+running 1 test from ./my-pkg/mod.test.ts
+add ...
+------- output -------
+adding 1 and 2
+----- output end -----
+add ... ok ([WILDLINE])
+
+ok | 1 passed | 0 failed ([WILDLINE])
+
diff --git a/tests/specs/workspaces/patch/workspace/deno.json b/tests/specs/workspaces/patch/workspace/deno.json
new file mode 100644
index 000000000..510351c44
--- /dev/null
+++ b/tests/specs/workspaces/patch/workspace/deno.json
@@ -0,0 +1,6 @@
+{
+ "workspace": ["./my-pkg"],
+ "patch": [
+ "../add"
+ ]
+}
diff --git a/tests/specs/workspaces/patch/workspace/my-pkg/deno.json b/tests/specs/workspaces/patch/workspace/my-pkg/deno.json
new file mode 100644
index 000000000..8b2e887e7
--- /dev/null
+++ b/tests/specs/workspaces/patch/workspace/my-pkg/deno.json
@@ -0,0 +1,8 @@
+{
+ "name": "@scope/my-pkg",
+ "version": "1.0.0",
+ "exports": "./mod.ts",
+ "imports": {
+ "@denotest/add": "jsr:@denotest/add@1"
+ }
+}
diff --git a/tests/specs/workspaces/patch/workspace/my-pkg/mod.test.ts b/tests/specs/workspaces/patch/workspace/my-pkg/mod.test.ts
new file mode 100644
index 000000000..1c694298c
--- /dev/null
+++ b/tests/specs/workspaces/patch/workspace/my-pkg/mod.test.ts
@@ -0,0 +1,7 @@
+import { add } from "./mod.ts";
+
+Deno.test("add", () => {
+ if (add(1, 2) !== 3) {
+ throw new Error("fail");
+ }
+});
diff --git a/tests/specs/workspaces/patch/workspace/my-pkg/mod.ts b/tests/specs/workspaces/patch/workspace/my-pkg/mod.ts
new file mode 100644
index 000000000..11501ab39
--- /dev/null
+++ b/tests/specs/workspaces/patch/workspace/my-pkg/mod.ts
@@ -0,0 +1 @@
+export { add } from "@denotest/add";