You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running tests with Jest on a plugin that imports a class from another custom plugin results in the following error:
Test suite failed to run
Jest encountered an unexpected token
Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.
Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.
By default "node_modules" folder is ignored by transformers.
Here's what you can do:
• If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it.
• If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript
• To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
• If you need a custom transformation specify a "transform" option in your config.
• If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.
Details:
/home/carloscarniatto/Projects/Aurelia/FrontEnd/ig-components/node_modules/.pnpm/@intrigest+core@5.2.1/node_modules/@intrigest/core/src/utils/utils-dates.ts:2
import { es } from "date-fns/locale";
^^^^^^
SyntaxError: Cannot use import statement outside a module
The error occurs in the following code:
import { UtilsDates } from '@intrigest/core/src/utils/utils-dates';
💁 Possible Solution
I have already tried the following Jest configuration, but it did not resolve the issue:
Here’s the revised bug report in English, incorporating the fact that the suggested Jest configuration did not resolve the issue:
🐛 Bug Report
Repro link:
🤔 Expected Behavior
When creating a custom plugin that depends on another custom plugin, the test suite should run without throwing parsing or configuration errors.
😯 Current Behavior
Running tests with Jest on a plugin that imports a class from another custom plugin results in the following error:
The error occurs in the following code:
💁 Possible Solution
I have already tried the following Jest configuration, but it did not resolve the issue:
Other possible solutions to explore:
Add a more advannced Test Example🔦 Context
This issue prevents the execution of tests, blocking development and validation of features that depend on custom plugins.
💻 Code Sample
🌍 Your Environment
Let me know if you want to adjust anything or include additional details!
The text was updated successfully, but these errors were encountered: