Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/gatsby-plugin-sitemap/src/__tests__/options-validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ describe(`pluginOptionsSchema`, () => {
expect(errors).toEqual(expectedErrors)
})

it(`should provide error for deprecated "exclude" option`, async () => {
const expectedErrors = [
`As of v4 the \`exclude\` option was renamed to \`excludes\``,
]

const { errors } = await testPluginOptionsSchema(pluginOptionsSchema, {
exclude: [`test`],
})

expect(errors).toEqual(expectedErrors)
})

it(`creates correct defaults`, async () => {
const pluginOptions = await pluginOptionsSchema({ Joi }).validateAsync({})

Expand Down
3 changes: 3 additions & 0 deletions packages/gatsby-plugin-sitemap/src/options-validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ export const pluginOptionsSchema = ({ Joi }) =>
enter other data types into this array for custom filtering.
Doing so will require customization of the \`filterPages\` function.`
),
exclude: Joi.forbidden().messages({
"any.unknown": `As of v4 the \`exclude\` option was renamed to \`excludes\``,
}),
resolveSiteUrl: Joi.function()
.default(() => resolveSiteUrl)
.description(
Expand Down