Repository navigation
Description
Version
1.65.0
Steps to reproduce
// package.json
{ "private": true, "devDependencies": { "@playwright/test": "1.65.0" } }// a.test.js
const { test } = require('@playwright/test');
test('my test', () => {});bun install
bunx --bun playwright test --listExpected behavior
a.test.js:2:1 › my test (test( starts at column 1). This is what Bun 1.4.3 and Node print.
Actual behavior
On Bun 1.4.4:
a.test.js:2:2 › my test
Every test, hook and fixture location is one column to the right. That affects reporters, --list, file:line:col filters, GitHub annotations, the HTML report and fixture error messages.
Additional context
Bun 1.4.4 changed CallSite.getColumnNumber() from 0-based to 1-based, to match V8 (oven-sh/bun#45677):
Error.prepareStackTrace = (_, f) => f;
const site = () => { const o = {}; Error.captureStackTrace(o, site); return o.stack[0].getColumnNumber(); };
const col = [
site(),
][0];
console.log(col); // Bun 1.4.3: 0, Bun 1.4.4: 1, Node: 1bunCallerLocation in packages/playwright/src/transform/transform.ts still treats the column as 0-based. It adds 1 to the result, and it passes the 1-based column to mapSourcePosition, which expects a 0-based one. The Bun bot pins bun-version: 1.4.3, so CI doesn't catch it.
With PW_BUN=1 npm run ttest on Bun 1.4.4, 88 more tests fail than on 1.4.3 (reporter-line, reporter-list, fixture-errors, list-mode, hooks, command-line-filter, reporter-json, reporter-blob, ...).
Possible fix. With it, the 1.4.4 run matches 1.4.3, and the location-heavy specs still pass on 1.4.3:
+// Bun's CallSite.getColumnNumber() is 0-based before Bun 1.4.4 and 1-based, like V8, since then.
+let bunColumnBase: number | undefined;
+function bunCallSiteColumnBase(): number {
+ if (bunColumnBase === undefined) {
+ const bun = (globalThis as any).Bun;
+ bunColumnBase = bun.semver.satisfies(bun.version, '>=1.4.4') ? 1 : 0;
+ }
+ return bunColumnBase;
+}
+
function bunCallerLocation(error: Error, stackFrames: NodeJS.CallSite[]) {
const frame = stackFrames[1];
- // Bun's CallSite.getColumnNumber() is 0-based, and Bun does not apply source maps of .js files.
- const position = sourceMapSupport.mapSourcePosition({ source: frame.getFileName()!, line: frame.getLineNumber()!, column: frame.getColumnNumber()! });
+ // Bun does not apply source maps of .js files. Source maps take 0-based columns.
+ const column = frame.getColumnNumber()! - bunCallSiteColumnBase();
+ const position = sourceMapSupport.mapSourcePosition({ source: frame.getFileName()!, line: frame.getLineNumber()!, column });plus bun-version: 1.4.4 in tests_primary.yml. I used a version check instead of detecting the base at runtime because Bun reports columns differently for new Function/eval code, so a probe isn't reliable. I'm happy to send this as a PR.
Environment
System:
OS: macOS 26 (Darwin 25.6.0), arm64
Binaries:
Bun: 1.4.4 (also checked 1.4.3)
npmPackages:
"@playwright/test": 1.65.0
Activity
github-actions commentedon Nov 5, 2026
microsoft-playwright-automation commentedon Nov 5, 2026
Hi, I'm the Playwright bot. I reproduced this on Linux.
Reproduced on tip-of-tree (
1.66.0-next,17ec699e4f4760bab5ad95f6ef9b954d5f1ce7eb) with Bun 1.4.4; Bun 1.4.3 and Node report the correct columns. Playwright still treats Bun's call-site column as zero-based. The proposed fix converts the column before source-map lookup and keeps support for older Bun versions.Reproduction and checks
The existing
should list teststest intests/playwright-test/list-mode.spec.tsreproduces this. I extended it with a call at column 1:With
bun playwright test --list, that call is reported at column 2 before the fix and column 1 after it. Indented calls are also one column too far right before the fix.On Linux, using the checkout's test runner:
The suites were
list-mode,command-line-filter,hooks,fixture-errors,reporter-json, andreporter-line, run withnpm run ttestandPW_BUN=1for Bun. The existing source-mapped file-filter test also passed separately on all three runtimes.npm run buildandnpm run flintpassed.These are test-runner checks and do not launch browsers. I did not verify macOS.
Draft PR: #43942
Triaged on Linux by the Playwright bot - agent run
fix(test runner): correct test locations on Bun 1.4.4 and later