connor4312 / nodejs-testing

VS Code integration for node:test native tests
MIT License
50 stars 7 forks source link

Cannot load mjs test files #1

Closed skanaar closed 1 year ago

skanaar commented 1 year ago

The extension does not seem to support .mjs esmodule files.

Test output logs

worker1> starting /Users/redacted/test-test/module.test.mjs
worker1> 1..0 # no tests found

Content of module.test.mjs

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

test('case A', async () => {
  console.log('success')
})

test('case B', async () => {
  strictEqual(true, false)
})

I can successfully run this test file with node --test

connor4312 commented 1 year ago

Thanks for the issue, I just published 1.0.1 with the fix. (May take a minute to appear on the marketplace)

koistya commented 1 year ago

@connor4312 I have "type": "module" in my package.json, using .test.js file extension. The list of tests shows up fine in the explorer, but when I run them, it fails with the error:

worker1> starting /Users/User/Projects/example/example.test.js
worker1> 1..0 # no tests found