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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply appropriate configs for different tests ran as different projects #7268

Closed
deser opened this issue Oct 25, 2018 · 15 comments
Closed

Apply appropriate configs for different tests ran as different projects #7268

deser opened this issue Oct 25, 2018 · 15 comments
Labels

Comments

@deser
Copy link

deser commented Oct 25, 2018

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

@deser
Copy link
Author

deser commented Oct 25, 2018

UPD: I suspect that my issue is connected with #7186
Could you confirm? When is new release with that fix is planned?

@deser
Copy link
Author

deser commented Oct 25, 2018

UPD: When I run the same failing test filtering it via --testNamePattern= it works correctly

@deser
Copy link
Author

deser commented Oct 31, 2018

Guys, any thoughts?

@SimenB
Copy link
Member

SimenB commented Oct 31, 2018

@deser you can try installing jest 24 prerelease (yarn add --dev jest@beta) which includes #7186 to verify.

If it does not help, you need to update the OP with the information from the issue template, most importantly including a full reproduction case

@deser
Copy link
Author

deser commented Oct 31, 2018

Sure, I'll feedback

@deser
Copy link
Author

deser commented Oct 31, 2018

Nope, it didn't help. I'll update description.

BTW, project didn't run successfully. It complained about babel 6. I had to remove jest and babel-jest and install again

@deser
Copy link
Author

deser commented Nov 1, 2018

@SimenB , please see demo

@deser
Copy link
Author

deser commented Nov 1, 2018

UPD: Seems this issue is resources dependent. On my machine tests fail, when on another they doesn't.
If tests doesn't fail on your machine I assume you can throttle your CPU to reproduce the issue.

My machine:
System:
OS: Windows 10
CPU: x64 Intel(R) Core(TM) i7-7600U CPU @ 2.80GHz
Binaries:
npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD

Node: 10.11.0

Also, as you can notice I've created a lot tests inside, because when I had just a few of them - issue weren't reproduced. This indirectly approves my thought that the issue is resources dependent.

@deser
Copy link
Author

deser commented Nov 8, 2018

Guys, any updates\thoughts on the issue?

@rickhanlonii
Copy link
Member

Hey @deser, sorry for the delay - reading through this it's hard to understand what the issue is

Can you dumb this down for me?

@deser
Copy link
Author

deser commented Dec 2, 2018

Yes, sure. In 2 words projects feature works incorrect. It is expected that it will run a test through appropriate config for appropriate match within the config. But under certain circumstances it behaves incorrect, running a test with incorrect config.

@wilkinsonjack1993
Copy link

Also experiencing similar issues, projects basically does not work.

@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 14 days.

@github-actions github-actions bot added the Stale label Feb 25, 2022
@github-actions
Copy link

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

@github-actions
Copy link

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.

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

No branches or pull requests

4 participants