connor4312 / nodejs-testing

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

"No tests found" #23

Closed nalanj closed 2 months ago

nalanj commented 8 months ago

I'm hitting a case where when I run tests from the command line they run as expected. When I run the same tests from within the extension, I get 'no tests found'. Is there an ideal way to debug what's going on?

connor4312 commented 8 months ago

Can you please share your repository or a sample reproduction where you see this happen?

nalanj commented 8 months ago

The issue that I hit was due to some path related problems. In one of my imports a file that was read was in a different location due to the working directory not being quite the same when run in vscode.

The tricky thing here was that the test runner wasn't displaying any of the errors that occurred while loading my tests.

Here's a really simple case to reproduce. It's obviously a silly example:

// lib.js
export function thing() {
  return "thing";
}

throw new Error("OH NO");
// index.test.js
import { describe, it } from "node:test";
import assert from "node:assert";
import { thing } from "./lib.js";

describe("something", async() => {
  it("does something", async() => {
    assert.equal(thing(), "thing");
  });
});

If you run this, you'll get this output:

worker1> starting /Users/nalanj/Source/nalanj/repro/index.test.js
worker1> TAP version 13
worker1> 1..0 # no tests found
nohehf commented 5 months ago

Hi, I'm getting this error on all my tests too now, it was working just fine a few months ago

connor4312 commented 2 months ago

In recent versions we use a more reliable way to report+read test results, please let me know if you continue to experience issues.