File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -169,28 +169,41 @@ function getDirectTestDependencies(
169169
170170const PKG = 'elm-explorations/test' ;
171171const VERSION = '1.2.2' ;
172+ const VERSION_RANGE = '1.2.2 <= v < 2.0.0' ;
173+
174+ function getExpectedVersion (
175+ project /*: typeof Project.Project */
176+ ) /*: string */ {
177+ switch ( project . elmJson . type ) {
178+ case 'application' :
179+ return VERSION ;
180+ case 'package' :
181+ return VERSION_RANGE ;
182+ }
183+ }
172184
173185async function installUnstableTestMaster (
174186 project /*: typeof Project.Project */
175187) /*: Promise<void> */ {
176188 const directTestDependencies = getDirectTestDependencies ( project ) ;
177189 const actualVersion = directTestDependencies [ PKG ] ;
178- if ( actualVersion !== VERSION ) {
190+ const expectedVersion = getExpectedVersion ( project ) ;
191+ if ( actualVersion . replace ( / \s / g, '' ) !== expectedVersion . replace ( / \s / g, '' ) ) {
179192 throw new Error (
180193 `
181194Could not find ${ JSON . stringify ( PKG ) } : ${ JSON . stringify (
182- VERSION
195+ expectedVersion
183196 ) } in your elm.json file here:
184197
185198${ ElmJson . getPath ( project . rootDir ) }
186199
187200This command only works if you have ${ PKG } as a (direct) test-dependency,
188- and only if you use version ${ VERSION } .
201+ and only if you use ${ JSON . stringify ( expectedVersion ) } .
189202
190203${
191204 actualVersion === undefined
192205 ? 'I could not find it at all.'
193- : `You seem to be using version ${ actualVersion } .`
206+ : `You seem to be using ${ JSON . stringify ( actualVersion ) } .`
194207}
195208 ` . trim ( )
196209 ) ;
You can’t perform that action at this time.
0 commit comments