Skip to content

Commit 5f61514

Browse files
committed
fix error line location off by one
1 parent 5985269 commit 5f61514

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lua/neotest-playwright/report.lua

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,11 @@ collectSpecErrors = function(spec)
258258
end
259259
--- Convert Playwright error to neotest error
260260
toNeotestError = function(____error)
261-
local ____cleanAnsi_result_4 = cleanAnsi(____error.message)
262261
local ____opt_2 = ____error.location
263-
return {message = ____cleanAnsi_result_4, line = ____opt_2 and ____opt_2.line or 0}
262+
local line = ____opt_2 and ____opt_2.line
263+
return {
264+
message = cleanAnsi(____error.message),
265+
line = line and line - 1 or 0
266+
}
264267
end
265268
return ____exports

src/report.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,9 @@ const collectSpecErrors = (spec: P.JSONReportSpec): P.JSONReportError[] => {
141141

142142
/** Convert Playwright error to neotest error */
143143
const toNeotestError = (error: P.JSONReportError): neotest.Error => {
144+
const line = error.location?.line;
144145
return {
145146
message: cleanAnsi(error.message),
146-
line: error.location?.line ?? 0,
147+
line: line ? line - 1 : 0,
147148
};
148149
};

0 commit comments

Comments
 (0)