Skip to content

Commit

Permalink
Merge pull request #960 from ckeditor/ck/16576
Browse files Browse the repository at this point in the history
Fix (release-tools): Fixed the `getLastPreRelease()` function to handle pre-release versions with a multi-digit sequence number correctly. Closes ckeditor/ckeditor5#16576.
  • Loading branch information
pomek authored Jun 17, 2024
2 parents 3797965 + 11a0d96 commit a4be357
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/ckeditor5-dev-release-tools/lib/utils/versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const versions = {
.then( result => {
const lastVersion = JSON.parse( result )
.filter( version => version.startsWith( releaseIdentifier ) )
.sort()
.sort( ( a, b ) => a.localeCompare( b, undefined, { numeric: true } ) )
.pop();

return lastVersion || null;
Expand Down
17 changes: 17 additions & 0 deletions packages/ckeditor5-dev-release-tools/tests/utils/versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,23 @@ describe( 'dev-release-tools/utils', () => {
} );
} );

it( 'returns last pre-release version matching the release identifier (sequence numbers greater than 10)', () => {
shExecStub.resolves( JSON.stringify( [
'0.0.0-nightly-20230615.0',
'37.0.0-alpha.1',
'37.0.0-alpha.2',
'37.0.0-alpha.3',
'41.0.0',
'37.0.0-alpha.10',
'37.0.0-alpha.11'
] ) );

return version.getLastPreRelease( '37.0.0-alpha' )
.then( result => {
expect( result ).to.equal( '37.0.0-alpha.11' );
} );
} );

it( 'returns last nightly version', () => {
shExecStub.resolves( JSON.stringify( [
'0.0.0-nightly-20230614.0',
Expand Down

0 comments on commit a4be357

Please sign in to comment.