mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[kbn-test] Jest run script should use testPathPattern
to lookup config (#206341)
Adds logic to support the jest vscode extension by reading the `--testPathPattern` arg for the purpose of config lookup. This enables running tests easily in the vscode jest extension.
This commit is contained in:
parent
cebd201981
commit
481b8037d6
1 changed files with 6 additions and 1 deletions
|
@ -79,6 +79,11 @@ export function runJest(configName = 'jest.config.js') {
|
|||
|
||||
if (!argv.config) {
|
||||
testFiles = argv._.map((p) => resolve(cwd, p.toString()));
|
||||
|
||||
if (argv.testPathPattern) {
|
||||
testFiles.push(argv.testPathPattern);
|
||||
}
|
||||
|
||||
const commonTestFiles = commonBasePath(testFiles);
|
||||
const testFilesProvided = testFiles.length > 0;
|
||||
|
||||
|
@ -123,7 +128,7 @@ export function runJest(configName = 'jest.config.js') {
|
|||
);
|
||||
} else {
|
||||
log.error(
|
||||
`we no longer ship a root config file so you either need to pass a path to a test file, a folder where tests can be found, or a --config argument pointing to one of the many ${configName} files in the repository`
|
||||
`we no longer ship a root config file so you either need to pass a path to a test file, a folder where tests can be found, a --testPathPattern argument pointing to a file/directory or a --config argument pointing to one of the many ${configName} files in the repository`
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue