Skip to content

Commit 6f60237

Browse files
ortagatsbybotLekoArts
authored
fix(gatsby-plugin-sitemap): Add plugin options forbidden for deprecated exclude (#32509)
Co-authored-by: gatsbybot <[email protected]> Co-authored-by: LekoArts <[email protected]>
1 parent 4d36328 commit 6f60237

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

packages/gatsby-plugin-sitemap/src/__tests__/options-validation.js

+12
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,18 @@ describe(`pluginOptionsSchema`, () => {
1212
expect(errors).toEqual(expectedErrors)
1313
})
1414

15+
it(`should provide error for deprecated "exclude" option`, async () => {
16+
const expectedErrors = [
17+
`As of v4 the \`exclude\` option was renamed to \`excludes\``,
18+
]
19+
20+
const { errors } = await testPluginOptionsSchema(pluginOptionsSchema, {
21+
exclude: [`test`],
22+
})
23+
24+
expect(errors).toEqual(expectedErrors)
25+
})
26+
1527
it(`creates correct defaults`, async () => {
1628
const pluginOptions = await pluginOptionsSchema({ Joi }).validateAsync({})
1729

packages/gatsby-plugin-sitemap/src/options-validation.js

+3
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ export const pluginOptionsSchema = ({ Joi }) =>
7474
enter other data types into this array for custom filtering.
7575
Doing so will require customization of the \`filterPages\` function.`
7676
),
77+
exclude: Joi.forbidden().messages({
78+
"any.unknown": `As of v4 the \`exclude\` option was renamed to \`excludes\``,
79+
}),
7780
resolveSiteUrl: Joi.function()
7881
.default(() => resolveSiteUrl)
7982
.description(

0 commit comments

Comments
 (0)