Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jest only handles 1 project even though it has multiple projects in the projects array #8423

Closed
pragmaticivan opened this issue May 6, 2019 · 9 comments

Comments

@pragmaticivan
Copy link

pragmaticivan commented May 6, 2019

馃悰 Bug Report

Jest only handles 1 project even though it has multiple projects on projects array

To Reproduce

jest.config.js

module.exports = {
  projects: [
    {
      displayName: "RN Tests",
      preset: "react-native",
      collectCoverage: true,
      collectCoverageFrom: ["<rootDir>/react/**/*.{ts|tsx}"],
      coverageDirectory: "coverage",
      coveragePathIgnorePatterns: ["/node_modules/"],
      coverageReporters: ["json", "lcov", "text", "clover"],
      coverageThreshold: {
        global: {
          branches: 60,
          functions: 60,
          lines: 60,
          statements: -10
        }
      },
      globals: {
        "ts-jest": {
          diagnostics: false
        }
      },
      moduleFileExtensions: ["ts", "tsx", "js"],
      transform: {
        "^.+\\.(js)$":
          "<rootDir>/node_modules/react-native/jest/preprocessor.js",
        "\\.(ts|tsx)$": "ts-jest"
      },
      testPathIgnorePatterns: ["\\.snap$", "<rootDir>/node_modules/"],
      cacheDirectory: ".jest/cache",
      moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"]
    },
    {
      displayName: "TSLint",
      runner: "jest-runner-tslint",
      moduleFileExtensions: ["ts", "tsx"],
      testPathIgnorePatterns: ["<rootDir>/react/@types"],
      testMatch: ["<rootDir>/react/**/*.{ts|tsx}"]
    }
  ]
};

Expected behavior

It was working on previous versions. So it should still be able to perform general jest tests + tslint runner.

Run npx envinfo --preset jest

Paste the results here:

  System:
    OS: macOS 10.14.4
    CPU: (8) x64 Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
  Binaries:
    Node: 10.13.0 - /usr/local/bin/node
    Yarn: 1.10.1 - /usr/local/bin/yarn
    npm: 6.9.0 - /usr/local/bin/npm
  npmPackages:
    jest: 24.8.0 => 24.8.0
@pragmaticivan pragmaticivan changed the title Jest only handles 1 project even though it has multiple projects on projects array Jest only handles 1 project even though it has multiple projects in the projects array May 6, 2019
@pragmaticivan
Copy link
Author

I was able to narrow down the problem to this line testMatch: ["<rootDir>/react/**/*.{ts|tsx}"]. Conveting that to testMatch: ["<rootDir>/react/**/*.tsx", "<rootDir>/react/**/*.ts"]

@scotthovestadt
Copy link
Contributor

Code I recently changed related to this: #7498

It's an additional condition and the code path for multiple projects looks completely unaffected. Maybe a different change caused an issue?

How can I reproduce an issue with it? If you give me a minimal repro that works on Jest 24.7 and fails onn 24.8 I will definitely fix it and release a fix for you.

I just checked the following and cannot reproduce:

  1. jest --all works and triggered tests from multiple projects.
  2. jest test_name works and triggered tests from multiple projects.

@scotthovestadt
Copy link
Contributor

Oh, that's interesting. @SimenB do you remember any change to the glob/regex parsing there?

@pragmaticivan
Copy link
Author

pragmaticivan commented May 6, 2019

Not sure if we had some changes on testMatch glob system but I'm pretty sure that used to work before in another version. This change has fixed my problem btw.

@SimenB
Copy link
Member

SimenB commented May 6, 2019

@pragmaticivan what version did you upgrade from? The only change to glob parsing I know of is from upgrading Micromatch, which landed as a major change in 24.0.0...

If you upgraded from 24.7.1 (or some other 24 minor), could you put together a reproduction? Easiest would probably be to revert your jest upgrade (so you get a lockfile with your old dependencies), delete as much as possible from your project while still showing the error then push that up

@Robinfr
Copy link

Robinfr commented Mar 11, 2020

I can confirm this broke for us when upgrading from 24.x to 25.1.0.

@github-actions
Copy link

This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the Stale label Feb 17, 2023
@github-actions
Copy link

This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 19, 2023
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants