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

[bug]: Cannot use vitest as UT library #1431

Open
mazzucchelli opened this issue Oct 23, 2023 · 0 comments · Fixed by #1446
Open

[bug]: Cannot use vitest as UT library #1431

mazzucchelli opened this issue Oct 23, 2023 · 0 comments · Fixed by #1446
Labels
issue: bug Issue reporting a bug source: primitives relates to primitives package status: confirmed Confirmed by a Strapi Team member or multiple community members

Comments

@mazzucchelli
Copy link
Contributor

What version of strapi-design-system are you using?

1.12.2

What's Wrong?

vitest consumes mjs bundles which throw these type of errors

Screenshot 2023-10-18 alle 10 06 49

more info: https://github.com/vitest-dev/vitest/discussions/4233types

To Reproduce

Unit test a component containing a SimpleMenu or a Combobox

Expected Behaviour

The design system should be testable using vitest library.

At the moment this issue can be bypassed by updating the export section of the package to use only js files, and not mjs. But it seems an ugly workaround that could damage other consumers of the design system

from

"exports": {
    "./package.json": "./package.json",
    ".": {
      "types": "./dist/index.d.ts",
      "import": "./dist/index.mjs",
      "require": "./dist/index.js",
      "default": "./dist/index.js"
    },
    "./v2": {
      "types": "./dist/v2/index.d.ts",
      "import": "./dist/v2/index.mjs",
      "require": "./dist/v2/index.js",
      "default": "./dist/v2/index.js"
    },
    "./*": "./dist/*"
  },

to

"exports": {
    "./package.json": "./package.json",
    ".": {
      "types": "./dist/index.d.ts",
      "import": "./dist/index.js",
      "require": "./dist/index.js",
      "default": "./dist/index.js"
    },
    "./v2": {
      "types": "./dist/v2/index.d.ts",
      "import": "./dist/v2/index.js",
      "require": "./dist/v2/index.js",
      "default": "./dist/v2/index.js"
    },
    "./*": "./dist/*"
  },
@mazzucchelli mazzucchelli added the issue: bug Issue reporting a bug label Oct 23, 2023
@joshuaellis joshuaellis reopened this Nov 8, 2023
@joshuaellis joshuaellis added status: confirmed Confirmed by a Strapi Team member or multiple community members source: primitives relates to primitives package labels May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: bug Issue reporting a bug source: primitives relates to primitives package status: confirmed Confirmed by a Strapi Team member or multiple community members
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants