playwright/packages/playwright-test/src/reporters
Dmitry Gozman 16a779a5ff
fix(test runner): show codeframe and location from the error top stack frame (#11179)
Previously, reporter would look for a stack frame directly in the test file.
Often times, that is not a top stack frame, especially when the test uses
some helper functions.

This changes error snippets and locations to use the top frame. When top
frame does not match the test file, we additionally show the location
to avoid confusion:

```
  1) a.spec.ts:7:7 › foobar ========================================================================

    Error: oh my

       at helper.ts:5

      3 |
      4 |       export function ohMy() {
    > 5 |         throw new Error('oh my');
        |               ^
      6 |       }
      7 |

        at ohMy (.../reporter-base-should-print-codeframe-from-a-helper/helper.ts:5:15)
        at .../reporter-base-should-print-codeframe-from-a-helper/a.spec.ts:8:9
        at FixtureRunner.resolveParametersAndRunHookOrTest (.../src/fixtures.ts:281:12)
```
2022-01-04 16:00:55 -08:00
..
.eslintrc.json chore: migrate to monorepo (#9421) 2021-10-11 16:52:17 +02:00
base.ts fix(test runner): show codeframe and location from the error top stack frame (#11179) 2022-01-04 16:00:55 -08:00
dot.ts fix(reporters): move Running X tests using Y workers to reporters (#10014) 2021-11-03 11:17:23 -07:00
empty.ts chore: move test runner types into the playwright test package (#9472) 2021-10-14 11:55:08 +02:00
github.ts fix(test runner): show codeframe and location from the error top stack frame (#11179) 2022-01-04 16:00:55 -08:00
html.ts feat(html): group similar items in the report (#11160) 2022-01-03 21:17:17 -08:00
json.ts fix(test runner): show codeframe and location from the error top stack frame (#11179) 2022-01-04 16:00:55 -08:00
junit.ts fix(html reporter): show missing attachments as warnings (#10400) 2021-11-17 18:03:13 -08:00
line.ts feat(reporters): show retry #x when running a test (#11003) 2021-12-17 21:07:04 -08:00
list.ts feat(reporters): show retry #x when running a test (#11003) 2021-12-17 21:07:04 -08:00
multiplexer.ts feat(reporters): augment non-stdio reporters with dot/line (#10003) 2021-11-03 08:25:16 -07:00
raw.ts fix(test runner): show codeframe and location from the error top stack frame (#11179) 2022-01-04 16:00:55 -08:00