You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] new Range(comparator).test() throws TypeError for a prerelease version #908
When a Range is constructed from a Comparator object, range.options is never set. Testing a prerelease version against that range then throws instead of returning a boolean. satisfies(version, comparator) goes through the same path and throws too.
Cause: in classes/range.js (v7.8.5), the range instanceof Comparator branch (L21-27) returns before this.options = options (L29). test() passes this.options (L210) to testSet, which reads options.includePrerelease (L550).
(Found by an AI system I use; a search of the tracker found nothing covering it.)
Expected Behavior
The same result as for the equivalent string range: true for 1.0.0-beta against >=1.0.0-alpha. Or, if a Comparator argument is not supported, a clear error at construction. The README does not document it either way.
TypeError: Cannot read properties of undefined (reading 'includePrerelease')
at testSet (.../semver/classes/range.js:550:45)
at Range.test (.../semver/classes/range.js:210:11)
Same on 7.7.3, where the lines are range.js:530 and :207.
Activity