Skip to content

Commit

Permalink
Remove previous FTR --exclude arg in favor of new tag-based include/e…
Browse files Browse the repository at this point in the history
…xclude args
  • Loading branch information
brianseeders committed Mar 16, 2020
1 parent b123a84 commit 440b7c9
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 49 deletions.
13 changes: 5 additions & 8 deletions packages/kbn-test/src/functional_test_runner/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,14 @@ export function runFtrCli() {
installDir: parseInstallDir(flags),
},
suiteFiles: {
include: toArray(flags['include-file'] as string | string[]).map(makeAbsolutePath),
exclude: toArray(flags['exclude-file'] as string | string[]).map(makeAbsolutePath),
include: toArray(flags.include as string | string[]).map(makeAbsolutePath),
exclude: toArray(flags.exclude as string | string[]).map(makeAbsolutePath),
},
suiteTags: {
include: toArray(flags['include-tag'] as string | string[]),
exclude: toArray(flags['exclude-tag'] as string | string[]),
},
updateBaselines: flags.updateBaselines,
excludeTestFiles: flags.exclude || undefined,
}
);

Expand Down Expand Up @@ -111,9 +110,8 @@ export function runFtrCli() {
string: [
'config',
'grep',
'include',
'exclude',
'include-file',
'exclude-file',
'include-tag',
'exclude-tag',
'kibana-install-dir',
Expand All @@ -128,9 +126,8 @@ export function runFtrCli() {
--bail stop tests after the first failure
--grep <pattern> pattern used to select which tests to run
--invert invert grep to exclude tests
--exclude=file path to a test file that should not be loaded
--include-file=file a test file to be included, pass multiple times for multiple files
--exclude-file=file a test file to be excluded, pass multiple times for multiple files
--include=file a test file to be included, pass multiple times for multiple files
--exclude=file a test file to be excluded, pass multiple times for multiple files
--include-tag=tag a tag to be included, pass multiple times for multiple tags
--exclude-tag=tag a tag to be excluded, pass multiple times for multiple tags
--test-stats print the number of tests (included and excluded) to STDERR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ export const schema = Joi.object()
testFiles: Joi.array().items(Joi.string()),
testRunner: Joi.func(),

excludeTestFiles: Joi.array()
.items(Joi.string())
.default([]),

suiteFiles: Joi.object()
.keys({
include: Joi.array()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,12 @@ import { decorateMochaUi } from './decorate_mocha_ui';
* @param {String} path
* @return {undefined} - mutates mocha, no return value
*/
export const loadTestFiles = ({
mocha,
log,
lifecycle,
providers,
paths,
excludePaths,
updateBaselines,
}) => {
const pendingExcludes = new Set(excludePaths.slice(0));

export const loadTestFiles = ({ mocha, log, lifecycle, providers, paths, updateBaselines }) => {
const innerLoadTestFile = path => {
if (typeof path !== 'string' || !isAbsolute(path)) {
throw new TypeError('loadTestFile() only accepts absolute paths');
}

if (pendingExcludes.has(path)) {
pendingExcludes.delete(path);
log.warning('Skipping test file %s', path);
return;
}

loadTracer(path, `testFile[${path}]`, () => {
log.verbose('Loading test file %s', path);

Expand Down Expand Up @@ -94,13 +78,4 @@ export const loadTestFiles = ({
};

paths.forEach(innerLoadTestFile);

if (pendingExcludes.size) {
throw new Error(
`After loading all test files some exclude paths were not consumed:${[
'',
...pendingExcludes,
].join('\n -')}`
);
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export async function setupMocha(lifecycle, log, config, providers) {
lifecycle,
providers,
paths: config.get('testFiles'),
excludePaths: config.get('excludeTestFiles'),
updateBaselines: config.get('updateBaselines'),
});

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions packages/kbn-test/src/functional_tests/cli/run_tests/args.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ const options = {
updateBaselines: {
desc: 'Replace baseline screenshots with whatever is generated from the test.',
},
'include-file': {
include: {
arg: '<file>',
desc: 'Files that must included to be run, can be included multiple times.',
},
'exclude-file': {
exclude: {
arg: '<file>',
desc: 'Files that must NOT be included to be run, can be included multiple times.',
},
Expand Down Expand Up @@ -124,11 +124,11 @@ export function processOptions(userOptions, defaultConfigPaths) {
}

userOptions.suiteFiles = {
include: [].concat(userOptions['include-file'] || []),
exclude: [].concat(userOptions['exclude-file'] || []),
include: [].concat(userOptions.include || []),
exclude: [].concat(userOptions.exclude || []),
};
delete userOptions['include-file'];
delete userOptions['exclude-file'];
delete userOptions.include;
delete userOptions.exclude;

userOptions.suiteTags = {
include: [].concat(userOptions['include-tag'] || []),
Expand Down

0 comments on commit 440b7c9

Please sign in to comment.