-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[Bug]: Validation warnings for options like preset or coverage directory #13576
Comments
Also seeing those warnings with several options:
|
Sorry about that! I'm fixing https://github.com/facebook/jest/blob/dfc87111e708b9294dc54ab0c17712972d042c1c/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapterInit.ts#L61-L63 It probably should be project config, but it's not. same with TBH global vs project config is confusing even to me after 5 years of contributing and maintaining Jest 😅 |
Preset fixed in https://github.com/facebook/jest/releases/tag/v29.3.1. It's midnight here now, so I'll need to revisit tomorrow and verify what's the correct behaviour for the other fields. Even if it makes sense that a certain option is a project config and not global, we need to look at what the behaviour is first - that can only change in the next major. But if more fields are wrongly warned about, we should fix that. |
I'm still getting some warnings like this post |
I can confirm this works for |
I'm getting same error on
|
I'm seeing these on my end:
|
I am also seeing this with slightly different options:
|
Also seeing similar to the above for supposedly valid options:
|
Same mistakes here with jest 29.3.1 and ts-jest 29.0.3:
Problems are solved downgrading to jest 28.1.3 and ts-jest 28.0.8. My configuration is:
|
Having same issues. Would like to ask what's the state with it? |
Seeing the same issue with: |
same issue with |
I feel like it's something to do with this https://github.com/facebook/jest/blob/6e5b1d60a1214e792b5229993b5475445e9c1a6e/packages/jest-config/src/index.ts#L56 I'll have to stick a debugger on there when i get to a computer next. |
@webark any luck debugging this issue? |
I can confirm that this is an issue since |
getting the I do have this is a jest.config.js located inside of a project folder; and so according to @SimenB 's comment, that is incorrect. However though I am getting this warning, coverage is being placed in the configured directory. |
I'm also getting these warnings after upgarding to |
● Validation Warning: Unknown option "collectCoverage" with value true was found. Configuration Documentation: Validation Warning: Unknown option "collectCoverageFrom" with value ["/src//!(.spec|.jest).{js,jsx,vue,ts,tsx}", "!//*.d.ts"] was found. Configuration Documentation: Seeing the same issue even after upgrading jest to |
Yeah, I have this same issue with |
Having this problem for |
I'm getting the same error but for |
Same for collectCoverage while using ● Validation Warning: Unknown option "collectCoverage" with value true was found. Configuration Documentation: |
Not sure if this has already been mentioned, but this patch-package patch works for us...
|
Funny how our monorepo projects get
|
Some problem here. Also using NX
|
for the jest 29.7 It seems like the documentation contains wrong information about configuration |
For the Jest 29.7.0 The error appears only when I run tests from the test explorer (vscode), when I run "npm t" there's no error. |
I want to correct the idea that {
reporters: ['default', ['jest-junit', { outputDirectory: '/path/to/projectA/junit' }]]
} |
I also want to add that, the problem here is less about superfluous warnings, and more that some of these settings I've tried simply do not work at all. For example, the current version of Jest (29.7.0), allows you to have Similarly, you can shut the I'll have to dig in and see how this might be implemented. If there's appetite for this and the maintainers would like to point me in the right direction, I'd appreciate it. |
+1 |
This comment was marked as spam.
This comment was marked as spam.
Same warning(Jest v29.7.0) Is there any further updates? |
Facing the same warning in jest 29.7.0 |
I'm having a validation warning on "testTimeout" with Jest 29.7.0 |
@SimenB Since Jest 29, about two years ago, many warnings about "unknown options" have been generated for no apparent reason. At some point someone made a PR that only fixed 1 or 2 of them but the others are still there (for example "reporters", that has been biting us for the last year). These options still work on project level and they also make terribly good sense at project level! Why are these warnings generated? What was the idea behind it? And why is this not fixed when it was reported? It's a clear regression from v28, where it all worked as well, but there are no irrelevant warnings. In relation to your comment here: #13565 (comment), I imagine fixing it never happened? Within our company it would really help to get rid of them to build up a bit of trust in Jest (over Karma, where we come from). |
@woppa684 I think the priority here is low, because Jest is showing warning but the options you set on project level are still working.
From our experience Karma is worse. We have an Angular application and Karma is executing tests successfully even there are properties missing on an object (maybe just configuration? idk) - Jest fails which is good because you are sure the code is executed correctly and you have to fix your test cases correctly. |
Long story short: there's (afaik) no bug. I also stumbled upon this problem and it seems like this issue should concentrate on updating the documentation & typings, since (as far as I inspected) the actual implementation at the moment works as it should. This validation code in normalize.ts#L495 causes the warnings and stands in line with what @SimenB said in the first comments. Moreover, I tried and with jest I believe this issue should result in a change to the docs to point out that some properties (such as As one of the comments in this thread mentioned, CC: @MichaelBorde @SimenB |
So... after two years and 100 comments the answer is RTFM? |
This is what I found. I'm not a maintainer so don't know in-depth how jest has been built, but what I browsed in jest's code would stand in line with what I think (the separate validation code for project config I mentioned in my comment above). Also:
|
I think the general issue here is that people are using Jest in a monorepo environment and are getting warnings that make them feel unsure about their build. Since monorepos are a popular context for a library like Jest, it would make sense to see if those warnings can be eliminated. As I understand it, some of these warnings can simply be eliminated by correcting faulty configurations. But in other cases it's not so easy: I think the goal should be to make Jest configurable enough to use it in a variety of monorepo settings without getting warnings. From what I gather, it's nearly there, it sounds like one or two more options need to be implemented at project level. Or, even easier, the warning needs to be removed because they already work fine on project level! |
Indeed, I agree that there's space for improvement and definitely I would also like to see this option available in project config. Yet, this issue is labelled as a bug, so most likely, it should be edited to be an improvement or alike. |
Yeah, the problem is that some options just worked in v28. Like |
I am also facing these warnings and I have seen there has been some fixes - #14768 and it is in https://github.com/jestjs/jest/releases/tag/v30.0.0-alpha.3 |
Version
29.3.0
Steps to reproduce
Use a
jest.config.ts
like:Expected behavior
Run tests using
./node_modules/.bin/jest
without any warnings.Actual behavior
Additional context
Might be related to the missing default option for preset or coverage in
packages/jest-config/src/ValidConfig.ts
.Environment
The text was updated successfully, but these errors were encountered: