-
-
Notifications
You must be signed in to change notification settings - Fork 188
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
🚸 Shorter stringified values for null-prototype #5603
Conversation
**⚠️ Minor breaking change** As specified on [MDN Web Doc @ Object # null-prototype objects](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object#null-prototype_objects), there are two main ways to build instances having null-prototype: > However, you may create null-prototype objects using Object.create(null) or the object initializer syntax with __proto__: null [...] > > ```js > const obj = Object.create(null); > const obj2 = { __proto__: null }; > ```` Up-to-now, `fc.stringify` has been using the first notation with `Object.assign` added to it to add keys within the instance. But as `Object.create` + `Object.assign` tend to be longer than the `___proto__:null`, we swicth to that shorter notation in that PR. As it may slighty impact final users (exposed API), we will wait a major version to release it (major being close, let's wait for it). It seems to be compatible with any version of node, at least from 0.10.48 so the `eval(fc.stringify(value))` would still work.
🦋 Changeset detectedLatest commit: a0461e1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Open in Stackblitz • @fast-check/examples @fast-check/ava
@fast-check/expect-type
fast-check
@fast-check/jest
@fast-check/packaged
@fast-check/poisoning
@fast-check/vitest
@fast-check/worker
commit: |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5603 +/- ##
==========================================
- Coverage 94.77% 94.77% -0.01%
==========================================
Files 235 235
Lines 10036 10033 -3
Branches 2826 2826
==========================================
- Hits 9512 9509 -3
Misses 524 524
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
👋 A preview of the new documentation is available at: http://67861955927658c0972b932e--dubzzz-fast-check.netlify.app |
….3, @fast-check/vitest@0.1.6, @fast-check/expect-type@0.2.1, @fast-check/worker@0.4.2, @fast-check/jest@2.1.0, @fast-check/packaged@0.5.0, @fast-check/ava@2.0.2 (#5818) Resulting CHANGELOG at: - https://github.com/dubzzz/fast-check/blob/changelog-178153e45d62/packages/fast-check/CHANGELOG.md - https://github.com/dubzzz/fast-check/blob/changelog-178153e45d62/packages/poisoning/CHANGELOG.md - https://github.com/dubzzz/fast-check/blob/changelog-178153e45d62/packages/vitest/CHANGELOG.md - https://github.com/dubzzz/fast-check/blob/changelog-178153e45d62/packages/expect-type/CHANGELOG.md - https://github.com/dubzzz/fast-check/blob/changelog-178153e45d62/packages/worker/CHANGELOG.md - https://github.com/dubzzz/fast-check/blob/changelog-178153e45d62/packages/jest/CHANGELOG.md - https://github.com/dubzzz/fast-check/blob/changelog-178153e45d62/packages/packaged/CHANGELOG.md - https://github.com/dubzzz/fast-check/blob/changelog-178153e45d62/packages/ava/CHANGELOG.md Got the following errors: -⚠️ Unhandled type: 🚨 on [PR-5803](#5803) with title Fix lint error in `ConstantArbitrary` class -⚠️ Unhandled type: 🚨 on [PR-5767](#5767) with title Abide by lint rule `no-unused-vars` -⚠️ Unhandled type: 🚨 on [PR-5763](#5763) with title Abide by lint rule `no-empty-object-type` -⚠️ Unhandled type: 🔖 on [PR-5654](#5654) with title Update CHANGELOG.md for @fast-check/vitest@0.1.5 -⚠️ Unhandled type: 🚸 on [PR-5603](#5603) with title Shorter stringified values for null-prototype - ℹ️ Scanned 277 PRs for fast-check: - ℹ️ • accepted: 93, - ℹ️ • skipped ignored: 161, - ℹ️ • skipped unrelated: 18, - ℹ️ • failed: 5 - ℹ️ Scanned 397 PRs for @fast-check/poisoning: - ℹ️ • accepted: 1, - ℹ️ • skipped ignored: 0, - ℹ️ • skipped unrelated: 396, - ℹ️ • failed: 0 -⚠️ Unhandled type: 🚨(vitest) on [PR-5764](#5764) with title Abide by lint rule `no-duplicate-type-constituents` - ℹ️ Scanned 159 PRs for @fast-check/vitest: - ℹ️ • accepted: 3, - ℹ️ • skipped ignored: 0, - ℹ️ • skipped unrelated: 155, - ℹ️ • failed: 1 - ℹ️ Scanned 1020 PRs for @fast-check/expect-type: - ℹ️ • accepted: 1, - ℹ️ • skipped ignored: 0, - ℹ️ • skipped unrelated: 1019, - ℹ️ • failed: 0 - ℹ️ Scanned 397 PRs for @fast-check/worker: - ℹ️ • accepted: 2, - ℹ️ • skipped ignored: 0, - ℹ️ • skipped unrelated: 395, - ℹ️ • failed: 0 - ℹ️ Scanned 397 PRs for @fast-check/jest: - ℹ️ • accepted: 4, - ℹ️ • skipped ignored: 0, - ℹ️ • skipped unrelated: 393, - ℹ️ • failed: 0 - ℹ️ Scanned 277 PRs for @fast-check/packaged: - ℹ️ • accepted: 2, - ℹ️ • skipped ignored: 0, - ℹ️ • skipped unrelated: 275, - ℹ️ • failed: 0 - ℹ️ Scanned 573 PRs for @fast-check/ava: - ℹ️ • accepted: 3, - ℹ️ • skipped ignored: 0, - ℹ️ • skipped unrelated: 570, - ℹ️ • failed: 0 --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Nicolas DUBIEN <github@dubien.org>
Description
As specified on MDN Web Doc @ Object # null-prototype objects, there are two main ways to build instances having null-prototype:
Up-to-now,
fc.stringify
has been using the first notation withObject.assign
added to it to add keys within the instance. But asObject.create
+Object.assign
tend to be longer than the___proto__:null
, we swicth to that shorter notation in that PR.Checklist — Don't delete this checklist and make sure you do the following before opening the PR
yarn bump
and flag the impacts properlyAdvanced
eval(fc.stringify(value))
would still work.