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:
parent
3fe4be07ca
commit
be8f49b332
3 changed files with 19 additions and 1 deletions
|
@ -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";
|
||||
|
|
|
@ -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
17
js/v8_source_maps_test.ts
Normal 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");
|
||||
});
|
Loading…
Reference in a new issue