Skip to content

test: add property-based tests with fast-check - #126

Merged
bnb merged 3 commits into
mainfrom
bnb/property-tests
Oct 29, 2026
Merged

bnb merged 3 commits into
mainfrom
bnb/property-tests

Conversation

@botandbang

Copy link
Copy Markdown
Contributor

Adds fast-check property tests where a rule should always hold.

core (test/properties.js): over dates from 2009 to 2026 against the index and schedule snapshot, every release's key and line match its semver, security.all is ordered newest first and matches the releases flagged as security, LTS newest is never older than oldest, and each line's phase only moves forward in time.

ranges (test/properties.test.js): any filter gives the same ranges as 'all' for the keys it asks for, unrequested ranges never appear, newest and oldest match the ends of versions, lts/active is lts/latest followed by lts/maintenance and always has LTS bounds, every version is also in all, and Alpha releases never are.

parsefiles, translate, opt: every file id in the snapshot parses into real file names with a type and architecture; anything that isn't a package support term rejects, and each term maps only to @nodevu/aliases; opt() uses each option it's given and keeps the default for the rest.

fast-check is added as a devDependency of ranges, parsefiles, translate and opt, and translate now declares @nodevu/aliases, which its tests import.

- translate: reject names inherited from Object.prototype and return a copy
- ranges: fall back to the other lts range for lts/active's bounds when one is empty
- parsefiles: list only the id's own directory for win-*-exe, and parse osx-x86-tar
- core, fetchindex: throw with the URL and status on a non-OK response
- ci: use --workspaces, since npm 12 rejects -ws
- core: release keys, security lists, LTS bounds, and phases only moving forward
- ranges: filtering never changes a range, no unrequested keys, lts/active is lts/latest then lts/maintenance
- parsefiles, translate, opt: real ids parse into file names, non-terms reject, options keep their defaults
- add fast-check to ranges, parsefiles, translate, and opt, and declare @nodevu/aliases in translate
Base automatically changed from bnb/edge-case-fixes to main October 29, 2026 14:46
# Conflicts:
#	parsefiles/test/parseFilename.test.js
#	translate/test/translate.test.js
@bnb
bnb merged commit 1177164 into main Oct 29, 2026
33 checks passed
@bnb
bnb deleted the bnb/property-tests branch October 29, 2026 14:54
@nodevu-ci nodevu-ci Bot mentioned this pull request Oct 29, 2026
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