diff --git a/jest.config.js b/jest.config.js index 4ffc0e31..369165f4 100644 --- a/jest.config.js +++ b/jest.config.js @@ -2,6 +2,7 @@ module.exports = { preset: 'ts-jest', testEnvironment: 'jsdom', + setupFiles: ['/setupJest.js'], testPathIgnorePatterns: [ '/node_modules/', '/*.js', diff --git a/package.json b/package.json index b540a424..7d3cb4cb 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,9 @@ "prettier": "^3.4.2", "semantic-release": "^24.2.1", "ts-jest": "^29.2.5", - "typescript": "^5.7.3" + "typescript": "^5.7.3", + "ts-node": "^10.9.2", + "whatwg-fetch": "^3.6.20" }, "peerDependencies": { "next": "^14", diff --git a/setupJest.js b/setupJest.js new file mode 100644 index 00000000..9743a25a --- /dev/null +++ b/setupJest.js @@ -0,0 +1 @@ +const fetch = require("whatwg-fetch") diff --git a/src/provider/public-env-provider.tsx b/src/provider/public-env-provider.tsx index 253fd255..b0a2e30c 100644 --- a/src/provider/public-env-provider.tsx +++ b/src/provider/public-env-provider.tsx @@ -20,10 +20,10 @@ type PublicEnvProviderProps = PropsWithChildren; * * ``` */ -export const PublicEnvProvider: FC = async ({ +export const PublicEnvProvider: FC = ({ children, }) => { - await connection(); // Opt into dynamic rendering + connection(); // Opt into dynamic rendering // This value will be evaluated at runtime const publicEnv = getPublicEnv(); diff --git a/src/script/public-env-script.tsx b/src/script/public-env-script.tsx index 0922619d..e4321c4a 100644 --- a/src/script/public-env-script.tsx +++ b/src/script/public-env-script.tsx @@ -23,8 +23,8 @@ type PublicEnvScriptProps = { * * ``` */ -export const PublicEnvScript: FC = async ({ nonce }) => { - await connection(); // Opt into dynamic rendering +export const PublicEnvScript: FC = ({ nonce }) => { + connection(); // Opt into dynamic rendering // This value will be evaluated at runtime const publicEnv = getPublicEnv(); diff --git a/tsconfig.json b/tsconfig.json index 7150fffb..17152d94 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -23,8 +23,9 @@ "strict": true, "target": "es2022", "rootDir": "src", - "outDir": "build" + "outDir": "build", + "skipLibCheck": true }, - "include": ["src/**/*.ts", "src/**/*.tsx"], + "include": ["next-env.d.ts", "src/**/*.ts", "src/**/*.tsx"], "exclude": ["node_modules", "**/__mocks__/*.ts", "**/*.spec.ts"] }