Skip to content

Commit

Permalink
🐛 Make run details printer a bit more resilient to poisoning (#5517)
Browse files Browse the repository at this point in the history
**Description**

<!-- Please provide a short description and potentially linked issues
justifying the need for this PR -->

Cf. title

<!-- * Your PR is fixing a bug or regression? Check for existing issues
related to this bug and link them -->
<!-- * Your PR is adding a new feature? Make sure there is a related
issue or discussion attached to it -->

<!-- You can provide any additional context to help into understanding
what's this PR is attempting to solve: reproduction of a bug, code
snippets... -->

**Checklist** — _Don't delete this checklist and make sure you do the
following before opening the PR_

- [x] The name of my PR follows [gitmoji](https://gitmoji.dev/)
specification
- [x] My PR references one of several related issues (if any)
- [x] New features or breaking changes must come with an associated
Issue or Discussion
- [x] My PR does not add any new dependency without an associated Issue
or Discussion
- [x] My PR includes bumps details, please run `yarn bump` and flag the
impacts properly
- [x] My PR adds relevant tests and they would have failed without my PR
(when applicable)

<!-- More about contributing at
https://github.com/dubzzz/fast-check/blob/main/CONTRIBUTING.md -->

**Advanced**

<!-- How to fill the advanced section is detailed below! -->

- [x] Category: 🐛 Fix a bug
- [x] Impacts: None expected, should be more resilient to poisoning

<!-- [Category] Please use one of the categories below, it will help us
into better understanding the urgency of the PR -->
<!-- * ✨ Introduce new features -->
<!-- * 📝 Add or update documentation -->
<!-- * ✅ Add or update tests -->
<!-- * 🐛 Fix a bug -->
<!-- * 🏷️ Add or update types -->
<!-- * ⚡️ Improve performance -->
<!-- * _Other(s):_ ... -->

<!-- [Impacts] Please provide a comma separated list of the potential
impacts that might be introduced by this change -->
<!-- * Generated values: Can your change impact any of the existing
generators in terms of generated values, if so which ones? when? -->
<!-- * Shrink values: Can your change impact any of the existing
generators in terms of shrink values, if so which ones? when? -->
<!-- * Performance: Can it require some typings changes on user side?
Please give more details -->
<!-- * Typings: Is there a potential performance impact? In which cases?
-->
  • Loading branch information
dubzzz authored Dec 12, 2024
1 parent 7b52827 commit e277962
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/quick-pillows-shake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"fast-check": patch
---

🐛 Make run details printer a bit more resilient to poisoning
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Error, safePush, safeReplace } from '../../../utils/globals';
import { Error, safeMapGet, Map, safePush, safeReplace } from '../../../utils/globals';
import { stringify, possiblyAsyncStringify } from '../../../utils/stringify';
import { VerbosityLevel } from '../configuration/VerbosityLevel';
import { ExecutionStatus } from '../reporter/ExecutionStatus';
Expand Down Expand Up @@ -228,7 +228,7 @@ async function asyncDefaultReportMessage<Ts>(out: RunDetails<Ts>): Promise<strin
// Retry with async stringified versions in mind
const registeredValues = new Map(await Promise.all(pendingStringifieds));
function stringifySecond(value: unknown): string {
const asyncStringifiedIfRegistered = registeredValues.get(value);
const asyncStringifiedIfRegistered = safeMapGet(registeredValues, value);
if (asyncStringifiedIfRegistered !== undefined) {
return asyncStringifiedIfRegistered;
}
Expand Down

0 comments on commit e277962

Please sign in to comment.