Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: field matcherResult is missing in erros in JSON reports #34392

Open
m-burg opened this issue Jan 18, 2025 · 0 comments
Open

[Bug]: field matcherResult is missing in erros in JSON reports #34392

m-burg opened this issue Jan 18, 2025 · 0 comments

Comments

@m-burg
Copy link

m-burg commented Jan 18, 2025

Version

1.49.1

Steps to reproduce

git clone https://github.com/m-burg/playwright-json-errors-reproduction.git
cd playwright-json-errors-reproduction
npm install
npx playwright test

The JSON report is written to test-results.json

Expected behavior

Every spec in the JSON report contains an array of test results, each with both an error and an errors key.

As per the documentation, I expect error to be the same as the first element of errors. I also expect each error in errors to contain complete information about what went wrong.

Actual behavior

Only the error in error contains matcherResult and stack. Those fields are missing from all the elements in errors, and I am not sure if this is intended.

{
  "workerIndex": 0,
  "status": "failed",
  "duration": 5,
  "error": {
    "message": "/* ... */",
    "stack": "/* ... */",
    "matcherResult": {
      "actual": 5,
      "expected": 6,
      "message": "/* ... */",
      "name": "toBe",
      "pass": false
    },
    "location": {
      "file": "/home/michel/sources/playwright-json-errors-reproduction/tests/example.spec.ts",
      "column": 24,
      "line": 4
    },
    "snippet": "/* ... */"
  },
  "errors": [
    {
      "location": {
        "file": "/home/michel/sources/playwright-json-errors-reproduction/tests/example.spec.ts",
        "column": 24,
        "line": 4
      },
      "message": "/* ... */"
    },
    {
      "location": {
        "file": "/* ... */",
        "column": 24,
        "line": 5
      },
      "message": "/* ... */"
    }
  ],
  "stdout": [],
  "stderr": [],
  "retry": 0,
  "startTime": "2025-01-18T10:09:53.578Z",
  "attachments": [],
  "errorLocation": {
    "file": "/home/michel/sources/playwright-json-errors-reproduction/tests/example.spec.ts",
    "column": 24,
    "line": 4
  }
}

Additional context

No response

Environment

System:
    OS: Linux 6.12 Ubuntu 24.04 LTS 24.04 LTS (Noble Numbat)
    CPU: (24) x64 AMD Ryzen 9 7900X 12-Core Processor
    Memory: 58.16 GB / 61.92 GB
    Container: Yes
  Binaries:
    Node: 20.17.0 - /usr/bin/node
    Yarn: 1.22.22 - /usr/bin/yarn
    npm: 10.8.2 - /usr/bin/npm
  Languages:
    Bash: 5.2.21 - /usr/bin/bash
  npmPackages:
    @playwright/test: ^1.49.1 => 1.49.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant