-
Notifications
You must be signed in to change notification settings - Fork 27
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
chore: update PostCSS and Stylelint dependencies #2710
Conversation
🦋 Changeset detectedLatest commit: d0c48de The changes in this PR will be included in the next version bump. This PR includes changesets to release 33 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Deploy preview for merchant-center-application-kit ready! ✅ Preview Built with commit d0c48de. |
41a8f5e
to
0b77957
Compare
0b77957
to
d0c48de
Compare
// As we're running tests in `jsdom` environment, the internal logic | ||
// of this package `css-functions-list` relies on some properties in | ||
// the `document` object that are not available. | ||
// Therefore, to keep things simple, we just mock the module, which | ||
// returns the location of a JSON file. | ||
const cssFunctionsListJsonFilePath = path.join( | ||
path.dirname(require.resolve('css-functions-list')), | ||
'index.json' | ||
); | ||
|
||
const location = cssFunctionsListJsonFilePath; |
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.
Kind of "ugly" but it's the "simplest" solution I can think of.
The original error is: The URL must be of scheme file
.
If we look at the css-functions-list
package, we can see how it's implemented:
So wait, that's it? Where is this error coming from?
Well, the screenshot shows the ESM version, if we look at the CJS version we see this:
Notice how it's checking for the existence of the global object document
.
Since the tests in appkit run in jsdom
environment, this document
object is defined but with very limited properties.
In fact, the document.currentScript
and document.baseURI
properties are not defined, which is what causes the The URL must be of scheme file
error.
Therefore, let's just mock this module.
On another note, we might want to look into our testing setup in appkit to maybe have 2 group of tests: one for jsdom
environments and another one for node
environments, as we do have some packages that are Node-only packages.
Extracted from #2623