File tree 1 file changed +11
-3
lines changed
1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -76,9 +76,17 @@ export const createFixture = async (fixture: string, ctx: FixtureTestContext) =>
76
76
// invocations would not use fetch-cache at all - this restores the original fetch
77
77
// and makes globalThis.fetch.__nextPatched falsy which will allow Next.js to apply
78
78
// needed patch
79
- // @ts -ignore fetch doesn't have __nextPatched property in types
80
- if ( globalThis . fetch . __nextPatched && globalThis . _nextOriginalFetch ) {
81
- globalThis . fetch = globalThis . _nextOriginalFetch
79
+ if (
80
+ // @ts -ignore fetch doesn't have __nextPatched property in types
81
+ globalThis . fetch . __nextPatched &&
82
+ // before https://github.com/vercel/next.js/pull/64088 original fetch was set on globalThis._nextOriginalFetch
83
+ // after it it is being set on globalThis.fetch._nextOriginalFetch
84
+ // so we check both to make sure tests continue to work regardless of next version
85
+ // @ts -ignore fetch doesn't have _nextOriginalFetch property in types
86
+ ( globalThis . _nextOriginalFetch || globalThis . fetch . _nextOriginalFetch )
87
+ ) {
88
+ // @ts -ignore fetch doesn't have _nextOriginalFetch property in types
89
+ globalThis . fetch = globalThis . _nextOriginalFetch || globalThis . fetch . _nextOriginalFetch
82
90
}
83
91
84
92
ctx . cwd = await mkdtemp ( join ( tmpdir ( ) , 'netlify-next-runtime-' ) )
You can’t perform that action at this time.
0 commit comments