summaryrefslogtreecommitdiff
path: root/std/node/module_test.ts
diff options
context:
space:
mode:
authorNikolai Vavilov <vvnicholas@gmail.com>2020-03-19 16:42:07 +0200
committerGitHub <noreply@github.com>2020-03-19 10:42:07 -0400
commit8c1c929034d46101b6a51ec5cf5e2f307ed0c271 (patch)
treee86383fb34829d991121fc3203595d7e77327779 /std/node/module_test.ts
parent74c37e759ac03267975309c1425223289ebc925f (diff)
fix: stack traces for modules imported via std/node's require (#4035)
Diffstat (limited to 'std/node/module_test.ts')
-rw-r--r--std/node/module_test.ts11
1 files changed, 10 insertions, 1 deletions
diff --git a/std/node/module_test.ts b/std/node/module_test.ts
index 6de5bd66e..be36a8b6d 100644
--- a/std/node/module_test.ts
+++ b/std/node/module_test.ts
@@ -1,5 +1,5 @@
const { test } = Deno;
-import { assertEquals, assert } from "../testing/asserts.ts";
+import { assertEquals, assert, assertStrContains } from "../testing/asserts.ts";
import { createRequire } from "./module.ts";
// TS compiler would try to resolve if function named "require"
@@ -48,3 +48,12 @@ test(function requireNodeOs() {
assert(os.arch);
assert(typeof os.arch() == "string");
});
+
+test(function requireStack() {
+ const { hello } = require_("./tests/cjs/cjs_throw");
+ try {
+ hello();
+ } catch (e) {
+ assertStrContains(e.stack, "/tests/cjs/cjs_throw.js");
+ }
+});