Refactor names and delimiters of complex values in pretty-format#3986
Refactor names and delimiters of complex values in pretty-format#3986cpojer merged 2 commits intojestjs:masterfrom
Conversation
|
Seems like circle is unhappy. |
|
In case it helps, I will push another commit to fix this unrelated problem: $ eslint . --cache --ext js,md
/Users/mark/gitforks/jest/packages/jest-haste-map/src/index.js
831:1 error Delete `······` prettier/prettier
✖ 1 problem (1 error, 0 warnings)
1 error, 0 warnings potentially fixable with the `--fix` option.
error Command failed with exit code 1. |
Codecov Report
@@ Coverage Diff @@
## master #3986 +/- ##
=========================================
Coverage ? 59.97%
=========================================
Files ? 196
Lines ? 6814
Branches ? 6
=========================================
Hits ? 4087
Misses ? 2724
Partials ? 3
Continue to review full report at Codecov.
|
|
Happy to accept a PR for breaking changes when you are making edge cases more consistent. |
…tjs#3986) * Refactor names and delimiters of complex values in pretty-format * Delete extra spaces
|
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
There are some inconsistencies in names of complex types for various options:
Arguments []but general case withmin: trueis[]Array []and so on, but general case withmin: trueis[]hitMaxDepthfor typed array is[Array]instead of[Uint32Array]and so onhitMaxDepthfor constructed object is[Object]instead of'[' + (val.constructor ? val.constructor.name : 'Object') + ']'and I’m not sure tests cover this caseIf y’all are willing to approve breaking changes to edge cases, I can submit an additional PR.
Whether or not, this PR applies advice from Kent Beck: move similar elements closer together.
printBasicValuetoprintComplexValueprintComplexValueprintArgumentsandprintArrayEffect of refactoring on performance:
indentwhen it isn’t used for those values. It has been confusing to me that the special cases inprintBasicValue(where I don’t expect to find arguments or arrays) are inconsistent with the general cases inprintCompexValue:(isToStringedArrayTypeonly 1 time instead of 2 and callingprintListdirectly for arguments and array is subtle, within the precision of measurement.Test plan
Jest