Skip to content

Conversation

@florianhv
Copy link

@florianhv florianhv commented Dec 12, 2025

Fixes #14291

What

Excludes test files from being auto-loaded by the ResourceLoader.

Why

Test files in src/workflows, src/subscribers, or src/jobs cause 'jest is not defined' errors during medusa develop.

Changes

  • Exclude .spec.[jt]s and .test.[jt]s files via regex patterns
  • Exclude files inside tests/ directories

Note

Expand ResourceLoader filtering to skip test files and __tests__/ directories during resource discovery.

  • Framework
    • ResourceLoader (packages/core/framework/src/utils/resource-loader.ts)
      • Expand default #excludes with regexes for test files: /.spec.[jt]s$/, /.test.[jt]s$/.
      • Update discovery filter to ignore entries within __tests__/ directories.
      • Clarify exclude list comment to reference test file patterns.

Written by Cursor Bugbot for commit d16296f. This will update automatically on new commits. Configure here.

Prevents .spec.ts, .test.ts and __tests__/ directories from being loaded
during server startup in src/workflows, src/subscribers, and src/jobs.
Avoids "jest is not defined" errors when test files are co-located.
@florianhv florianhv requested a review from a team as a code owner December 12, 2025 11:16
@changeset-bot
Copy link

changeset-bot bot commented Dec 12, 2025

⚠️ No Changeset found

Latest commit: d16296f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Dec 12, 2025

@florianhv is attempting to deploy a commit to the medusajs Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Test files in src/workflows cause "jest is not defined" errors during startup

2 participants