-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 node-build-scripts-test failing in validate #6934
Conversation
Generate changelog in
|
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = dirname(__filename); |
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.
Does __dirname
need to be defined? Curious if this works without it?
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.
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.
Oh I see. It looks like that's because we're already opting into Jest's ESM support based on the node:80071
warning. It makes sense that __dirname
(a CommonJS feature) isn't available given that. Thanks for trying.
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.
Thank you @ggdouglas!
Fixes #6926
Checklist
Changes proposed in this pull request:
This PR resolves failing tests encountered while running the introductory
yarn validate
command (from the README).The "fix" involved here replaces the use of
import.meta.dirname
incssVariables.test.ts
with an alternative method of accessing the current folder path. This method was considered one of the ways to expose__dirname
in an ES module prior to it being added in v20.11.0 (see this article for more context).For some reason,
import.meta.dirname
isundefined
when running the test scripts. According to the docs it should be there. The typings assume that it is, but in reality onlyimport.meta.url
is defined.It might be worth investigating why the build system doesn't expose these variables at runtime when they're supposed to exist. Perhaps there is something deeper in webpack config that needs addressing.
I did not encounter the scrollbar test flake described in #6926, so those tests are not addressed here.