summaryrefslogtreecommitdiff
path: root/tests/specs/npm/lossy_utf8_package_json
diff options
context:
space:
mode:
authorLuca Casonato <hello@lcas.dev>2024-06-08 18:36:13 +0200
committerGitHub <noreply@github.com>2024-06-08 18:36:13 +0200
commitc1f23c578881b85ae79b524a60160d8f4fb7151b (patch)
treec6c945fb4b42cd4ac6fae7135c7ad1039630a34e /tests/specs/npm/lossy_utf8_package_json
parent22d34f7012c48a25435b38c0c306085c614bbea7 (diff)
fix(ext/node): lossy UTF-8 read node_modules files (#24140)
Previously various reads of files in `node_modules` would error on invalid UTF-8. These were cases involving: - reading package.json from Rust - reading package.json from JS - reading CommonJS files from JS - reading CommonJS files from Rust (for ESM translation) - reading ESM files from Rust
Diffstat (limited to 'tests/specs/npm/lossy_utf8_package_json')
-rw-r--r--tests/specs/npm/lossy_utf8_package_json/__test__.jsonc5
-rw-r--r--tests/specs/npm/lossy_utf8_package_json/main.mjs3
-rw-r--r--tests/specs/npm/lossy_utf8_package_json/main.out3
3 files changed, 11 insertions, 0 deletions
diff --git a/tests/specs/npm/lossy_utf8_package_json/__test__.jsonc b/tests/specs/npm/lossy_utf8_package_json/__test__.jsonc
new file mode 100644
index 000000000..1ee7d2d6c
--- /dev/null
+++ b/tests/specs/npm/lossy_utf8_package_json/__test__.jsonc
@@ -0,0 +1,5 @@
+{
+ "args": "run main.mjs",
+ "output": "main.out",
+ "exitCode": 0
+}
diff --git a/tests/specs/npm/lossy_utf8_package_json/main.mjs b/tests/specs/npm/lossy_utf8_package_json/main.mjs
new file mode 100644
index 000000000..9a63eb604
--- /dev/null
+++ b/tests/specs/npm/lossy_utf8_package_json/main.mjs
@@ -0,0 +1,3 @@
+import mod from "npm:@denotest/lossy-utf8-package-json@1.0.0";
+
+console.log(mod);
diff --git a/tests/specs/npm/lossy_utf8_package_json/main.out b/tests/specs/npm/lossy_utf8_package_json/main.out
new file mode 100644
index 000000000..99aa5ab61
--- /dev/null
+++ b/tests/specs/npm/lossy_utf8_package_json/main.out
@@ -0,0 +1,3 @@
+Download http://localhost:4260/@denotest/lossy-utf8-package-json
+Download http://localhost:4260/@denotest/lossy-utf8-package-json/1.0.0.tgz
+hello