mirror of
https://github.com/apache/cordova-android.git
synced 2026-04-23 00:00:09 +08:00
refactor(ProjectBuilder): clean up output file collection code (#1099)
* refactor(ProjectBuilder): less repetitive fileSorter This reverts the fileSorter to the state from before #937, but using our own simple re-implementation of `compare-func`. * fix(ProjectBuilder): apply sort RegExp to basename only * refactor(ProjectBuilder): use fast-glob instead of hand-rolled equivalent * refactor(ProjectBuilder): factor out common isPathArchSpecific * refactor(ProjectBuilder): use includes instead of indexOf * refactor(ProjectBuilder): move sorting into findOutputFilesHelper * refactor(ProjectBuilder): simplify findOutputFiles signature
This commit is contained in:
committed by
GitHub
parent
bb7d733cde
commit
b245337501
@@ -289,7 +289,7 @@ describe('ProjectBuilder', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('fileSorter', () => {
|
||||
describe('outputFileComparator', () => {
|
||||
it('should sort APKs from most recent to oldest, deprioritising unsigned arch-specific builds', () => {
|
||||
const APKs = {
|
||||
'app-debug.apk': new Date('2018-04-20'),
|
||||
@@ -309,7 +309,7 @@ describe('ProjectBuilder', () => {
|
||||
});
|
||||
|
||||
const apkArray = Object.keys(APKs);
|
||||
const sortedApks = apkArray.sort(ProjectBuilder.__get__('fileSorter'));
|
||||
const sortedApks = apkArray.sort(ProjectBuilder.__get__('outputFileComparator'));
|
||||
|
||||
expect(sortedApks).toEqual(expectedResult);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user