Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[BUG] intersects() still returns true for an empty range against "*" (follow-up to #521)

Aperta
#909 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
64/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
javascript, node.js
Ambito
tooling

Direzione di ricerca

Start by reproducing the examples with semver.intersects(), validRange(), and satisfies() using the commands in the issue. Trace the intersects implementation and its handling of the '' range, then add coverage for the listed empty ranges; done means each intersects(..., '') case returns false while the existing non-empty cases remain correct.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Bug Needs Triage
Is there an existing issue for this?
  • I have searched the existing issues
Current Behavior

intersects(a, '*') returns true when a matches no version at all. #521 reported this for < 0.0.0 against 0.x, and it was closed as completed via #538. That exact example now returns false. But against * the empty ranges still intersect:

a validRange(a) intersects(a, '*')
>* <0.0.0-0 true
<* <0.0.0-0 true
<0.0.0 <0.0.0 true
<0.0.0-0 <0.0.0-0 true

Against a non-* range the answer is right, e.g. intersects('>*', '>=1.0.0') is false.

(Found by an AI system I use. It did not find an open issue for this; the open intersects PRs #885 and #901 cover other cases.)

Expected Behavior

false: a range that no version satisfies intersects nothing, including *. satisfies('1.0.0', '>*') is already false.

Steps To Reproduce
  1. npm i [email protected]
  2. Run:
    const semver = require('semver')
    console.log(semver.satisfies('1.0.0', '>*'), semver.validRange('>*'))  // false <0.0.0-0
    console.log(semver.intersects('>*', '*'))                               // true
    console.log(semver.intersects('<0.0.0', '*'))                           // true
    console.log(semver.intersects('<0.0.0', '0.x'))                         // false (#521's case, fixed)
    
  3. Same results on 7.7.3.
Environment
  • npm: n/a (library called directly from node)
  • Node: v24.12.0
  • OS: Windows 11 Pro
  • platform: x64 desktop
  • semver: 7.8.5 (latest) and 7.7.3
Lingua principale
JavaScript
Stelle
5.5k
Fork
598
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di npm/node-semver

Tutte le issue di npm/node-semver

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.