Skip to content
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

Merged
merged 3 commits into from
Jul 15, 2022

Conversation

emmenko
Copy link
Member

@emmenko emmenko commented Jul 14, 2022

Extracted from #2623

@changeset-bot
Copy link

changeset-bot bot commented Jul 14, 2022

🦋 Changeset detected

Latest commit: d0c48de

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 33 packages
Name Type
@commercetools-frontend/jest-stylelint-runner Patch
@commercetools-frontend/mc-scripts Patch
merchant-center-application-template-starter-typescript Patch
merchant-center-application-template-starter Patch
playground Patch
@commercetools-backend/eslint-config-node Patch
@commercetools-backend/express Patch
@commercetools-backend/loggers Patch
@commercetools-frontend/actions-global Patch
@commercetools-frontend/application-components Patch
@commercetools-frontend/application-config Patch
@commercetools-frontend/application-shell-connectors Patch
@commercetools-frontend/application-shell Patch
@commercetools-frontend/assets Patch
@commercetools-frontend/babel-preset-mc-app Patch
@commercetools-frontend/browser-history Patch
@commercetools-frontend/constants Patch
@commercetools-frontend/create-mc-app Patch
@commercetools-frontend/cypress Patch
@commercetools-frontend/eslint-config-mc-app Patch
@commercetools-frontend/i18n Patch
@commercetools-frontend/jest-preset-mc-app Patch
@commercetools-frontend/l10n Patch
@commercetools-frontend/mc-dev-authentication Patch
@commercetools-frontend/mc-html-template Patch
@commercetools-frontend/notifications Patch
@commercetools-frontend/permissions Patch
@commercetools-frontend/react-notifications Patch
@commercetools-frontend/sdk Patch
@commercetools-frontend/sentry Patch
@commercetools-frontend/url-utils Patch
@commercetools-local/visual-testing-app Patch
@commercetools-website/components-playground Patch

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

@github-actions
Copy link
Contributor

github-actions bot commented Jul 14, 2022

Deploy preview for merchant-center-application-kit ready!

✅ Preview
https://merchant-center-application-rihqa3ie5-commercetools.vercel.app
https://appkit-sha-a25517dc3ffd6b483283905947e02eaed67b17c5.commercetools.vercel.app
https://appkit-pr-2710.commercetools.vercel.app

Built with commit d0c48de.
This pull request is being automatically deployed with vercel-action

Comment on lines +3 to +13
// 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;
Copy link
Member Author

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:

image

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:

image

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.

@emmenko emmenko merged commit b34b0a4 into main Jul 15, 2022
@emmenko emmenko deleted the nm-deps-postcss-stylelint branch July 15, 2022 10:13
@ghost ghost mentioned this pull request Jul 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖 Type: Dependencies Dependency updates or something similar
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants