I'm using
- Node 18.4
- npm 8.13.1
- Pop!_OS 22.04 LTS
and have a sample project where I would like to try out the new built-in testrunner. Given the following structure
.
├── lib
│ └── index.ts
├── test
│ └── aFolder
│ ├── aSubFolder
│ │ └── ignoredTests.ts
│ └── pickedUpTests.ts
├── .eslintrc.json
├── .gitignore
├── package.json
└── tsconfig.json
Now I will describe the file content but I also created a reproduction repository that you can find here
Content of index.ts
export {};
Content of .eslintrc.json
{
"extends": "es/browser"
}
Content of package.json
{
"name": "wildcard-reproduction",
"version": "0.0.1",
"scripts": {
"lint": "npx eslint ./**/*.ts",
"test": "node --test --require ts-node/register ./test/**/*Tests.ts"
},
"dependencies": {
"@types/node": "18.0.0"
},
"devDependencies": {
"eslint": "7.32.0",
"eslint-config-es": "4.2.0",
"ts-node": "10.8.1",
"typescript": "4.7.4"
}
}
Content of tsconfig.json
{
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"esModuleInterop": true,
"lib": [ "es2020", "dom" ],
"module": "commonjs",
"outDir": "build",
"resolveJsonModule": true,
"strict": true,
"target": "es2020"
},
"include": [
"./**/*.ts"
],
"exclude": [
"./build"
]
}
Content of pickedUpTests.ts
import assert from 'assert/strict';
import test from 'node:test';
test('picked up by testrunner', async t => {
await t.test('passes.', async () => {
assert.ok(true);
});
});
Content of ignoredTests.ts
import assert from 'assert/strict';
import test from 'node:test';
test('ignored by testrunner', async t => {
await t.test('fails.', async () => {
assert.ok(false);
});
});
The code contains multiple linter errors so eslint shoud fail. But when running npm run lint
everything seems to be fine
There are multiple tests in multiple folders inside the test folder. When running npm run test
the testrunner only picks up the tests in the first depth
Something seems to be broken but I can't figure out what exactly. I think the npm scripts are fine. I'm expecting failing tests and linter errors but both are passing...
The funny thing: When deleting the lib folder, at least the linter seems to work for the test files ...
Does someone know what's wrong here?