aboutsummaryrefslogtreecommitdiff
path: root/test/js/node/missing-module.test.js
diff options
context:
space:
mode:
authorGravatar Vlad Sirenko <sirenkovladd@gmail.com> 2023-08-01 05:41:41 +0300
committerGravatar GitHub <noreply@github.com> 2023-07-31 19:41:41 -0700
commit7a8f57c4e527f7fc84b85a4757723bb97540ebc3 (patch)
treefdbc43040069373b3af33770e00e47ad53b35dc4 /test/js/node/missing-module.test.js
parent8589ba2f1712d68199fbef14f5a4ba9005df3065 (diff)
downloadbun-7a8f57c4e527f7fc84b85a4757723bb97540ebc3.tar.gz
bun-7a8f57c4e527f7fc84b85a4757723bb97540ebc3.tar.zst
bun-7a8f57c4e527f7fc84b85a4757723bb97540ebc3.zip
throw error if node module does not exist (#3913)
Diffstat (limited to 'test/js/node/missing-module.test.js')
-rw-r--r--test/js/node/missing-module.test.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/js/node/missing-module.test.js b/test/js/node/missing-module.test.js
new file mode 100644
index 000000000..fd772441a
--- /dev/null
+++ b/test/js/node/missing-module.test.js
@@ -0,0 +1,7 @@
+import { expect, test } from "bun:test";
+
+test("not implemented yet module masquerades as undefined and throws an error", () => {
+ const missingModule = "node:missing" + "";
+ expect(() => require(missingModule)).toThrow(/^Cannot find package "node:missing" from "/);
+ expect(() => import(missingModule)).toThrow(/^Cannot find package "node:missing" from "/);
+});