Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VSCode attempts to open file '/<anonymous>' when running an individual failing test. #50

Closed
aantia opened this issue Jul 30, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@aantia
Copy link

aantia commented Jul 30, 2024

If I attempt to run an individual failing test VSCode will open a new editor tab with an empty file '/' and an error message The editor could not be opened because the file was not found.
This only happens when running a test individually, not from a describe block etc. It does not happen on a successful test. I have verified that it happens if using simple assert or using Chai.

In addition to popping up the new tab, the inline error & log messages don't show. The test is still listed as having failed in the outliner and the editor margin.

An example:

import { describe, it } from "node:test";
import { expect } from "chai";
 
describe('base64ToHex', () => {
  it('handles empty string', () => { // I would expect to see an error message here when the test fails
    const base64 = '';
    const expectedHex = '';
    console.log("ping") // I would expect to see 'ping' here when the test is run
    expect(base64ToHex(base64)).to.not.equal(expectedHex);
    console.log("pong")
  });
});

My vscode version is 1.91.1, node 22.5.1, and I'm running with these settings:

    "nodejs-testing.extensions": [
    
        {
            "extensions": [
                "mjs",
                "cjs",
                "js"
            ],
            "parameters": []
        },
        {
        "extensions": ["mts", "cts", "ts"],
        "parameters": ["--import", "tsx"]
        }
    ],
    "nodejs-testing.include": [
        "./",
        "./src./tests/"
    ],
@aantia
Copy link
Author

aantia commented Aug 1, 2024

I was slightly incorrect about the conditions; it happens if the first test run fails, regardless of what block it's run from.

@connor4312 connor4312 added the bug Something isn't working label Aug 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants