shopware / jest-preset-sw6-admin

Jest Test preset for Shopware 6 administration unit tests
MIT License
4 stars 2 forks source link

Could not locate module @shopware-ag/admin-extension-sdk/es/data/Criteria mapped as: @shopware-ag/admin-extension-sdk/umd$1. #140

Open rammi22 opened 1 year ago

rammi22 commented 1 year ago

I use for develop custom plugin the shyim shopware-docker.

A extended description of the error is available on https://stackoverflow.com/questions/75462004/shopware-6-jest-unit-test-setup-failed-with-configuration-error-could-not-loca

The moduleNameMapper failed on import [...]criteria.data.js with error:

 FAIL  src/sum.spec.js
  ● Test suite failed to run

    Configuration error:

    Could not locate module @shopware-ag/admin-extension-sdk/es/data/Criteria mapped as:
    @shopware-ag/admin-extension-sdk/umd$1.

    Please check your configuration for these entries:
    {
      "moduleNameMapper": {
        "/^@shopware-ag\/admin-extension-sdk\/es(.*)$/": "@shopware-ag/admin-extension-sdk/umd$1"
      },
      "resolver": undefined
    }

    > 1 | import Criteria from '@shopware-ag/admin-extension-sdk/es/data/Criteria';
        | ^
      2 |
      3 | // eslint-disable-next-line sw-deprecation-rules/private-feature-declarations
      4 | export default Criteria;

      at createNoMappedModuleFoundError (node_modules/jest-resolve/build/resolver.js:759:17)
      at Object.<anonymous> (../../../../../../../../src/Administration/Resources/app/administration/src/core/data/criteria.data.ts:1:1)
      at Object.<anonymous> (../../../../../../../../src/Administration/Resources/app/administration/src/core/data/index.js:2:1)
      at Object.<anonymous> (../../../../../../../../src/Administration/Resources/app/administration/src/core/shopware.ts:34:1)
      at Object.<anonymous> (node_modules/@shopware-ag/jest-preset-sw6-admin/@tool/setup-env-for-shopware.js:10:18)
rammi22 commented 1 year ago

Solution https://stackoverflow.com/a/75571063/2702011