MCPcopy Create free account
hub / github.com/buggregator/server / TestSourceMap_OriginalPosition

Function TestSourceMap_OriginalPosition

modules/sentry/source_context_test.go:105–123  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

103}
104
105func TestSourceMap_OriginalPosition(t *testing.T) {
106 // generated line 1 -> original line 1; generated line 2 -> original line 3.
107 sm := &sourceMap{
108 Mappings: "AAAA;AAEA",
109 Sources: []string{"original.js"},
110 SourcesContent: []string{"// header\n// header2\nthrow new Error(\"boom\");\n"},
111 }
112 srcIdx, origLine, _, ok := sm.originalPosition(2, 0)
113 if !ok {
114 t.Fatal("expected a mapping")
115 }
116 if srcIdx != 0 || origLine != 2 {
117 t.Fatalf("got srcIdx=%d origLine=%d, want 0 and 2", srcIdx, origLine)
118 }
119 lines, _ := sm.originalSourceLines(srcIdx)
120 if lines[origLine] != `throw new Error("boom");` {
121 t.Fatalf("original line = %q", lines[origLine])
122 }
123}
124
125func TestEnrichFrame_UsesOriginalSourceViaSourceMap(t *testing.T) {
126 smJSON := `{"version":3,"sources":["original.js"],` +

Callers

nothing calls this directly

Calls 2

originalPositionMethod · 0.95
originalSourceLinesMethod · 0.95

Tested by

no test coverage detected