Skip to content

Commit

Permalink
test(cli-e2e): fix E2E tests after --skipPlugins option added (#741)
Browse files Browse the repository at this point in the history
- Fixes [failing E2E
tests](https://github.com/code-pushup/cli/actions/runs/9887801155/job/27310310532)
after #730 was merged.
- Will look into how we can get GitHub Actions to trigger CI workflow
for PRs from forks, and also skip Code PushUp upload ([fails due to
missing
secrets](https://github.com/code-pushup/cli/actions/runs/9830652625/job/27222815753)).
  • Loading branch information
matejchalk authored Jul 11, 2024
1 parent e841532 commit ae3c166
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
5 changes: 5 additions & 0 deletions e2e/cli-e2e/tests/__snapshots__/help.e2e.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Global Options:
file. [string]
--onlyPlugins List of plugins to run. If not set all plugins are run.
[array] [default: []]
--skipPlugins List of plugins to skip. If not set all plugins are run.
[array] [default: []]
Persist Options:
--persist.outputDir Directory for the produced reports [string]
Expand All @@ -47,6 +49,9 @@ Examples:
code-pushup collect --onlyPlugins=covera Run collect with only coverage plugi
ge n, other plugins from config file wi
ll be skipped.
code-pushup collect --skipPlugins=covera Run collect skiping the coverage plu
ge gin, other plugins from config file
will be included.
code-pushup upload --persist.outputDir=d Upload dist/cp-report.json to portal
ist --persist.filename=cp-report --uploa using API key from environment vari
d.apiKey=$CP_API_KEY able
Expand Down
8 changes: 1 addition & 7 deletions e2e/cli-e2e/tests/print-config.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ describe('print-config', () => {
command: 'code-pushup',
args: [
'print-config',
'--verbose',
'--no-progress',
`--config=${configFilePath(ext)}`,
'--tsconfig=tsconfig.base.json',
Expand Down Expand Up @@ -46,17 +45,12 @@ describe('print-config', () => {
server: 'https://e2e.com/api',
},
plugins: [
expect.objectContaining({ slug: 'eslint', title: 'ESLint' }),
expect.objectContaining({
slug: 'coverage',
title: 'Code coverage',
}),
],
categories: [
expect.objectContaining({ slug: 'bug-prevention' }),
expect.objectContaining({ slug: 'code-style' }),
expect.objectContaining({ slug: 'code-coverage' }),
],
categories: [expect.objectContaining({ slug: 'code-coverage' })],
onlyPlugins: ['coverage'],
skipPlugins: ['eslint'],
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ export function validatePluginFilterOption(
);
}

if (categories.length > 0) {
const removedCategorieSlugs = filterItemRefsBy(categories, ({ plugin }) =>
if (categories.length > 0 && verbose) {
const removedCategorySlugs = filterItemRefsBy(categories, ({ plugin }) =>
filterFunction(plugin),
).map(({ slug }) => slug);
ui().logger.info(
`The --${filterOption} argument removed categories with "${removedCategorieSlugs.join(
`The --${filterOption} argument removed categories with "${removedCategorySlugs.join(
'", "',
)}" slugs.
`,
Expand Down

0 comments on commit ae3c166

Please sign in to comment.