vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Expected/Actual's values are `undefined`

Open Pustinyak opened this issue 3 years ago • 0 comments

Describe the bug After a test fails, a modal is opened with information about expected/actual values but they show as undefined.

To Reproduce Create a failing test containing expect(input).toHaveValue(value). The bug doesn't occur when the assertion is using toBe e.g. expect(1).toBe(2).

Expected behavior It should work in the same way that expect(1).toBe(2) behaves - showing the difference between the 2 values.

Screenshots image

Environment

  • OS: Linux (WSL2 / Windows 10)
  • VSCode version: 1.70.2
  • Vitest version: 0.22.1
  • Vitest plugin version: 0.2.28

Additional context This is not a bug with the extension, because the data that it receives isn't complete. We should further investigate why vitest isn't sending the needed data.

// Data received from the websocket using `expect.toHaveValue` - seems incomplete

"pass",
"Error: expect(element).toHaveValue(13372)\n\nExpected the element to have value:\n  13372\nReceived:\n\n",
"expect(element).toHaveValue(13372)\n\nExpected the element to have value:\n  13372\nReceived:\n",
"undefined",
"Error",
"Function<JestExtendError>",
"Function<toString>",
// Data received from the websocket using `expect.toBe` - seems complete

"pass",
"expected '1337' to be '13372' // Object.is equality",
"1337",                    <------------------------------------- missing from the upper example
"13372",                   <------------------------------------- missing from the upper example
"strictEqual",
"AssertionError: expected '1337' to be '13372' // Object.is equality\n
"AssertionError",
"Function<AssertionError>",
"Function<>",
"Function<toString>",

Pustinyak avatar Aug 30 '22 06:08 Pustinyak