Skip to content

jest.config.ts's transformIgnorePatterns: [] transforms the entirety of node_modules on every test run, materially slowing down the suite #251

Closed

Description

@chonilius

jest.config.ts sets:

transformIgnorePatterns: [],

with a comment explaining the reasoning: react-markdown's dependency tree
(remark/rehype/unified/hast/mdast/micromark) is ESM-only and too deep to allowlist
package-by-package, so the file opts to transform all of node_modules rather than
maintain a brittle allowlist.

This is a reasonable tradeoff for correctness, but its performance cost is broader than
just the packages that actually need it: every test run now asks Babel/ts-jest to
transform every single package under node_modules that gets require()'d during the
suite — including packages that are already plain CommonJS and need no transformation at
all (e.g. clsx, tailwind-merge) — rather than only the ESM-only markdown toolchain
that motivated the change. For a suite that currently runs in CI (once wired in — see the
related "CI never runs npm test" issue) and locally on every test:watch iteration, this
adds unnecessary transform overhead to files that were never the problem.

Suggested fix: replace the blanket [] with a targeted negative-lookahead pattern that
excludes only the ESM packages that actually need transforming (e.g.
"node_modules/(?!(react-markdown|remark-.*|rehype-.*|unified|hast-.*|mdast-.*|micromark.*|vfile.*|unist-.*|bail|is-plain-obj|trough|zwitch|longest-streak|ccount|escape-string-regexp|markdown-table|trim-lines|decode-named-character-reference|character-entities.*)/)"),
so only the packages that genuinely require it pay the transform cost.

Activity

  1. added
    performance
    bug
    very hard
    help wanted
    on Aug 21, 2026
  2. added
    Stellar Wave
    on Aug 25, 2026
  3. victordice486-hub commented on Aug 25, 2026

    @victordice486-hub

    @victordice486-hub has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    Hello, I’d like to contribute to this issue and would appreciate the opportunity to work on it. Thank you.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @victordice486-hub to this issue.

  4. JinadJay commented on Aug 25, 2026

    @JinadJay

    @JinadJay has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    Transforming the entirety of node_modules on every test run creates a massive performance bottleneck, severely dragging down both local test:watch iterations and the CI pipeline just to accommodate a few ESM-only packages.

    If assigned, I will refactor jest.config.ts to replace the blanket [] configuration with a highly optimized negative-lookahead regex pattern. I’ll ensure this pattern selectively targets only the react-markdown toolchain—including remark, rehype, unified, and their nested dependencies—so that pre-compiled CommonJS packages completely bypass the Babel/ts-jest transform step.

    I will rigorously test the new configuration locally to confirm the test suite executes smoothly without throwing any ESM import errors, while ensuring a noticeable reduction in overall test execution time.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @JinadJay to this issue.

  5. alansamdev commented on Aug 25, 2026

    @alansamdev
    Contributor

    @alansamdev has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    Hello, I’d like to contribute to this issue

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @alansamdev to this issue.

  6. drips-wave commented on Aug 25, 2026

    @drips-wave

    Congratulations, @alansamdev! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on August 31, 2026.

    🧑‍💻 @alansamdev: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

    Warning

    When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

    🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

    🌊 Happy Wave 🌊

  7. drips-wave commented on Aug 25, 2026

    @drips-wave

    This issue has been completed by @alansamdev as part of the Stellar Wave Program's 8th Wave 🥳

    😎 @alansamdev: You earned 200 Points for completing this issue! After the current Wave ends, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.

    🧑‍💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.

  8. removed
    Stellar Wave
    on Oct 15, 2026
  9. added
    Stellar Wave
    on Oct 15, 2026
  10. removed
    Stellar Wave
    on Oct 15, 2026
  11. added
    Stellar Wave
    on Oct 15, 2026
  12. removed
    Stellar Wave
    on Oct 15, 2026
  13. added
    Stellar Wave
    on Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar Wavebughelp wantedperformancevery hard

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions