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 {
343
343
const incompatibleDeps = { } ;
344
344
for ( const d in templateDeps ) {
345
345
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 ;
348
352
incompatibleDeps [ d ] = [ versionRange , templateDeps [ d ] ] ;
349
353
}
350
354
Original file line number Diff line number Diff line change @@ -94,6 +94,19 @@ module.exports = function(artiGenerator) {
94
94
/ I n c o m p a t i b l e d e p e n d e n c i e s / ,
95
95
) ;
96
96
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
+
97
110
it ( 'passes if "keywords" maps to "loopback"' , async ( ) => {
98
111
gen . fs . readJSON . returns ( { keywords : [ 'test' , 'loopback' ] } ) ;
99
112
await gen . checkLoopBackProject ( ) ;
@@ -110,6 +123,10 @@ module.exports = function(artiGenerator) {
110
123
} ) ;
111
124
gen . fs . readJSON . returns ( obj ) ;
112
125
await gen . checkLoopBackProject ( ) ;
126
+ if ( ! expected ) {
127
+ assert ( gen . exitGeneration == null ) ;
128
+ return ;
129
+ }
113
130
assert ( gen . exitGeneration instanceof Error ) ;
114
131
assert ( gen . exitGeneration . message . match ( expected ) ) ;
115
132
gen . end ( ) ;
You can’t perform that action at this time.
0 commit comments