Comments (6)
@devinivy I think that is overkill.
The number is very unlikely to change during a major, and for majors we usually have to update the globals whitelist anyway.
from lab.
I had a look into this, since I had already encountered the rogue global.
The global was added here to fix nodejs/undici#1331 and nodejs/node#42814. Interestingly, it only appears once some code has tried to use the experimental built-in implementation of fetch()
.
Essentially it allows the user-space undici
package to expose a setGlobalDispatcher()
method, that can customise how the new fetch()
method handles requests.
I guess lab just needs to whitelist Symbol.for('undici.globalDispatcher.1')
to fix this.
from lab.
It's noted in undici that the 1
is technically a version number, and will probably change in the future: https://github.com/nodejs/node/blob/5fad0b93667ffc6e4def52996b9529ac99b26319/deps/undici/src/lib/global.js#L3-L5. Would it be too weird for our automatic safe list to attempt to use fetch()
in a way that eagerly fails? E.g. this usage await fetch()
will fail with ERR_INVALID_URL
but still set the global. This occurs in a worker thread, so I believe it shouldn't affect the globals on the main worker thread:
Lines 112 to 126 in 0542146
from lab.
It's curious that node wants to pollute the global js scope, when it could have been solved by exposing a virtual node:undici
module.
from lab.
I read that they wont consider adding it until fetch()
is no longer experimental.
from lab.
Took a stab at implementation - there's a lazy require of undici
when accessing FormData
(and some other globals), which avoids having to call fetch()
just to get it to throw.
from lab.
Related Issues (20)
- Using the coverage reporter requires "@hapi/eslint-plugin" to be installed, even if itβs not used. HOT 12
- DOMException will be a global in Node.js 17+ HOT 2
- Update linter to work with ESLint 8 HOT 15
- Revise leak detection HOT 2
- Supply AbortController signal to tests HOT 1
- Add built-in TypeScript support
- Lab is not working with import syntax in my project HOT 7
- How to run individual tests: updated docs HOT 1
- tsconfig paths alias HOT 2
- Report "Type T has no properties in common with type U" as a type error
- Allow to specify debugger interface HOT 1
- Lint .mjs (et al) HOT 1
- Uncovered lines in test report HOT 2
- Use diffWordsWithSpace instead of diffWords in the console reporter
- Cannot find module non-relatively imported
- UnhandledPromiseRejectionWarning HOT 11
- Add `.ts` to the default `extensions` for `--lint`
- Babel Preset transform is breaking on updating node version
- coverage-predicates does not work with anonymous functions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lab.