We would like to assert for exact URLs in the assertMatrix but noticed that the underlying logic matches the RegEx using an AND logic. Here is a trimmed down version of our config:
const budgets = [
{
page: '/',
assertionScore: {
performance: 0.8,
accessibility: 0.9,
'best-practices': 0.7,
seo: 0.9,
},
page: '/some-page',
assertionScore: {
performance: 0.7,
accessibility: 0.9,
'best-practices': 0.7,
seo: 0.9,
},
},
// ... more budgets here based on page
]
module.exports = {
ci: {
collect: {
numberOfRuns: 2,
url: [
'http://localhost:3000/',
'http://localhost:3000/some-page',
'http://localhost:3000/some-other-page',
],
startServerCommand: 'npm start',
},
assert: {
assertMatrix: budgets.map(budget => ({
matchingUrlPattern: `http://localhost:3000${budget.page}`,
assertions: {},
})),
},
upload: {
target: 'temporary-public-storage',
},
},
}
When the CI runs, it runs the first budget / for all the URLs (because of RegEx matching). We want the respective budget to be run for the specific URL only.
Is there a way of specifying exact URLs and running assertions only for those?
It's a regex so
matchingUrlPattern: `http://localhost:3000${budget.page}$`
should work :)
@patrickhulce makes sense, thank you that worked brilliantly! Closing this.
Most helpful comment
It's a regex so
should work :)