Skip to content

Commit 0c6bd59

Browse files
committed
Maintain test to traceback info including module files
1 parent 7b64ab3 commit 0c6bd59

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

frontend/src/utils/__tests__/traceback.test.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,34 @@ import { extractAllTracebackInfo } from "../traceback";
66
describe("traceback", () => {
77
test("extracts cell-link", () => {
88
const errors = extractAllTracebackInfo(Tracebacks.raw);
9-
expect(errors).toMatchInlineSnapshot(`
9+
expect(errors[0].isCell).toBe(false);
10+
expect(errors[0].src.endsWith("marimo/_runtime/executor.py")).toBe(true);
11+
expect(errors.slice(1)).toMatchInlineSnapshot(`
1012
[
1113
{
12-
"cellId": "Hbol",
14+
"isCell": true,
1315
"lineNumber": 4,
16+
"src": "Hbol",
1417
},
1518
{
16-
"cellId": "Hbol",
19+
"isCell": true,
1720
"lineNumber": 2,
21+
"src": "Hbol",
1822
},
1923
]
2024
`);
2125
});
2226

2327
test("extracts cell-link from assertion", () => {
2428
const info = extractAllTracebackInfo(Tracebacks.assertion);
25-
expect(info).toMatchInlineSnapshot(`
29+
expect(info[0].isCell).toBe(false);
30+
expect(info[0].src.endsWith("marimo/_runtime/executor.py")).toBe(true);
31+
expect(info.slice(1)).toMatchInlineSnapshot(`
2632
[
2733
{
28-
"cellId": "Hbol",
34+
"isCell": true,
2935
"lineNumber": 1,
36+
"src": "Hbol",
3037
},
3138
]
3239
`);

frontend/src/utils/traceback.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,8 @@ export function extractAllTracebackInfo(traceback: string): TracebackInfo[] {
112112
replace: (domNode) => {
113113
const info = getTracebackInfo(domNode);
114114
if (info) {
115-
infos.push({
116-
cellId: info.cellId,
117-
lineNumber: info.lineNumber,
118-
});
119-
return `${info.cellId}:${info.lineNumber}`;
115+
infos.push(info);
116+
return `${info.src}:${info.lineNumber}`;
120117
}
121118
},
122119
});

0 commit comments

Comments
 (0)