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
Pre-configured integration tests from npx create-medusa do not work when registering a local module.
When I registered a local "auction" module, integration tests started failing with this error:
FAIL integration-tests/http/health.spec.ts
Ping
✕ ping the server health endpoint (30 ms)
● › Ping › ping the server health endpoint
Cannot find module '/Users/derekwene/src/uplabs/lambda/apps/medusa2/dist/modules/auction'
Require stack:
- /Users/derekwene/src/uplabs/lambda/apps/medusa2/noop.js
at resolveFileName (../../node_modules/resolve-from/index.js:29:39)
at resolveFrom (../../node_modules/resolve-from/index.js:43:9)
at Object.<anonymous>.module.exports (../../node_modules/resolve-from/index.js:46:47)
at Object.<anonymous>.module.exports (../../node_modules/resolve-cwd/index.js:4:30)
at getInternalModuleResolution (node_modules/@medusajs/modules-sdk/src/loaders/register-modules.ts:157:37)
Bug report
Describe the bug
Pre-configured integration tests from npx create-medusa do not work when registering a local module.
When I registered a local "auction" module, integration tests started failing with this error:
I believe the issue is with this file:
https://github.com/medusajs/medusa/blob/develop/packages/core/utils/src/common/normalize-import-path-with-source.ts#L19
Since Jest is running these tests without
ts-node
it's incorrectly usingdist
instead ofsrc
.System information
Medusa version (including plugins): 2 RC latest
Node.js version: 20
Database: Postgres
Operating system: OSX
Browser (if relevant):
Steps to reproduce the behavior
Run npx create-medusa-app@rc
Setup a custom module of any kind.
Try to run
npm test:integration:http
Notice you get an error about failing to import module under
${CWD}/dist/${modulePath}
Expected behavior
Integration tests should pass.
Screenshots
Code snippets
https://github.com/medusajs/medusa/blob/develop/packages/core/utils/src/common/normalize-import-path-with-source.ts#L19
Additional context
The text was updated successfully, but these errors were encountered: