Skip to content

Testrunner glob parsing seems to be broken #43675

Closed
@jtuchel

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

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