question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[bug] findRelatedTests misses tests, especially in multi-project setups

See original GitHub issue

Do you want to request a feature or report a bug?

bug

What is the current behavior?

Here’s an absolute minimal repo that explains this same test case and can be run directly: https://github.com/paularmstrong/jest-multi-project-example

  1. Clone the repo at https://github.com/paularmstrong/jest-multi-project-example
  2. Run yarn to install dependencies
  3. Run yarn test to ensure tests run
  4. Run yarn test --findRelatedTests --listTests projects/bar/bar.js (test is a package script shortcut to jest)

Expectation

We should expect to see the following files as related in the output:

projects/bar/__tests__/index.test.js
projects/foo/__tests__/index.test.js

Actual results

Jest does not appear to resolve related changes across project configurations and we do no receive any listed tests.

Alternatively

If we run yarn test --findRelatedTests --listTests projects/bar/index.js, we do receive only the file for the direct project, bar.

projects/bar/__tests__/index.test.js

Why this is problematic

This is a problem because if we are in a sufficiently large project with many workspaces and many interdependencies, we may make a change to one file in a single workspace and expect to be able to run only the related tests for that change, but none will be run.

We could argue that we should just run all tests, but this can take too long (15+ minutes) to realistically ask people to do every time they make a change.

Environment

Environment:
  OS:  macOS High Sierra 10.13.4
  Node:  8.11.1
  Yarn:  1.6.0
  npm:  5.6.0
  Watchman:  4.7.0
  Xcode:  Xcode 8.1 Build version 8B62
  Android Studio:  Not Found

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:8
  • Comments:15 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
paularmstrongcommented, Jun 8, 2018

I meant that when we see a require(‘module’), I’m not sure if we follow module if it’s a symbolic link, thus pick up if its source changes.

That sounds like a workable solution! I have some time next week to look in and attempt this if you’re not already planning on it.

0reactions
github-actions[bot]commented, Apr 29, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jest --findRelatedTests not finding related test - Stack Overflow
I ran into this issue and found it was because I was using the roots option in my jest configuration and was only...
Read more >
A Testers Guide to Deal with Missed Bugs - Testsigma
Every software tester would have come across a situation of a missed bug in software testing. For many testers, it's a terrifying nightmare....
Read more >
Jest 20: Delightful Testing & Multi-Project-Runner
Beyond Painless JavaScript Testing, we believe Jest is now delivering ... smaller projects that each have their own setup and configuration.
Read more >
Monorepo testing using jest projects - Orlando Bayo Adeyemi
Having to cd into every directory and run tests for each project is time consuming, and you miss out on unified coverage report....
Read more >
5 Common Bugs Faced in UI Testing - BrowserStack
Knowing them will help the QA community ensure that they do not miss out on detecting and resolving them while performing their next...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found