-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
What?
As of #3456 the only difference between base
and extended
compatibility-mode is that extended
adds an alias for global
that points to globalThis
.
This only exists as this was what core-js did and when it was dropped it was readded in #1845.
I don't remember if we had a particular user that complaint about this or not, but it has been a few years and globalThis
is pretty much everywhere.
This also has been known to be used as a test if you are running in a browser or NodeJS like environment - which doesn't usually work great with k6.
Solution
Just stop aliasing it - making base
and extented
the same.
Counter points
The support for this is literally 3 lines
Lines 387 to 392 in 111985b
if b.CompatibilityMode == lib.CompatibilityModeExtended { | |
err = rt.Set("global", rt.GlobalObject()) | |
if err != nil { | |
return err | |
} | |
} |
it doesn't really add much
Arguably removing this will require us to explain why extended and base are the same thing 😅
This being used
The only thing I know about that this is being used for is k6chaijs which is due to dependancy.
https://github.com/chaijs/type-detect which is part of chaijs is using it instead of globalThis
a patch for this has been done years ago, but no new version has been released in 7 years.
chaijs/type-detect#146 asked for it to be bumped few years ago, and it might be good idea for us to go ahead and start this rolling
I would argue that this is blocking this specifically from going forward, but once this is done we can think about it more.