summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/registry/npm/@denotest/bin/1.0.0/cli.mjs2
-rw-r--r--tests/specs/task/bin_package/__test__.jsonc44
-rw-r--r--tests/specs/task/bin_package/already-set-up.out9
-rw-r--r--tests/specs/task/bin_package/deno.json3
-rw-r--r--tests/specs/task/bin_package/npm-run.out6
-rw-r--r--tests/specs/task/bin_package/package.json9
-rw-r--r--tests/specs/task/bin_package/task.out6
7 files changed, 79 insertions, 0 deletions
diff --git a/tests/registry/npm/@denotest/bin/1.0.0/cli.mjs b/tests/registry/npm/@denotest/bin/1.0.0/cli.mjs
index 0ae8e9190..7f6d1793a 100644
--- a/tests/registry/npm/@denotest/bin/1.0.0/cli.mjs
+++ b/tests/registry/npm/@denotest/bin/1.0.0/cli.mjs
@@ -1,3 +1,5 @@
+#!/usr/bin/env -S node
+
import process from "node:process";
for (const arg of process.argv.slice(2)) {
diff --git a/tests/specs/task/bin_package/__test__.jsonc b/tests/specs/task/bin_package/__test__.jsonc
new file mode 100644
index 000000000..19bad633e
--- /dev/null
+++ b/tests/specs/task/bin_package/__test__.jsonc
@@ -0,0 +1,44 @@
+{
+ "tests": {
+ "sets_up_bin_dir": {
+ "tempDir": true,
+ "steps": [
+ // {"commandName": "npm", "args": "install", "output": "\nadded 1 package in [WILDCARD]\n"},
+ {
+ "args": "task sayhi",
+ "output": "task.out"
+ },
+ {
+ "if": "unix",
+ "commandName": "./node_modules/.bin/cli-esm",
+ "args": "hi hello",
+ "output": "hi\nhello\n"
+ },
+ {
+ "if": "windows",
+ "commandName": "./node_modules/.bin/cli-esm.cmd",
+ "args": "hi hello",
+ "output": "hi\nhello\n"
+ },
+ {
+ "commandName": "npm",
+ "args": "run sayhi",
+ "output": "npm-run.out"
+ }
+ ]
+ },
+ "warns_if_already_setup": {
+ "tempDir": true,
+ "steps": [{
+ "if": "unix",
+ "commandName": "npm",
+ "args": "install",
+ "output": "\nadded 1 package in [WILDCARD]\n"
+ }, {
+ "if": "unix",
+ "args": "task sayhi",
+ "output": "already-set-up.out"
+ }]
+ }
+ }
+}
diff --git a/tests/specs/task/bin_package/already-set-up.out b/tests/specs/task/bin_package/already-set-up.out
new file mode 100644
index 000000000..336459daa
--- /dev/null
+++ b/tests/specs/task/bin_package/already-set-up.out
@@ -0,0 +1,9 @@
+Download http://localhost:4260/@denotest/bin
+Download http://localhost:4260/@denotest/bin/1.0.0.tgz
+Initialize @denotest/bin@1.0.0
+Warning Trying to set up [WILDCARD] bin for [WILDCARD], but an entry pointing to [WILDCARD] already exists. Skipping...
+Warning Trying to set up [WILDCARD] bin for [WILDCARD] but an entry pointing to [WILDCARD] already exists. Skipping...
+Warning Trying to set up [WILDCARD] bin for [WILDCARD], but an entry pointing to [WILDCARD] already exists. Skipping...
+Task sayhi cli-esm hi hello
+hi
+hello
diff --git a/tests/specs/task/bin_package/deno.json b/tests/specs/task/bin_package/deno.json
new file mode 100644
index 000000000..176354f98
--- /dev/null
+++ b/tests/specs/task/bin_package/deno.json
@@ -0,0 +1,3 @@
+{
+ "nodeModulesDir": true
+}
diff --git a/tests/specs/task/bin_package/npm-run.out b/tests/specs/task/bin_package/npm-run.out
new file mode 100644
index 000000000..0c636787a
--- /dev/null
+++ b/tests/specs/task/bin_package/npm-run.out
@@ -0,0 +1,6 @@
+
+> sayhi
+> cli-esm hi hello
+
+hi
+hello
diff --git a/tests/specs/task/bin_package/package.json b/tests/specs/task/bin_package/package.json
new file mode 100644
index 000000000..c0a34548f
--- /dev/null
+++ b/tests/specs/task/bin_package/package.json
@@ -0,0 +1,9 @@
+{
+ "name": "bin_package",
+ "devDependencies": {
+ "@denotest/bin": "1.0.0"
+ },
+ "scripts": {
+ "sayhi": "cli-esm hi hello"
+ }
+}
diff --git a/tests/specs/task/bin_package/task.out b/tests/specs/task/bin_package/task.out
new file mode 100644
index 000000000..69b4f7508
--- /dev/null
+++ b/tests/specs/task/bin_package/task.out
@@ -0,0 +1,6 @@
+Download http://localhost:4260/@denotest/bin
+Download http://localhost:4260/@denotest/bin/1.0.0.tgz
+Initialize @denotest/bin@1.0.0
+Task sayhi cli-esm hi hello
+hi
+hello