@@ -266,7 +266,7 @@ test("updateCheck: logs if updated version available", async (t) => {
266266 const now = 172800000 ; // 2 days since unix epoch (must be > 1 day)
267267 const registry = await useServer ( t , ( req , res ) => {
268268 t . is ( req . url , "/miniflare/latest" ) ;
269- res . end ( '{"version": "2.0 .0"}' ) ;
269+ res . end ( '{"version": "1.1 .0"}' ) ;
270270 } ) ;
271271 const log = new TestLog ( ) ;
272272 await updateCheck ( {
@@ -281,12 +281,35 @@ test("updateCheck: logs if updated version available", async (t) => {
281281 t . is ( log . warns . length , 1 ) ;
282282 t . regex (
283283 log . warns [ 0 ] ,
284- / ^ M i n i f l a r e 2 \. 0 \. 0 i s a v a i l a b l e , b u t y o u ' r e u s i n g 1 \. 0 \. 0 /
284+ / ^ M i n i f l a r e 1 \. 1 \. 0 i s a v a i l a b l e , b u t y o u ' r e u s i n g 1 \. 0 \. 0 /
285285 ) ;
286286 // Check last update check file written
287287 const lastCheck = await fs . readFile ( path . join ( tmp , "update-check" ) , "utf8" ) ;
288288 t . is ( lastCheck , now . toString ( ) ) ;
289289} ) ;
290+ test ( "updateCheck: logs additional warning on semver major change" , async ( t ) => {
291+ const tmp = await useTmp ( t ) ;
292+ const now = 172800000 ; // 2 days since unix epoch (must be > 1 day)
293+ const registry = await useServer ( t , ( req , res ) => {
294+ res . end ( '{"version": "2.0.0"}' ) ;
295+ } ) ;
296+ const log = new TestLog ( ) ;
297+ await updateCheck ( {
298+ pkg : { name : "miniflare" , version : "1.0.0" } ,
299+ cachePath : tmp ,
300+ now,
301+ registry : registry . http . toString ( ) ,
302+ log,
303+ } ) ;
304+
305+ // Check update messages logged
306+ t . is ( log . warns . length , 2 ) ;
307+ t . regex (
308+ log . warns [ 0 ] ,
309+ / ^ M i n i f l a r e 2 \. 0 \. 0 i s a v a i l a b l e , b u t y o u ' r e u s i n g 1 \. 0 \. 0 /
310+ ) ;
311+ t . regex ( log . warns [ 1 ] , / ^ 2 \. 0 \. 0 i n c l u d e s b r e a k i n g c h a n g e s / ) ;
312+ } ) ;
290313test ( "updateCheck: doesn't log if no updated version available" , async ( t ) => {
291314 const tmp = await useTmp ( t ) ;
292315 const now = 172800000 ; // 2 days since unix epoch (must be > 1 day)
0 commit comments