1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-25 15:29:32 -05:00

Add toString for CallSite of eval origin (#809)

This commit is contained in:
Kevin (Kun) "Kassimo" Qian 2018-09-24 15:42:09 -04:00 committed by Ryan Dahl
parent 3fe4be07ca
commit be8f49b332
3 changed files with 19 additions and 1 deletions

View file

@ -17,5 +17,5 @@ import "./symlink_test.ts";
import "./platform_test.ts";
import "./text_encoding_test.ts";
import "./trace_test.ts";
import "./v8_source_maps_test.ts";
import "../website/app_test.js";

View file

@ -88,6 +88,7 @@ export function wrapCallSite(frame: CallSite): CallSite {
origin = mapEvalOrigin(origin);
frame = cloneCallSite(frame);
frame.getEvalOrigin = () => origin;
frame.toString = () => CallSiteToString(frame);
return frame;
}

17
js/v8_source_maps_test.ts Normal file
View file

@ -0,0 +1,17 @@
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
import { test, assert, assertEqual } from "./test_util.ts";
// This test demonstrates a bug:
// https://github.com/denoland/deno/issues/808
test(function evalErrorFormatted() {
let err;
try {
eval("boom");
} catch (e) {
err = e;
}
assert(!!err);
// tslint:disable-next-line:no-unused-expression
err.stack; // This would crash if err.stack is malformed
assertEqual(err.name, "ReferenceError");
});