hbenl / vscode-jasmine-test-adapter

Jasmine Test Adapter for the VS Code Test Explorer
MIT License
20 stars 20 forks source link

Custom error - don't shows message in output #68

Open didushko opened 1 year ago

didushko commented 1 year ago

ENV:

Chip: Apple M1 Pro OS: macOS 13.0 Node: v19.8.1 VSCode: Version: 1.77.3 (Universal) Jasmine: 4.6.0 Jasmine Test Explorer v1.8.2

Problem: If i throw my custom error:

export class TaskError extends Error {
  isNetworkError = false;
  constructor(message: string, isNetworkError?: boolean) {
    super(message);
    if (isNetworkError != undefined) {
      this.isNetworkError = isNetworkError;
    }
    Object.setPrototypeOf(this, TaskError.prototype);
  }
}

all that i see in output is:

error properties: Object({ isNetworkError: false })
    at UserContext.<anonymous> (/tests/basic.test.ts:10:11)
    at <Jasmine>
    at processImmediate (node:internal/timers:478:21)

log from "jasmin explorer log" panel:

[2023-04-25 15:48:26.881] [INFO] Received {"type":"test","test":"Basic functionality, no config should discover and assess all detected openapi files","state":"failed","message":"error properties: Object({ isNetworkError: false })\n at UserContext.<anonymous> (tests/basic.test.ts:10:11)\n at <Jasmine>\n at processImmediate (node:internal/timers:478:21)","failures":[{"stack":"error properties: Object({ isNetworkError: false })\n at UserContext.<anonymous> (file:///Users/denysdidushko/42Crunch/cicd-core/node/tests/basic.test.ts:10:11)\n at <Jasmine>\n at processImmediate (node:internal/timers:478:21)","message":"Error: test"}]}

if i use standart Error, i can see message:

Error: test
    at UserContext.<anonymous> (tests/basic.test.ts:11:11)
    at <Jasmine>
    at processImmediate (node:internal/timers:478:21)