summaryrefslogtreecommitdiff
path: root/js/error_stack_test.ts
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2019-10-04 20:28:51 -0400
committerGitHub <noreply@github.com>2019-10-04 20:28:51 -0400
commitb81e5db17aa8b3088d6034ddf86b79c69410f012 (patch)
tree579e4c23d60d1b0d038156bc28a04f74ea87b2f0 /js/error_stack_test.ts
parent9049213867d30f7df090a83b6baf3e0717a4d2d2 (diff)
Merge deno_cli_snapshots into deno_cli (#3064)
Diffstat (limited to 'js/error_stack_test.ts')
-rw-r--r--js/error_stack_test.ts108
1 files changed, 0 insertions, 108 deletions
diff --git a/js/error_stack_test.ts b/js/error_stack_test.ts
deleted file mode 100644
index 4c7edb2fd..000000000
--- a/js/error_stack_test.ts
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { test, assert } from "./test_util.ts";
-
-// eslint-disable-next-line @typescript-eslint/no-explicit-any
-const { setPrepareStackTrace } = Deno as any;
-
-interface CallSite {
- getThis(): unknown;
- getTypeName(): string;
- getFunction(): Function;
- getFunctionName(): string;
- getMethodName(): string;
- getFileName(): string;
- getLineNumber(): number | null;
- getColumnNumber(): number | null;
- getEvalOrigin(): string | null;
- isToplevel(): boolean;
- isEval(): boolean;
- isNative(): boolean;
- isConstructor(): boolean;
- isAsync(): boolean;
- isPromiseAll(): boolean;
- getPromiseIndex(): number | null;
-}
-
-function getMockCallSite(
- filename: string,
- line: number | null,
- column: number | null
-): CallSite {
- return {
- getThis(): unknown {
- return undefined;
- },
- getTypeName(): string {
- return "";
- },
- getFunction(): Function {
- return (): void => {};
- },
- getFunctionName(): string {
- return "";
- },
- getMethodName(): string {
- return "";
- },
- getFileName(): string {
- return filename;
- },
- getLineNumber(): number | null {
- return line;
- },
- getColumnNumber(): number | null {
- return column;
- },
- getEvalOrigin(): null {
- return null;
- },
- isToplevel(): false {
- return false;
- },
- isEval(): false {
- return false;
- },
- isNative(): false {
- return false;
- },
- isConstructor(): false {
- return false;
- },
- isAsync(): false {
- return false;
- },
- isPromiseAll(): false {
- return false;
- },
- getPromiseIndex(): null {
- return null;
- }
- };
-}
-
-test(function prepareStackTrace(): void {
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- const MockError = {} as any;
- setPrepareStackTrace(MockError);
- assert(typeof MockError.prepareStackTrace === "function");
- const prepareStackTrace: (
- error: Error,
- structuredStackTrace: CallSite[]
- ) => string = MockError.prepareStackTrace;
- const result = prepareStackTrace(new Error("foo"), [
- getMockCallSite("CLI_SNAPSHOT.js", 23, 0)
- ]);
- assert(result.startsWith("Error: foo\n"));
- assert(result.includes(".ts:"), "should remap to something in 'js/'");
-});
-
-test(function applySourceMap(): void {
- const result = Deno.applySourceMap({
- filename: "CLI_SNAPSHOT.js",
- line: 23,
- column: 0
- });
- assert(result.filename.endsWith(".ts"));
- assert(result.line != null);
- assert(result.column != null);
-});