connor4312 / nodejs-testing

VS Code integration for node:test native tests
MIT License
43 stars 6 forks source link

node:assert functions not properly failing tests #5

Closed skanaar closed 1 year ago

skanaar commented 1 year ago

Using the assert methods from node:assert does not properly fail a test. Instead a toast with this message pops up:

Worker executed with code 1: /Users/kallin/.vscode/extensions/connor4312.nodejs-testing-1.0.2/out/runner-worker.js:206

But explicitly throwing an Error properly fails the test.

VS Code: 1.76.1 nodejs-testing: v1.0.2

Sample test file

import { test } from 'node:test'
import { deepEqual } from 'node:assert'

test('should pass', () => {
  deepEqual({ foo: 'bar' }, { foo: 'bar' })
})

test('will fail properly', () => {
  throw new Error('fail')
})

test('will not fail properly', () => {
  deepEqual({ foo: 'bar' }, { foo: 'x' })
})

State of my editor

Screenshot 2023-03-12 at 19 16 35
connor4312 commented 1 year ago

Unfortunately this is a Node.js bug: https://github.com/nodejs/node/issues/47075

skanaar commented 1 year ago

Oh! 😨 Nice bug report in Node, looks like they are addressing it.