TypeError: (0 , _config.default) is not a function no Jest

O problema

Na tentativa de mockar o método getConfig do next/config recebi o seguinte erro:

TypeError: (0 , _config.default) is not a function

Repare que o TypeError fala que não encontrou um método default.

Nesse momento eu estava utilizando o seguinte mock:

jest.mock("next/config", () => ({
  ...jest.requireActual("next/config"),
  getConfig: () => ({
    publicRuntimeConfig: {
      enabled: "true",
      siteKey: "xablau",
    },
  }),
}));

O problema foi resolvido quando alterei o mock para:

jest.mock("next/config", () => ({
  __esModule: true,
  default: () => ({
    publicRuntimeConfig: {
      recaptcha: {
        enabled: "true",
        siteKey: "xablau",
      },
    },
  }),
}));

Explicação

Dependências e versões

"next": "^12.3.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"@testing-library/jest-dom": "^6.1.3",
"@testing-library/react": "^14.0.0",
"jest": "^26.0.1",