[QUESTION] `semver.intersects('>=16.0.0 <17.0.0', '^17.0.0-0', { includePrereleases: true })` should be `false`
Los mantenedores suelen responder en 4 días
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- javascript
- Área
- devtools
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- JavaScript
- Estrellas
- 5.5k
- Forks
- 622
- Merge medio
- 4 d 23 h
- PR fusionados (30 d)
- 4
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de npm/node-semver
-
[BUG] minVersion returns 0.0.0 when a 0.0.0 prerelease is the true minimumPosiblemente ocupada @thisisshivamtiwari la tomó hace 4 días. AbiertoBug Needs Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
npm/node-semver#934 · 1 comentario ·
Los mantenedores suelen responder en 4 días
-
[BUG] new Range(comparator).test() throws TypeError for a prerelease versionPosiblemente ocupada @Boulea7 la tomó hace 32 días. AbiertoBug Needs Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
npm/node-semver#908 ·
Los mantenedores suelen responder en 4 días
-
semver:major
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
npm/node-semver#108 · 6 comentarios ·
Los mantenedores suelen responder en 4 días
-
[BUG] intersects() still returns true for an empty range against "*" (follow-up to #521)Posiblemente ocupada @json-open-source la tomó hace 31 días. AbiertoBug Needs Triage
Dificultad 3/5 1-2 días Aptitud para principiantes 64/100
npm/node-semver#909 · 1 comentario ·
Los mantenedores suelen responder en 4 días
-
[BUG] `* || 1.2.3-alpha` won't match `1.2.3-alpha` (when includePrerelease = false)Posiblemente ocupada @x0Lazarus la tomó hace 37 días. AbiertoBug Needs Triage
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
npm/node-semver#906 · 1 comentario ·
Los mantenedores suelen responder en 4 días
Todos los issues de npm/node-semver
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
remotion-dev/remotion#12905 ·
Los mantenedores suelen responder en 1 día
-
enhancement websites
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
quarto-dev/quarto-cli#15255 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
mongoosejs/mquery#142 ·
-
`Scope.filteringRequestBody()` and `filteringPath()` are typed as taking zero arguments in v15Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Site Suggestion: bullseyeAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día