镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Testrunner glob parsing seems to be broken #43675

Description

@jtuchel

Version

18.4.0

Platform

Linux pop-os 5.17.15-76051715-generic #202206141358165591911622.04~1db9e34 SMP PREEMPT Wed Jun 22 19 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

  • Create a new project via npm init -y
  • Change the test script to "test": "node --test ./myTestDir/**/*Tests.js"
  • Create the following folder structure
.
├── myTestDir
│   └── aFolder
│       ├── aSubFolder
│       │   └── ignoredTests.js
│       └── pickedUpTests.js
└── package.json

pickedUpTests.js

const assert = require('assert/strict');
const test = require('node:test');

test('picked up by testrunner', async t => {
    await t.test('passes.', async () => {
        assert.ok(true);
    });
});

ignoredTests.js

const assert = require('assert/strict');
const test = require('node:test');

test('ignored by testrunner', async t => {
    await t.test('fails.', async () => {
        assert.ok(false);
    });
});
  • When running npm run test only pickedUpTests run

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior?

It should run all tests ( failing ones too )

What do you see instead?

It seems the glob parsing is broken so it only runs tests on a specific directory depth

Additional information

A temporary workaround for this would be the glob ./myTestDir/**/**/*Tests.js

Activity

  1. added
    cliIssues and PRs related to the Node.js command-line interface.
    test_runnerIssues and PRs related to the test runner subsystem.
    on Jul 4, 2022
  2. MoLow commented on Jul 4, 2022

    @MoLow
    Member

    Hi @jtuchel,
    this is not broken - it was never implemented,
    however, it was discussed here #40954 (comment)
    @cjihrig were there any conclusions regarding this discussion?

  3. cjihrig commented on Jul 4, 2022

    @cjihrig
    Contributor

    There was no conclusion that I'm aware of. I think we should implement a CLI flag for this functionality based on regular expressions instead of globs. If/when Node adds glob support, we could switch over to using that (or stick with regular expressions if they are working well).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cliIssues and PRs related to the Node.js command-line interface.test_runnerIssues and PRs related to the test runner subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions