Print deprecation warnings on CLI flags#5536
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5536 +/- ##
==========================================
- Coverage 60.63% 60.54% -0.09%
==========================================
Files 213 213
Lines 7311 7328 +17
Branches 3 3
==========================================
+ Hits 4433 4437 +4
- Misses 2877 2890 +13
Partials 1 1
Continue to review full report at Codecov.
|
|
Couple things to note here:
Good things here:
Pointers for future:
|
SimenB
left a comment
There was a problem hiding this comment.
Needs test and a changelog update 🙂
| }, | ||
| {}, | ||
| ); | ||
| const deprecations = new Set(Object.keys(CLIDeprecations)); |
There was a problem hiding this comment.
Could you add some tests for this behavior?
|
Can we now remove |
|
How can I assert on what is being printed on terminal? |
|
Add an integration test and snapshot the stdout |
|
I was trying to add that in the package tests under |
|
You can add some unit tests for |
|
I think I am using the I think I am using |
| })); | ||
|
|
||
| it('Prints deprecation warnings for CLI flags', () => { | ||
| const {stderr, stdout} = runJest(dir, ['--cache']); |
There was a problem hiding this comment.
It's an end to end test, so we should assert on real values. Just pass --preprocessorIgnorePatterns which is already deprecated and you can get rid of mocking jest-config
There was a problem hiding this comment.
But the issue is preprocessorIgnorePatterns is not a CLI arg. It throws an error. None of the existing deprecations are in CLI args
And what happens in the future those deprecations are removed from the code. That's why I thought I should mock it.
There was a problem hiding this comment.
Maybe we add an internal/undocumented cli arg/config like --printDeprecated
There was a problem hiding this comment.
I'd prefer being able to mock it rather than adding a hidden options. That maybe the last resort.
|
|
||
| it('Prints deprecation warnings for CLI flags', () => { | ||
| const {stderr, stdout} = runJest(dir, ['--cache']); | ||
| expect(stderr).toMatchSnapshot(); |
There was a problem hiding this comment.
It's sufficient to just do a regex check for Test Suites: 1 passed, 1 total.
Snapshot contains changing data (execution time) which breaks on other machines, unless you replace them with something static.
1400a03 to
1c2b47c
Compare
|
How can I mock |
|
Looks like there is no other way to do this. |
8eac9ce to
f620a4c
Compare
|
@Aftabnack I'd either add |
|
Since my other PR is merged. I can use |
f620a4c to
86ca4ae
Compare
| installCommonGlobals, | ||
| isInteractive, | ||
| setGlobal, | ||
| validateCLIOptions, |
There was a problem hiding this comment.
technically a breaking change. not sure if it matters, though
There was a problem hiding this comment.
It absolutely matters. Please see #5749
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |

Summary
Test plan