summaryrefslogtreecommitdiff
path: root/tests/registry
diff options
context:
space:
mode:
authorNathan Whitaker <17734409+nathanwhit@users.noreply.github.com>2024-10-12 12:14:32 -0700
committerGitHub <noreply@github.com>2024-10-12 12:14:32 -0700
commit7a990d9d42b633ca70eca235df0f9ba09f876720 (patch)
tree8c7db663923f478b77cea37a8cae77d59eb27479 /tests/registry
parent8b2c6fc2d22f0a62ceefa71ff739f81796142699 (diff)
feat(npm): support `--allow-scripts` on `deno run` (and `deno add`, `deno test`, etc) (#26075)
Fixes https://github.com/denoland/deno/issues/25533. Fixes https://github.com/denoland/deno/issues/25396. Previously we only supported it on `deno install` and `deno cache`, which is annoying if you're using `nodeModulesDir: auto`. Also changes from printing output of lifecycle scripts directly to capturing the output and only printing it on error.
Diffstat (limited to 'tests/registry')
-rw-r--r--tests/registry/npm/@denotest/better-say-hello/1.0.0/say-hello.js2
-rw-r--r--tests/registry/npm/@denotest/node-lifecycle-scripts/1.0.0/index.js4
-rw-r--r--tests/registry/npm/@denotest/node-lifecycle-scripts/1.0.0/package.json1
-rw-r--r--tests/registry/npm/@denotest/say-hello/1.0.0/say-hello.js5
4 files changed, 7 insertions, 5 deletions
diff --git a/tests/registry/npm/@denotest/better-say-hello/1.0.0/say-hello.js b/tests/registry/npm/@denotest/better-say-hello/1.0.0/say-hello.js
index 0b8d63cf4..5243d4902 100644
--- a/tests/registry/npm/@denotest/better-say-hello/1.0.0/say-hello.js
+++ b/tests/registry/npm/@denotest/better-say-hello/1.0.0/say-hello.js
@@ -1,2 +1,2 @@
import { sayBetterHello } from "./index.js";
-sayBetterHello(); \ No newline at end of file
+sayBetterHello();
diff --git a/tests/registry/npm/@denotest/node-lifecycle-scripts/1.0.0/index.js b/tests/registry/npm/@denotest/node-lifecycle-scripts/1.0.0/index.js
index 4eb9b107a..242fe92f5 100644
--- a/tests/registry/npm/@denotest/node-lifecycle-scripts/1.0.0/index.js
+++ b/tests/registry/npm/@denotest/node-lifecycle-scripts/1.0.0/index.js
@@ -1,5 +1,3 @@
-modules.export = {
+module.exports = {
value: 42
};
-
-console.log('index.js', modules.export.value); \ No newline at end of file
diff --git a/tests/registry/npm/@denotest/node-lifecycle-scripts/1.0.0/package.json b/tests/registry/npm/@denotest/node-lifecycle-scripts/1.0.0/package.json
index 3c6fa005f..085ab6414 100644
--- a/tests/registry/npm/@denotest/node-lifecycle-scripts/1.0.0/package.json
+++ b/tests/registry/npm/@denotest/node-lifecycle-scripts/1.0.0/package.json
@@ -6,6 +6,7 @@
"install": "echo install && cli-esm 'hello from install script'",
"postinstall": "echo postinstall && npx cowsay postinstall"
},
+ "exports": "./index.js",
"dependencies": {
"@denotest/bin": "1.0.0"
}
diff --git a/tests/registry/npm/@denotest/say-hello/1.0.0/say-hello.js b/tests/registry/npm/@denotest/say-hello/1.0.0/say-hello.js
index 8751b8e47..66d02cde5 100644
--- a/tests/registry/npm/@denotest/say-hello/1.0.0/say-hello.js
+++ b/tests/registry/npm/@denotest/say-hello/1.0.0/say-hello.js
@@ -1,2 +1,5 @@
import { sayHello } from "./index.js";
-console.log(sayHello()); \ No newline at end of file
+console.log(sayHello());
+import path from "node:path";
+import fs from "node:fs";
+fs.writeSync(fs.openSync(path.join(process.env.INIT_CWD, "say-hello-output.txt"), "w"), sayHello());