File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed
Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -343,8 +343,12 @@ module.exports = class BaseGenerator extends Generator {
343343 const incompatibleDeps = { } ;
344344 for ( const d in templateDeps ) {
345345 const versionRange = projectDeps [ d ] || projectDevDeps [ d ] ;
346- if ( ! versionRange || semver . intersects ( versionRange , templateDeps [ d ] ) )
347- continue ;
346+ if ( ! versionRange ) continue ;
347+ // https://github.com/strongloop/loopback-next/issues/2028
348+ // https://github.com/npm/node-semver/pull/238
349+ // semver.intersects does not like `*`, `x`, or `X`
350+ if ( versionRange . match ( / ^ \* | x | X / ) ) continue ;
351+ if ( semver . intersects ( versionRange , templateDeps [ d ] ) ) continue ;
348352 incompatibleDeps [ d ] = [ versionRange , templateDeps [ d ] ] ;
349353 }
350354
Original file line number Diff line number Diff line change @@ -94,6 +94,19 @@ module.exports = function(artiGenerator) {
9494 / I n c o m p a t i b l e d e p e n d e n c i e s / ,
9595 ) ;
9696
97+ testCheckLoopBack (
98+ 'allows */x/X for version range' ,
99+ {
100+ keywords : [ 'loopback' ] ,
101+ devDependencies : { '@types/node' : '*' } ,
102+ dependencies : {
103+ '@loopback/context' : 'x.x' ,
104+ '@loopback/core' : 'X.*' ,
105+ } ,
106+ } ,
107+ // No expected error here
108+ ) ;
109+
97110 it ( 'passes if "keywords" maps to "loopback"' , async ( ) => {
98111 gen . fs . readJSON . returns ( { keywords : [ 'test' , 'loopback' ] } ) ;
99112 await gen . checkLoopBackProject ( ) ;
@@ -110,6 +123,10 @@ module.exports = function(artiGenerator) {
110123 } ) ;
111124 gen . fs . readJSON . returns ( obj ) ;
112125 await gen . checkLoopBackProject ( ) ;
126+ if ( ! expected ) {
127+ assert ( gen . exitGeneration == null ) ;
128+ return ;
129+ }
113130 assert ( gen . exitGeneration instanceof Error ) ;
114131 assert ( gen . exitGeneration . message . match ( expected ) ) ;
115132 gen . end ( ) ;
You can’t perform that action at this time.
0 commit comments