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
When running integration tests with the command: yarn test:integration:http
the following error occurs:
FAIL integration-tests/http/health.spec.ts (7.517 s)
Ping
✕ ping the server health endpoint (262 ms)
● › Ping › ping the server health endpoint
Cannot find module 'src/workflows/link-order-to-store' from 'src/subscribers/order-placed.ts'
Require stack:
src/subscribers/order-placed.ts
node_modules/@medusajs/utils/dist/common/dynamic-import.js
node_modules/@medusajs/utils/dist/common/index.js
node_modules/@medusajs/utils/dist/auth/token.js
node_modules/@medusajs/utils/dist/auth/index.js
node_modules/@medusajs/utils/dist/index.js
node_modules/@medusajs/framework/dist/utils/index.js
node_modules/@medusajs/test-utils/dist/init-modules.js
node_modules/@medusajs/test-utils/dist/index.js
integration-tests/http/health.spec.ts
The integration test fails to resolve the path for src/workflows/link-order-to-store when imported in src/subscribers/order-placed.ts.
However, the issue does not occur when running the project using: yarn dev
or when building the project with: yarn build
Changing the import statement in src/subscribers/order-placed.ts from: import { linkOrderToStoreWorkflow } from "src/workflows/link-order-to-store";
to: import { linkOrderToStoreWorkflow } from "../workflows/link-order-to-store";
resolves the issue, and the integration tests pass successfully.
This problem is also reproducible with other files and imports using absolute paths.
Expected behavior
The integration tests should resolve modules using absolute imports (e.g., src/...) without errors, consistent with how the project runs via yarn dev and yarn build.
Actual behavior
Integration tests fail to resolve modules imported using absolute paths, resulting in a "Cannot find module" error. Changing the imports to relative paths resolves the issue.
Link to reproduction repo
The text was updated successfully, but these errors were encountered:
Package.json file
Node.js version
v20.16.0
Database and its version
PostgreSQL 15.3-alpine
Operating system name and version
MacOS Sonoma 14.3
Browser name
No response
What happended?
When running integration tests with the command:
yarn test:integration:http
the following error occurs:
The integration test fails to resolve the path for
src/workflows/link-order-to-store
when imported insrc/subscribers/order-placed.ts
.However, the issue does not occur when running the project using:
yarn dev
or when building the project with:
yarn build
Changing the import statement in src/subscribers/order-placed.ts from:
import { linkOrderToStoreWorkflow } from "src/workflows/link-order-to-store";
to:
import { linkOrderToStoreWorkflow } from "../workflows/link-order-to-store";
resolves the issue, and the integration tests pass successfully.
This problem is also reproducible with other files and imports using absolute paths.
Expected behavior
The integration tests should resolve modules using absolute imports (e.g.,
src/...
) without errors, consistent with how the project runs viayarn dev
andyarn build
.Actual behavior
Integration tests fail to resolve modules imported using absolute paths, resulting in a "Cannot find module" error. Changing the imports to relative paths resolves the issue.
Link to reproduction repo
The text was updated successfully, but these errors were encountered: