Repository navigation
test runner global configuration #43895
Description
Activity
- addeddiscussIssues opened for discussion and feedback.Issues opened for discussion and feedback.test_runnerIssues and PRs related to the test runner subsystem.Issues and PRs related to the test runner subsystem.
on Jul 18, 2022 @nodejs/test_runner
@benjamingrReacted by Benjamin Gruenbaummy personal thoughts:
It is preferable for global configuration to be a js file so it can contain js functions/objects (i.e for some of the use cases above such as reporters)
one option is one single--test-config="file.js"flag to cover all configurations
another option is looking for a.testrcfileReacted by Benjamin Gruenbaum- changed the title
[-]test_runner: global configuration [/-][+]test runner global configuration [/+]on Jul 18, 2022 FWIW @nodejs/loaders is also brainstorming how to make configuration a thing in nodejs/loaders#98 (comment), maybe we can find a solution that works for both.
Reacted by Moshe Atlow and Benjamin GruenbaumSpecifying test files would be helpful too, at current the CLI shell expansions can be a bit limiting, for example using
node --loader ts-node/esm --test **/*.test.tswill accidentally include files insidenode_modules/. Being able to specify a test config with inclusions/exclusions would be considerably more helpful.A couple bikesheds:
// maybe npm "files" like export default { loader: "ts-node/esm", files: [ "**/*.test.ts", "!node_modules/", ], } // maybe tsconfig like export default { loader: "ts-node/esm", include: [ "**/*.test.ts", ], exclude: [ "node_modules/", ], }
I would expect the files to live in a specific directory like
./src, in which case, couldn't you donode --loader ts-node/esm --test ./src/**/*.test.tsI would expect the files to live in a specific directory like
./srcIt's a common pattern, but not one I often use for multiple reasons.
Specifying test files can now be done using #44241,
closing this as this solves most of the use cases in this issue
the question of global configuration for the test runner was raised on a few places,
node:test#42984)I think it is worth a small discussion about how to provide the ability to globaly configure the test runner.
a few things that might have already been noted in the above links: