-
-
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
pretty-format: Omit non-enumerable symbol properties #7448
pretty-format: Omit non-enumerable symbol properties #7448
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
CHANGELOG.md
Outdated
@@ -77,6 +77,7 @@ | |||
- `[jest-haste-map]` Remove legacy condition for duplicate module detection ([#7333](https://github.com/facebook/jest/pull/7333)) | |||
- `[jest-haste-map]` Fix `require` detection with trailing commas and ignore `import typeof` modules ([#7385](https://github.com/facebook/jest/pull/7385)) | |||
- `[jest-cli]` Fix to set prettierPath via config file ([#7412](https://github.com/facebook/jest/pull/7412)) | |||
- `[pretty-format]` [**BREAKING**] Omit non-enumerable symbol properties ([#7448](https://github.com/facebook/jest/pull/7448)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move this to the top of this section with the other breaking changes?
@pedrottimark should we add a test for the snapshot matcher? |
Codecov Report
@@ Coverage Diff @@
## master #7448 +/- ##
=========================================
+ Coverage 66.8% 66.8% +<.01%
=========================================
Files 242 242
Lines 9374 9375 +1
Branches 6 5 -1
=========================================
+ Hits 6262 6263 +1
Misses 3110 3110
Partials 2 2
Continue to review full report at Codecov.
|
It looks like snapshot tests are not related to content. So integration test would be new e2e test. For now in a local project:
|
Off topic of this PR, can y’all explain why existing code filters out symbols from array of keys? const isSymbol = key =>
// $FlowFixMe string literal `symbol`. This value is not a valid `typeof` return value
typeof key === 'symbol' || toString.call(key) === '[object Symbol]';
let keys = Object.keys(val).sort();
if (symbols.length) {
keys = keys.filter(key => !isSymbol(key)).concat(symbols);
} |
Ah that's good enough for me! |
And no @pedrottimark I couldn't tell ya, did you blame it? |
const symbols = getSymbols(val); | ||
const symbols = getSymbols(val).filter( | ||
//$FlowFixMe because property enumerable is missing in undefined | ||
symbol => Object.getOwnPropertyDescriptor(val, symbol).enumerable, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should this be a part of getSymbols
, since it's only used in one place
* master: (24 commits) Add `jest.isolateModules` for scoped module initialization (jestjs#6701) Migrate to Babel 7 (jestjs#7016) docs: changed "Great Scott!" link (jestjs#7524) Use reduce instead of filter+map in dependency_resolver (jestjs#7522) Update Configuration.md (jestjs#7455) Support dashed args (jestjs#7497) Allow % based configuration of max workers (jestjs#7494) chore: Standardize filenames: jest-runner pkg (jestjs#7464) allow `bail` setting to control when to bail out of a failing test run (jestjs#7335) Add issue template labels (jestjs#7470) chore: standardize filenames in e2e/babel-plugin-jest-hoist (jestjs#7467) Add node worker-thread support to jest-worker (jestjs#7408) Add `testPathIgnorePatterns` to CLI documentation (jestjs#7440) pretty-format: Omit non-enumerable symbol properties (jestjs#7448) Add Jest Architecture overview to docs. (jestjs#7449) chore: run appveyor tests on node 10 chore: fix failures e2e test for node 8 (jestjs#7446) chore: update docusaurus to v1.6.0 (jestjs#7445) Enhancement/expect-to-be-close-to-with-infinity (jestjs#7444) Update CHANGELOG formatting (jestjs#7429) ...
* pretty-format: Omit non-enumerable symbol properties * Update CHANGELOG.md * Correct CHANGELOG.md * Move change line to other breaking under fixes
* pretty-format: Omit non-enumerable symbol properties * Update CHANGELOG.md * Correct CHANGELOG.md * Move change line to other breaking under fixes
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
Fixes #7443
Breaking change for upcoming major upgrade to Jest 24
cc @austinalameda @mweststrate
Goals:
toEqual
matcher.Test plan
Added 2 test cases: