nodejs-testing.extensions
is a list of test extensions to search for, and optional additional Node.js parameters to pass when running those test files. It defaults to
[
{
"extensions": ["mjs", "cjs", "js"],
"parameters": []
}
]
...but is useful for configuring loaders for other file types. For example, to run TypeScript tests, you could use
{
"nodejs-testing.extensions": [
{
"extensions": ["mjs", "cjs", "js"],
"parameters": []
},
{
"extensions": ["mts", "cts", "ts"],
"parameters": ["--import", "tsx"]
}
]
}
You can also import other helpers by adding parameters like ["--import", "${workspaceFolder}/path/to/file.js"]
. See the Node.js command line API for a full list of options.
Finally, in addition to an extensions
option, you can inspect specify a filePattern
option if you want to name your files differently than the default naming scheme.