File tree Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ tape('Version string to Semver translator', function (t) {
2121 t . test ( 'Broken nightly with leading zeroes' , function ( st ) {
2222 st . equal ( versionToSemver ( '0.3.6-nightly.2016.08.27+commit.91d4fa47.Emscripten.clang' ) , '0.3.6-nightly.2016.8.27+commit.91d4fa47.Emscripten.clang' ) ;
2323 st . equal ( versionToSemver ( '0.4.1-nightly.2016.09.09+commit.79867f49.Emscripten.clang' ) , '0.4.1-nightly.2016.9.9+commit.79867f49.Emscripten.clang' ) ;
24+ st . equal ( versionToSemver ( '0.4.1-nightly.2016.12.06+commit.79867f49.Emscripten.clang' ) , '0.4.1-nightly.2016.12.6+commit.79867f49.Emscripten.clang' ) ;
2425 st . end ( ) ;
2526 } ) ;
2627 t . test ( 'Old style 0.1.1' , function ( st ) {
Original file line number Diff line number Diff line change @@ -30,7 +30,8 @@ function versionToSemver (version) {
3030 return '0.3.5' ;
3131 }
3232 // This parses the obsolete nightly style where the date can have leading zeroes.
33- const nightlyParsed = version . match ( / ^ ( [ 0 - 9 ] + \. [ 0 - 9 ] + \. [ 0 - 9 ] + ) - n i g h t l y \. ( [ 0 - 9 ] + ) \. 0 ? ( [ 1 - 9 ] ) \. 0 ? ( [ 1 - 9 ] ) ( .* ) $ / ) ;
33+ // It does not validate the dates, but only if the date format is correct (i.e. YYYY.[M]M.[D]D).
34+ const nightlyParsed = version . match ( / ^ ( [ 0 - 9 ] + \. [ 0 - 9 ] + \. [ 0 - 9 ] + ) - n i g h t l y \. ( [ 0 - 9 ] + ) \. 0 ? ( [ 1 - 9 ] + ) \. 0 ? ( [ 1 - 9 ] + ) ( .* ) $ / ) ;
3435 if ( nightlyParsed ) {
3536 return nightlyParsed [ 1 ] + '-nightly.' + nightlyParsed [ 2 ] + '.' + nightlyParsed [ 3 ] + '.' + nightlyParsed [ 4 ] + nightlyParsed [ 5 ] ;
3637 }
You can’t perform that action at this time.
0 commit comments