[BUG] intersects() still returns true for an empty range against "*" (follow-up to #521)
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
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
npm i [email protected]- 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) - 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
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di npm/node-semver
-
Bug Needs Triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
npm/node-semver#908 ·
-
semver:major
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
npm/node-semver#108 · 6 commenti ·
-
Bug Needs Triage
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
npm/node-semver#906 · 1 commento ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 76/100
npm/node-semver#904 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
npm/node-semver#900 ·
Tutte le issue di npm/node-semver
Issue simili
-
Add google analyticsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
NCAR/music-box-interactive#628 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
remotion-dev/remotion#11847 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
phoenixframework/phoenix_live_view#4456 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
AllTheMods/ATM-10#4436 ·
I maintainer di solito rispondono entro 5 giorni