Skip to content

⚡ Slightly faster code for RunExecution#6444

Merged
dubzzz merged 5 commits into
mainfrom
copilot/fix-checks-in-path-to-failures
Jan 16, 2026
Merged

⚡ Slightly faster code for RunExecution#6444
dubzzz merged 5 commits into
mainfrom
copilot/fix-checks-in-path-to-failures

Conversation

Copilot AI commented Jan 16, 2026

Copy link
Copy Markdown
Contributor

Plan: Use strict equality (===) for pathToFailure checks

  • Replace == with === in RunExecution.ts for all this.pathToFailure == null comparisons
    • Line 49: if (this.pathToFailure == null)if (this.pathToFailure === undefined)
    • Line 58: if (this.pathToFailure == null)if (this.pathToFailure === undefined)
    • Line 66: if (this.pathToFailure == null)if (this.pathToFailure === undefined)
    • Line 74: this.pathToFailure == nullthis.pathToFailure === undefined)
    • Updated comments (lines 110, 117) to reflect the change
  • Convert lambda methods to regular methods in RunExecution.ts
    • isSuccess arrow function → regular method
    • firstFailure arrow function → regular method
    • numShrinks arrow function → regular method
    • mergePaths static arrow function → regular static method
  • Replace truthy checks with explicit !== undefined checks
    • firstFailure(): this.pathToFailure ?this.pathToFailure !== undefined ?
    • numShrinks(): this.pathToFailure ?this.pathToFailure !== undefined ?
  • Run tests to validate changes (all tests passed)
  • Run linting to ensure code quality (no issues found)
  • Request code review (no issues found)
  • Run CodeQL security check (no vulnerabilities found)

Summary

Successfully updated all equality checks for this.pathToFailure from loose equality (== null) to strict equality (=== undefined), converted all lambda/arrow function methods to regular methods, and replaced all truthy checks with explicit !== undefined checks. This change follows TypeScript best practices and maintains the same behavior.

Original prompt

use === for checks on this.pathToFailires


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@changeset-bot

changeset-bot Bot commented Jan 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6489cba

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
fast-check Minor

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

Comment thread packages/fast-check/src/check/runner/reporter/RunExecution.ts
Copilot AI changed the title [WIP] Fix checks on this.pathToFailures using strict equality ♻️ Use strict equality for pathToFailure checks Jan 16, 2026
Copilot AI requested a review from dubzzz January 16, 2026 21:47
}

