[QUESTION] `semver.intersects('>=16.0.0 <17.0.0', '^17.0.0-0', { includePrereleases: true })` should be `false`
I maintainer di solito rispondono entro 4 giorni
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- javascript
- Ambito
- devtools
Direzione di ricerca
Start with test/fixtures/range-intersection.js and the intersection tests in test/classes/range.js and test/ranges/intersects.js, including the supplied includePrereleases case. Trace the semver.intersects entry point to the range-intersection implementation. Done means the added cases pass in normal, loose, and includePrereleases modes in both argument orders.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What / Why
semver.intersects('>=16.0.0 <17.0.0', '^17.0.0-0') should be true, and is.
semver.intersects('>=16.0.0 <17.0.0', '^17.0.0-0', { includePrereleases: true }) should be false, and is not.
I made test cases:
diff --git a/test/classes/range.js b/test/classes/range.js
index e3867a9..bf77331 100644
--- a/test/classes/range.js
+++ b/test/classes/range.js
@@ -83,7 +83,7 @@ test('tostrings', (t) => {
})
test('ranges intersect', (t) => {
- rangeIntersection.forEach(([r0, r1, expect]) => {
+ rangeIntersection.forEach(([r0, r1, expect, includePrerelease]) => {
t.test(`${r0} <~> ${r1}`, t => {
const range0 = new Range(r0)
const range1 = new Range(r1)
@@ -92,6 +92,14 @@ test('ranges intersect', (t) => {
`${r0} <~> ${r1} objects`)
t.equal(range1.intersects(range0), expect,
`${r1} <~> ${r0} objects`)
+
+ if (includePrerelease) {
+ t.equal(range0.intersects(range1, { includePrerelease: true }), expect,
+ `${r0} <~> ${r1} objects`)
+ t.equal(range1.intersects(range0, { includePrerelease: true }), expect,
+ `${r1} <~> ${r0} objects`)
+ }
+
t.end()
})
})
diff --git a/test/fixtures/range-intersection.js b/test/fixtures/range-intersection.js
index e46c82a..956de82 100644
--- a/test/fixtures/range-intersection.js
+++ b/test/fixtures/range-intersection.js
@@ -53,5 +53,7 @@ module.exports = [
['1.3.0 || <1.0.0 >2.0.0', 'x', true],
['1.x', '1.3.0 || <1.0.0 >2.0.0', true],
['*', '*', true],
- ['x', '', true]
+ ['x', '', true],
+ ['>=16.0.0 <17.0.0', '^17.0.0-0', false],
+ ['>=16.0.0 <17.0.0', '^17.0.0-0', true, true],
]
diff --git a/test/ranges/intersects.js b/test/ranges/intersects.js
index e93492b..1545420 100644
--- a/test/ranges/intersects.js
+++ b/test/ranges/intersects.js
@@ -28,7 +28,7 @@ test('intersect comparators', t => {
})
test('ranges intersect', (t) => {
- rangeIntersection.forEach(([r0, r1, expect]) => {
+ rangeIntersection.forEach(([r0, r1, expect, includePrerelease]) => {
t.test(`${r0} <~> ${r1}`, t => {
const range0 = new Range(r0)
const range1 = new Range(r1)
@@ -43,6 +43,20 @@ test('ranges intersect', (t) => {
`${r0} <~> ${r1} objects loose`)
t.equal(intersects(range1, range0, true), expect,
`${r1} <~> ${r0} objects loose`)
+
+ if (includePrerelease) {
+ t.equal(intersects(r1, r0, { includePrerelease: true }), expect, `${r0} <~> ${r1}`)
+ t.equal(intersects(r0, r1, { includePrerelease: true }), expect, `${r1} <~> ${r0}`)
+ t.equal(intersects(r1, r0, { loose: true, includePrerelease: true }), expect, `${r0} <~> ${r1} loose`)
+ t.equal(intersects(r0, r1, { loose: true, includePrerelease: true }), expect, `${r1} <~> ${r0} loose`)
+ t.equal(intersects(range0, range1, { includePrerelease: true }), expect, `${r0} <~> ${r1} objects`)
+ t.equal(intersects(range1, range0, { includePrerelease: true }), expect, `${r1} <~> ${r0} objects`)
+ t.equal(intersects(range0, range1, { loose: true, includePrerelease: true }), expect,
+ `${r0} <~> ${r1} objects loose`)
+ t.equal(intersects(range1, range0, { loose: true, includePrerelease: true }), expect,
+ `${r1} <~> ${r0} objects loose`)
+ }
+
t.end()
})
})
but i can't figure out how to fix it.
- Lingua principale
- JavaScript
- Stelle
- 5.5k
- Fork
- 622
- Merge medio
- 4g 23h
- PR unite (30g)
- 4
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
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] minVersion returns 0.0.0 when a 0.0.0 prerelease is the true minimumForse già presa @thisisshivamtiwari l’ha presa 4 giorni fa. ApertaBug Needs Triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
npm/node-semver#934 · 1 commento ·
I maintainer di solito rispondono entro 4 giorni
-
[BUG] new Range(comparator).test() throws TypeError for a prerelease versionForse già presa @Boulea7 l’ha presa 32 giorni fa. ApertaBug Needs Triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
npm/node-semver#908 ·
I maintainer di solito rispondono entro 4 giorni
-
semver:major
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
npm/node-semver#108 · 6 commenti ·
I maintainer di solito rispondono entro 4 giorni
-
[BUG] intersects() still returns true for an empty range against "*" (follow-up to #521)Forse già presa @json-open-source l’ha presa 31 giorni fa. ApertaBug Needs Triage
Difficoltà 3/5 1-2 giorni Idoneità per principianti 64/100
npm/node-semver#909 · 1 commento ·
I maintainer di solito rispondono entro 4 giorni
-
[BUG] `* || 1.2.3-alpha` won't match `1.2.3-alpha` (when includePrerelease = false)Forse già presa @x0Lazarus l’ha presa 37 giorni fa. ApertaBug Needs Triage
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
npm/node-semver#906 · 1 commento ·
I maintainer di solito rispondono entro 4 giorni
Tutte le issue di npm/node-semver
Issue simili
-
neutral:fix
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
wazuh/wazuh-documentation#10611 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
remotion-dev/remotion#12905 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement websites
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
quarto-dev/quarto-cli#15255 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Money fields reject amounts that aren't multiples of $500, so Find cliffs silently does nothingAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
PolicyEngine/cliff-watch#44 ·