jest-community / vscode-jest

The optimal flow for Jest based testing in VS Code
MIT License
2.84k stars 294 forks source link

[Feature Request] Add more test failure information to test explorer #940

Open mqualizz opened 2 years ago

mqualizz commented 2 years ago

Currently the test explorer only shows whether a test failed or succeeded (based on a green checkmark or red x). It would be useful to show, for example on hover, the information provided by Jest. E.g.:

Assume the following test:

describe("demo", () => {
    test("2 is 3", () => {
        expect(2).toBe(3);
    })
})

on hover (in the test explorer) display:

  ● demo › 2 is 3

    expect(received).toBe(expected) // Object.is equality

    Expected: 3
    Received: 2

      28 | describe("demo", () => {
      29 |     test("2 is 3", () => {
    > 30 |         expect(2).toBe(3);
         |                   ^
      31 |     })
      32 | })
      33 |

      at Object.<anonymous> (src/util/eval_engine/value/NullValue.test.ts:30:19)
      at async TestScheduler.scheduleTests (node_modules/@jest/core/build/TestScheduler.js:317:13)
      at async runJest (node_modules/@jest/core/build/runJest.js:407:19)
      at async _run10000 (node_modules/@jest/core/build/cli/index.js:338:7)
      at async runCLI (node_modules/@jest/core/build/cli/index.js:190:3)
connectdotz commented 1 year ago

As far as I know, the vsocde TestExplorer API currently doesn't provide a hovering extension point, so we won't be able to do this, yet. However, you could request the hovering feature in vscode...