From f6ce02a0da8ee58ffe42fa3efcaba823368b9e38 Mon Sep 17 00:00:00 2001 From: Chris Midgley Date: Thu, 9 Dec 2021 16:23:52 +0000 Subject: [PATCH] Allow passing nothing as custom jest config. If you don't have any config, currently you need to pass `{}`, which is less convenient than being able to pass nothing. --- packages/next/build/jest/jest.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/next/build/jest/jest.ts b/packages/next/build/jest/jest.ts index 644d5cd115e1749..3b1f1e0ac9b324a 100644 --- a/packages/next/build/jest/jest.ts +++ b/packages/next/build/jest/jest.ts @@ -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 () => { @@ -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,