-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(gatsby): Remove default support for non ESM browsers #36522
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add tests to packages/gatsby/src/utils/__tests__/browserslist.js
?
Co-authored-by: Ward Peeters <[email protected]>
Co-authored-by: Ward Peeters <[email protected]>
@@ -28,7 +28,14 @@ describe(`browserslist`, () => { | |||
|
|||
const list = getBrowsersList(BASE) | |||
|
|||
expect(list).toEqual([`>0.25%`, `not dead`]) | |||
if (_CFLAGS_.GATSBY_MAJOR === `5`) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we'll ever get to this point in the tests. Given that CFLAGS are environmental set by the compiler, they won't exist in the tests. I could be wrong, but either way, we won't ever be testing both cases.
Can we add a _CFLAGS_
mock to the setup/teardown? This might need some tweaking, but something like:
let originalCflags
beforeEach(() => {
originalCflags = _CFLAGS_
# TODO set up mock vars, set them in tests, etc
_CFLAGS_ = {...}
})
afterEach(() => {
_CFLAGS_ = originalCflags
})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do pass in CFLAGS flags to test with babel-preset-gatsby-package
.
My thinking is that we'll eventually remove the else block since we'll never hit that when the compile flags becomes 5
cc - @wardpeet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh ok. I won't push too hard on it because the logic is simple, but I'd prefer to have full logic coverage even before the Gatsby 5 launch.
Description
Drop default support for non-esm browsers in v5
[sc-52423]