Skip to content

[Bug]: Inline test errors displayed on wrong line #214

@albinekb

Description

@albinekb

Checklist

Actual behavior

image
AssertionError: expected [ { elementType: 'link', (14) } ] to have a length of 5 but got 1
    at Context.<anonymous> file:///Users/albinekb/Devel/packages/browser-scripts/test/admin.test.ts:48:32    at runNextTicks (node:internal/process/task_queues:60:5)
    at process.processImmediate (node:internal/timers:449:9)
    at process.callbackTrampoline (node:internal/async_hooks:130:17)

The inline problem/output panel is displayed on the wrong line, it's always one line under the actual line.

Expected behavior

The inline error should be on the expected line, not the line under it.

As the AssertionError correctly outputs line 48 in this case.

Minimal, Reproducible Example

I can setup a repro/test when I got time to look into fixing this bug

Output

2024-12-22 01:37:54.547 [info] Reloaded tests from '/Users/albinekb/Devel/apps/browser-engine/node_modules/browser-scripts/test/admin.test.ts' Suite: +0 ~1 -0; Test: +0 ~1 -0
2024-12-22 01:37:54.666 [info] Reloaded tests from '/Users/albinekb/Devel/packages/browser-scripts/test/admin.test.ts' Suite: +0 ~1 -0; Test: +0 ~1 -0
2024-12-22 01:37:55.683 [info] Start test execution with args ["/Users/albinekb/.local/state/fnm_multishells/85518_1734821474670/bin/node","/Users/albinekb/Devel/node_modules/.pnpm/[email protected]/node_modules/mocha/bin/mocha.js","--config","/Users/albinekb/Devel/packages/browser-scripts/.mocharc.json","--reporter","/Users/albinekb/Devel/node_modules/.pnpm/[email protected]/node_modules/.mocha-vscode/fullJsonStreamReporter.js","--ignore","**/.","--file","test/admin.test.ts","--grep","/^(admin should pass$)/"]
2024-12-22 01:37:55.683 [info] Start test execution with env {}
2024-12-22 01:37:58.998 [error] Error: Test process exited with code 1
at ChildProcess. (/Users/albinekb/.cursor/extensions/coderline.mocha-vscode-1.2.4/out/extension.js:592:708)
at ChildProcess.emit (node:events:519:28)
at Process.ChildProcess._handle.onexit (node:internal/child_process:294:12)

Plugin Version Details

Name: Mocha for VS Code
Id: coderline.mocha-vscode
Description: Run and debug Mocha tests right within VS Code.
Version: 1.2.4
Publisher: coderline
VS Marketplace Link: https://marketplace.cursorapi.com/items?itemName=coderline.mocha-vscode

VS Code Version Details

Details

Tested in cursor and vscode:

Version: 1.96.0-insider
Commit: 3551cb01fa6f3a838e2d160df704cc3debfb9896
Date: 2024-10-30T05:04:18.074Z
Electron: 32.2.1
ElectronBuildId: 10427718
Chromium: 128.0.6613.186
Node.js: 20.18.0
V8: 12.8.374.38-electron.0
OS: Darwin arm64 24.0.0

Cursor
Version: 0.44.5
VSCode Version: 1.93.1
Commit: 1d610252e6812bf33245763f0742a534fd0f1d90
Date: 2024-12-20T00:02:28.554Z
Electron: 30.5.1
Chromium: 124.0.6367.243
Node.js: 20.16.0
V8: 12.4.254.20-electron.0
OS: Darwin arm64 24.0.0

Further details

const smMappingAccessor = (file: vscode.Uri, sm: TraceMap): IMappingAccessor => ({
originalPositionFor(line, column) {
const {
source,
line: smLine,
column: smCol,
} = originalPositionFor(sm, { line: line + 1, column: column });
if (!source) {
return new vscode.Location(file, new vscode.Position(line, column));
}
return new vscode.Location(vscode.Uri.parse(source), new vscode.Position(smLine - 1, smCol));
},
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions