Skip to content

Commit

Permalink
Merge pull request #705 from wmde/cover-all-banners
Browse files Browse the repository at this point in the history
Remove coverage filter
  • Loading branch information
gbirke authored Feb 11, 2025
2 parents f58e9f0 + cc53b99 commit 224813f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 24 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"ci": "npm-run-all check-tracking-conf lint test check-content-version",
"check-content-version": "ts-node tools/check-content-version.ts",
"check-tracking-conf": "ts-node tools/CampaignConfigurationCheck/check-tracking-number-and-date.mjs",
"coverage:filtered": "vitest run --coverage --config vitest.campaign.config.mjs",
"coverage:all": "vitest run --coverage",
"update-content": "npm update fundraising-frontend-content"
},
Expand Down
10 changes: 0 additions & 10 deletions test/filterInactiveCampaigns.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ function getCampaignNamesAndMappings( campaignConfigPath ) {
*/
export function getFilterForInactiveCampaigns( bannerGlob, bannerTestGlob, campaignConfigPath ) {
const potentialCampaignTestFolders = fg.globSync( bannerTestGlob, { onlyDirectories: true } );
const potentialBannerFolders = fg.globSync( bannerGlob, { onlyDirectories: true } );

const { activeCampaigns, campaignsToChannels } = getCampaignNamesAndMappings( campaignConfigPath );

Expand All @@ -43,21 +42,12 @@ export function getFilterForInactiveCampaigns( bannerGlob, bannerTestGlob, campa
return !activeCampaigns.includes( campaignName );
} );

const inactiveBannerFolders = potentialBannerFolders.filter( folder => {
const campaignName = path.basename( folder );
return !activeCampaigns.includes( campaignName );
} );

// Create recursive glob expressions for use in vitest "exclude"
const inactiveCampaignGlobs = inactiveCampaignTestFolders.map( folder => path.join( folder, '**' ) );

// Create recursive glob expressions for use in vitest "coverage.exclude"
const inactiveBannerGlobs = inactiveBannerFolders.map( folder => path.join( folder, '**' ) );

return {
activeCampaigns,
inactiveCampaignGlobs,
inactiveBannerGlobs,
campaignsWithoutTests,
};
}
17 changes: 4 additions & 13 deletions vitest.campaign.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ const CAMPAIGN_WITHOUT_TEST_HANDLING = 'error';

const {
inactiveCampaignGlobs,
inactiveBannerGlobs,
campaignsWithoutTests
} = getFilterForInactiveCampaigns( 'banners/*/*', 'test/banners/*/*', 'campaign_info.toml' );
campaignsWithoutTests,
} = getFilterForInactiveCampaigns( 'banners/*/*', 'test/banners/*/*', 'campaign_info.toml' );

const outputMissingCampaigns = ( missingCampaigns ) => {
missingCampaigns.forEach( c => console.log( ` ${c}` ) );
Expand All @@ -33,15 +32,7 @@ export default mergeConfig( defaultConfig, defineConfig( {
// It's important to preserve the defaults, otherwise vitest will be looking for tests
// in the wrong places and choke on tests in node_modules
...configDefaults.exclude,
...inactiveCampaignGlobs
...inactiveCampaignGlobs,
],
coverage: {

// Remove this array in 2025, it should inherit from defaultConfig instead.
exclude: [
...defaultConfig.test.coverage.exclude,
...inactiveBannerGlobs,
]
}
}
},
} ) );

0 comments on commit 224813f

Please sign in to comment.