Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing nothing as custom jest config #32328

Merged
merged 3 commits into from Feb 6, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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