Skip to content

🚀 Feature Request: Track dependencies, that make tests and wallaby slow #3649

Description

@willi84

Issue description or question

I noticed something while using Wallaby on my slower machine:

When Wallaby starts taking noticeably longer to give me feedback after changing a test, I immediately know that I probably have a slow test somewhere that has become a performance bottleneck.
Image Image
(before / after => init was too slow)

💡 This made me wonder: could this become an additional USP for Wallaby?

Wallaby already knows a lot about test execution and timing. It would be great if it could not only show which tests are slow, but also help identify typical reasons why they are slow and point to the code that could be optimized.

Typical bottlenecks could be things like:

  • 📁 File system access
  • 🌐 Real network requests
  • 📝 Excessive console.log calls
  • 📦 Processing unnecessarily large amounts of files/data
  • Other I/O or dependencies that should probably be mocked

Ideally, Wallaby could point directly to suspicious code and provide a hint about how the testability/performance could be improved.

For example, imagine code like this (pseudocode):

function myFunction() {
  const data = execSync('curl -I github.com');
  // ...
}

If this function is executed by multiple tests, it performs a real network request every time.

Wallaby could detect this and show something like:

⚠️ Potential performance bottleneck: this code performs an external network request during test execution. Consider wrapping the request in a separate function and mocking it in your tests.

or visually

Image

The difference to a performance budget should be the tracking of bottle necks

Code Sample

For example, refactoring it to:

function myFunction() {
  const data = getResponse('curl -I github.com');
  // ...
}

would allow the dependency to be mocked:

jest.spyOn(MODULE, 'getResponse').mockReturnValue(returnValue);

myFunction();

Background

This could make Wallaby useful not only for showing how long a test takes, but also for answering:

"Why is my test slow, and where could I optimize it?"

Especially with AI-generated tests becoming more common, this could be useful because generated tests may work correctly while still introducing unnecessary dependencies or expensive operations.

Wallaby's immediate feedback loop already makes performance issues very noticeable. Turning that information into actionable performance/testability hints could be a really useful feature.

Wallaby diagnostics report

Not applicable — this is a feature suggestion rather than an issue with a specific Wallaby configuration.

note

Issue optimized with AI.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions