medusajs / medusa

Building blocks for digital commerce
https://medusajs.com
MIT License
24.72k stars 2.44k forks source link

Integration tests don't sync custom links + get-port missing #9199

Open jakub-borek opened 3 days ago

jakub-borek commented 3 days ago

Bug report

Integration tests don't execute custom links, only core medusa links. Also get-port dependency seems missing.

Describe the bug

I've created basic integration tests based on documentation and code from medusa repository integration-tests.

My modules migrations are executed correctly, however custom links I've created are skipped. I executed this code block in my integration test, which solved the issue, but of course it would be nice if it worked natively:

beforeAll(async () => {
    /* Execute custom links, as default links creator doesn't see them for some reason */
    const appLoader = new MedusaAppLoader();
    const planner = await appLoader.getLinksExecutionPlanner();
    const actionPlan = await planner.createPlan();
    await planner.executePlan(actionPlan);
});

Also dependency get-port is missing. It's strange, but it doesn't load usin yarn install, even though it's present in dependencies of medusa-test-utils. Integration tests work after I've executed yarn add --dev get-port@^5.1.0.

System information

Medusa version (including plugins): 2.0 preview from 19.09.2024r. Node.js version: 20.16.0 Database: PostgreSQL Operating system: Windows 10 Browser (if relevant): -

Steps to reproduce the behavior

  1. Create custom link in /src/links
  2. Create integration test
  3. yarn build and run integration tests
  4. See error - logs from sync link don't include custom link table, and trying to fetch entity with linked table will throw error in tests.

Expected behavior

Custom links should be automatically included in integration tests. Get-port dependency should be automatically installed.

adrien2p commented 3 hours ago

Hi @jakub-borek ,

The get-port dependency has been fixed end of last week. For the custom links loading, I ve just created a pr on which I will generate a snapshot 👍 thanks for the report