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.

Apply appropriate configs for different tests ran as different projects

See original GitHub issue

Hi Guys. Seems projects doesn’t work as intended. I have jest config which is intended to run all my type of tests:

module.exports = {
    projects: ['./jest.config.ui.js', './jest.config.unit.js']
};

It is impossible that file of unit tests would be grabbed by ui tests, see regex: ui: testRegex: '/__tests__/.*-test\\.js?$', unit: testMatch: ['**/__tests__/**/?(*.)+(spec).js']

These ui and unit configs have different setups. For example for ui tests I need to resolve all css files successfully, I do this via:

 moduleNameMapper: {
        '\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
            './resources/__mocks__/fileMock.js',
        '\\.(css|sass|scss|less)$': 'identity-obj-proxy'
    },

unit tests config doesn’t have this setup.

So, when I run ui and unit tests separately - all good. When I try to run all tests config - I see that moduleNameMapper doesn’t work for ui tests.

3

In total, expected behaviour: File which is found for UI test should be executed with the help of appropriate config.

UPD: DEMO To see behavior please clone repo https://github.com/deser/jest_issue-7268 and follow steps in README.md

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
wilkinsonjack1993commented, Jan 25, 2019

Also experiencing similar issues, projects basically does not work.

0reactions
github-actions[bot]commented, May 2, 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 only runs single project when specifying two config.js
I have tried removing jest.component.config.js from the projects list and running jest and it does successfully run the unit test config in ...
Read more >
Run jest test from editor with different config depending on file ...
I have a run configuration set up to run all of my jest unit tests with a specific jest configuration file. However when...
Read more >
2 Methods for Running Multiple Jest Suites in the Same Project
Why Run Multiple Test Suites Separately · The Scenario · Method #1: CLI Arguments · Method #2: Dynamic Configuration with Environment Variables ·...
Read more >
Organizing tests with jest projects - Jakub Homoly
The first config is the main config located in the root folder. This file just describes where the individual test suite configurations are ......
Read more >
Configure unit tests by using a .runsettings file - Microsoft Learn
Learn how to use the .runsettings file in Visual Studio to ... A file specified for a project overrides any other run settings...
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