Skip to content

Commit

Permalink
Allow passing nothing as custom jest config. (vercel#32328)
Browse files Browse the repository at this point in the history
If you don't have any config, currently you need to pass `{}`, which is
less convenient than being able to pass nothing.
  • Loading branch information
midgleyc authored and natew committed Feb 16, 2022
1 parent 6482ab5 commit 8f28c88
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/next/build/jest/jest.ts
Expand Up @@ -46,7 +46,7 @@ module.exports = createJestConfig(customJestConfig)
*/
export default function nextJest(options: { dir?: string } = {}) {
// createJestConfig
return (customJestConfig: any) => {
return (customJestConfig?: any) => {
// Function that is provided as the module.exports of jest.config.js
// Will be called and awaited by Jest
return async () => {
Expand All @@ -68,9 +68,9 @@ export default function nextJest(options: { dir?: string } = {}) {
}
// Ensure provided async config is supported
const resolvedJestConfig =
typeof customJestConfig === 'function'
(typeof customJestConfig === 'function'
? await customJestConfig()
: customJestConfig
: customJestConfig) ?? {}

return {
...resolvedJestConfig,
Expand Down

0 comments on commit 8f28c88

Please sign in to comment.