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) {
21
21
t . test ( 'Broken nightly with leading zeroes' , function ( st ) {
22
22
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' ) ;
23
23
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' ) ;
24
25
st . end ( ) ;
25
26
} ) ;
26
27
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) {
30
30
return '0.3.5' ;
31
31
}
32
32
// 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 ] + ) ( .* ) $ / ) ;
34
35
if ( nightlyParsed ) {
35
36
return nightlyParsed [ 1 ] + '-nightly.' + nightlyParsed [ 2 ] + '.' + nightlyParsed [ 3 ] + '.' + nightlyParsed [ 4 ] + nightlyParsed [ 5 ] ;
36
37
}
You can’t perform that action at this time.
0 commit comments