Skip to content

test file discovery should match Node.js test runner #77

@valler

Description

@valler

The extension should discover test files, the way Node.js would discover them.

While there are open issues about discovery of dynamic tests, this is different from those.

When it comes to test files, the Node.js test runner only cares about matching globs (and provided options). The extension seems to deviate from that, or have some kind of bug. I'm getting mixed results (based on whether I "reload window") and in any case, the file list does not match Node.js.

Unfortunately, the mentioned inconsistencies make it hard to reproduce what the extension discovers on my end. So far I'm under the impression that tests in test folders are discovered fairly consistently, while tests matching one of the file extension patterns sometimes show up and sometimes they don't. I haven't tested custom patterns or file name patterns other than the mentioned secondary extensions (e.g. patterns like .test.js were tested and patterns like _test.js were not).

Node.js simply does globSync from cwd against the patterns listed in the docs (or user supplied patterns), always excluding node_modules. The list is created this way even in watch mode and updates are applied on a diff against the previous file list (for the Node.js test runner that would be reruns on newly added [or modified] files only; for this extension deleted files would have to be taken into account as well, to remove them in the GUI).

Any chance one could simply get what Node.js does by default, at least for file discovery? This should of course include all file extensions that Node.js would discover by default as well.

# runs all tests (excluding those in `node_modules`)
node --test

Use case: The command in the example allows for running all tests, even across workspaces in a mono repo, regardless of package manager and mono repo structure or programming language (as far as supported by Node.js).

Without file discovery reflecting Node.js this extension kind of misses its purpose and becomes more or less useless.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions