Skip to content

Error location issues with @playwright/test #747

@KonnorRogers

Description

@KonnorRogers

Acknowledgements

  • I read the documentation and searched existing issues to avoid duplicates
  • I understand this is a bug tracker and anything other than a proven bug will be closed
  • I understand this is a free project and relies on community contributions
  • I read and understood the Contribution guide

Minimal reproduction URL

https://github.com/KonnorRogers/tsx-sourcemaps-playwright-issue

Problem & expected behavior (under 200 words)

  • An error is thrown by a playwright test
  • I expected the stack trace to point to the line causing the error

Instead, the stack trace always points to line one.

import { test, expect } from '@playwright/test';

test('has title', async ({ page }) => {
  // try {
    throw Error("Line 5 should error.")
  // } catch (e) {
    // Of note, this also returns line 1 as the error.
    // console.error(e)
  // }
});

Stack trace:

  3) [webkit] › tests/example.spec.ts:1:36 › has title ─────────────────────────────────────────────

    Error: Line 5 should error.

    > 1 | import { test, expect } from '@playwright/test';
        |                                                                           ^
      2 |
      3 | test('has title', async ({ page }) => {
      4 |   // try {
        at /Users/konnorrogers/projects/work/tsx-sourcemaps-playwright-issue/tests/example.spec.ts:1:75

I'm not sure if TSX is the issue, or Playwright, or something to do with the way the loader is being used?

Also of note, if I throw an error then catch it, the stack trace also points to line 1 there. Any help would be appreciated!

Bugs are expected to be fixed by those affected by it

  • I'm interested in working on this issue

Compensating engineering work will speed up resolution and support the project

  • I'm willing to offer $10 for financial support

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions