File tree 2 files changed +14
-0
lines changed
2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,11 @@ internals.getNodeGlobals = async () => {
118
118
} ;
119
119
120
120
if ( ! WorkerThreads . isMainThread ) {
121
+
122
+ // Accessing FormData does a lazy require of undici inside Node.js 18+, which in turn exposes
123
+ // the `Symbol(undici.globalDispatcher.1)`. In earlier Node.js versions this is a no-op.
124
+ typeof FormData ;
125
+
121
126
// When this module is used as a worker, it posts back global property names and symbols
122
127
WorkerThreads . parentPort . postMessage ( {
123
128
allowed : Object . getOwnPropertyNames ( globalThis ) ,
Original file line number Diff line number Diff line change @@ -153,6 +153,15 @@ describe('Leaks', () => {
153
153
expect ( leaks . length ) . to . equal ( 0 ) ;
154
154
} ) ;
155
155
156
+ it ( 'ignores undici global' , async ( ) => {
157
+
158
+ // trigger a lazy require of Undici, where supported, to expose a `Symbol(undici.globalDispatcher.1)`
159
+ typeof FormData ;
160
+
161
+ const leaks = await Lab . leaks . detect ( ) ;
162
+ expect ( leaks . length ) . to . equal ( 0 ) ;
163
+ } ) ;
164
+
156
165
it ( 'identifies custom globals' , async ( ) => {
157
166
158
167
testedKeys . push ( 'abc' ) ;
You can’t perform that action at this time.
0 commit comments