Skip to content

Commit

Permalink
test: use correct types in source-map tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DudaGod committed May 23, 2024
1 parent c2c3dc3 commit baf74bb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test/src/error-snippets/source-maps.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sinon, { type SinonStub } from "sinon";
import { SourceMapConsumer, type BasicSourceMapConsumer } from "source-map";
import { SourceMapConsumer, type BasicSourceMapConsumer, type NullableMappedPosition } from "source-map";
import { extractSourceMaps, resolveLocationWithSourceMap } from "./../../../src/error-snippets/source-maps";
import type { SufficientStackFrame, ResolvedFrame } from "../../../src/error-snippets/types";

Expand Down Expand Up @@ -67,7 +67,7 @@ describe("error-snippets/source-maps", () => {
sourcesContent: ["content"],
}),
)) as BasicSourceMapConsumer;
sandbox.stub(sourceMaps, "originalPositionFor").returns({ source: "file1" });
sandbox.stub(sourceMaps, "originalPositionFor").returns({ source: "file1" } as NullableMappedPosition);
const stackFrame = { lineNumber: 5, columnNumber: 10 } as SufficientStackFrame;

const fn = (): ResolvedFrame => resolveLocationWithSourceMap(stackFrame, sourceMaps);
Expand All @@ -86,7 +86,9 @@ describe("error-snippets/source-maps", () => {
}),
)) as BasicSourceMapConsumer;
sourceMaps.file = "file:///file1";
sandbox.stub(sourceMaps, "originalPositionFor").returns({ source: "file1", line: 100, column: 500 });
sandbox
.stub(sourceMaps, "originalPositionFor")
.returns({ source: "file1", line: 100, column: 500 } as NullableMappedPosition);
const stackFrame = { lineNumber: 1, columnNumber: 1 } as SufficientStackFrame;

const result = resolveLocationWithSourceMap(stackFrame, sourceMaps);
Expand Down

0 comments on commit baf74bb

Please sign in to comment.