private firstFailure(): number {
return this.pathToFailure ? +safeSplit(this.pathToFailure, ':')[0] : -1;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot add missing !==undefined on this.pathToFailure check

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added explicit !== undefined checks in b98eedf:

  • firstFailure(): line 79
  • numShrinks(): line 83

@dubzzz dubzzz changed the title ♻️ Use strict equality for pathToFailure checks ⚡ Slightly faster code for RunExecution Jan 16, 2026
Copilot AI requested a review from dubzzz January 16, 2026 21:57
@dubzzz

dubzzz commented Jan 16, 2026

Copy link
Copy Markdown
Owner

Why the change?

  • Strict equality is faster than loose equality
  • Strict equality is faster than truthy checks
  • Methods on prototype are faster than functions being specifically created for the instance

@github-actions

Copy link
Copy Markdown
Contributor

@pkg-pr-new

pkg-pr-new Bot commented Jan 16, 2026

Copy link
Copy Markdown
@fast-check/ava

npm i https://pkg.pr.new/@fast-check/ava@6444

@fast-check/expect-type

npm i https://pkg.pr.new/@fast-check/expect-type@6444

fast-check

npm i https://pkg.pr.new/fast-check@6444

@fast-check/jest

npm i https://pkg.pr.new/@fast-check/jest@6444

@fast-check/packaged

npm i https://pkg.pr.new/@fast-check/packaged@6444

@fast-check/poisoning

npm i https://pkg.pr.new/@fast-check/poisoning@6444

@fast-check/vitest

npm i https://pkg.pr.new/@fast-check/vitest@6444

@fast-check/worker

npm i https://pkg.pr.new/@fast-check/worker@6444

commit: 6489cba

Updated the version of 'fast-check' from patch to minor due to performance improvements.
@github-actions

Copy link
Copy Markdown
Contributor

@dubzzz
dubzzz marked this pull request as ready for review January 16, 2026 22:05
@dubzzz
dubzzz enabled auto-merge (squash) January 16, 2026 22:16
@dubzzz
dubzzz merged commit fdac5d9 into main Jan 16, 2026
110 of 127 checks passed
@dubzzz
dubzzz deleted the copilot/fix-checks-in-path-to-failures branch January 16, 2026 22:20
@codecov

codecov Bot commented Jan 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.84%. Comparing base (8f9025b) to head (6489cba).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6444   +/-   ##
=======================================
  Coverage   94.84%   94.84%           
=======================================
  Files         207      207           
  Lines        5567     5570    +3     
  Branches     1457     1457           
=======================================
+ Hits         5280     5283    +3     
  Misses        274      274           
  Partials       13       13           
Flag Coverage Δ
tests 94.84% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

dubzzz added a commit that referenced this pull request Mar 8, 2026
…ast-check/[email protected], @fast-check/[email protected], @fast-check/[email protected], @fast-check/[email protected], @fast-check/[email protected] (#6706)

Resulting CHANGELOG at:
-
https://github.com/dubzzz/fast-check/blob/changelog-c91edcb2009e78/packages/fast-check/CHANGELOG.md
-
https://github.com/dubzzz/fast-check/blob/changelog-c91edcb2009e78/packages/ava/CHANGELOG.md
-
https://github.com/dubzzz/fast-check/blob/changelog-c91edcb2009e78/packages/vitest/CHANGELOG.md
-
https://github.com/dubzzz/fast-check/blob/changelog-c91edcb2009e78/packages/poisoning/CHANGELOG.md
-
https://github.com/dubzzz/fast-check/blob/changelog-c91edcb2009e78/packages/packaged/CHANGELOG.md
-
https://github.com/dubzzz/fast-check/blob/changelog-c91edcb2009e78/packages/jest/CHANGELOG.md
-
https://github.com/dubzzz/fast-check/blob/changelog-c91edcb2009e78/packages/worker/CHANGELOG.md

Got the following errors:
- ⚠️ Unhandled type: ⚡ on
[PR-6446](#6446) with title
Replace loose equality by strict one
- ⚠️ Unhandled type: ⚡ on
[PR-6444](#6444) with title
Slightly faster code for RunExecution
- ℹ️ Scanned 208 PRs for fast-check:
- ℹ️ • accepted: 71,
- ℹ️ • skipped ignored: 108,
- ℹ️ • skipped unrelated: 27,
- ℹ️ • failed: 2
- ℹ️ Scanned 697 PRs for @fast-check/ava:
- ℹ️ • accepted: 5,
- ℹ️ • skipped ignored: 0,
- ℹ️ • skipped unrelated: 692,
- ℹ️ • failed: 0
- ℹ️ Scanned 277 PRs for @fast-check/vitest:
- ℹ️ • accepted: 6,
- ℹ️ • skipped ignored: 0,
- ℹ️ • skipped unrelated: 271,
- ℹ️ • failed: 0
- ℹ️ Scanned 697 PRs for @fast-check/poisoning:
- ℹ️ • accepted: 4,
- ℹ️ • skipped ignored: 0,
- ℹ️ • skipped unrelated: 693,
- ℹ️ • failed: 0
- ℹ️ Scanned 697 PRs for @fast-check/packaged:
- ℹ️ • accepted: 4,
- ℹ️ • skipped ignored: 0,
- ℹ️ • skipped unrelated: 693,
- ℹ️ • failed: 0
- ℹ️ Scanned 655 PRs for @fast-check/jest:
- ℹ️ • accepted: 3,
- ℹ️ • skipped ignored: 0,
- ℹ️ • skipped unrelated: 652,
- ℹ️ • failed: 0
- ℹ️ Scanned 670 PRs for @fast-check/worker:
- ℹ️ • accepted: 9,
- ℹ️ • skipped ignored: 0,
- ℹ️ • skipped unrelated: 661,
- ℹ️ • failed: 0

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Nicolas DUBIEN <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants