Skip to content

Commit

Permalink
Add allOfficialArchsForPlatformAndVersion()
Browse files Browse the repository at this point in the history
  • Loading branch information
malept committed Sep 13, 2017
1 parent 4174455 commit 43397e8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
8 changes: 8 additions & 0 deletions targets.js
Expand Up @@ -82,6 +82,14 @@ function hostArch () {
}

module.exports = {
allOfficialArchsForPlatformAndVersion: function allOfficialArchsForPlatformAndVersion (platform, electronVersion) {
const archs = officialPlatformArchCombos[platform]
if (platform === 'linux' && !officialLinuxARM64BuildExists({electronVersion: electronVersion})) {
return archs.filter((arch) => arch !== 'arm64')
}

return archs
},
createPlatformArchPairs: createPlatformArchPairs,
hostArch: hostArch,
officialArchs: officialArchs,
Expand Down
18 changes: 18 additions & 0 deletions test/targets.js
Expand Up @@ -30,6 +30,24 @@ function testCombinations (testcaseDescription, arch, platform) {
'Packages should be generated for all combinations of specified archs and platforms')
}

test('allOfficialArchsForPlatformAndVersion is undefined for unknown platforms', (t) => {
t.equal(targets.allOfficialArchsForPlatformAndVersion('unknown', '1.0.0'), undefined)
t.end()
})

test('allOfficialArchsForPlatformAndVersion returns the correct arches for a known platform', (t) => {
t.deepEqual(targets.allOfficialArchsForPlatformAndVersion('darwin', '1.0.0'), ['x64'])
t.end()
})

test('allOfficialArchsForPlatformAndVersion returns arm64 when the correct version is specified', (t) => {
t.notEqual(targets.allOfficialArchsForPlatformAndVersion('linux', '1.8.0').indexOf('arm64'), -1,
'should be found when version is >= 1.8.0')
t.equal(targets.allOfficialArchsForPlatformAndVersion('linux', '1.7.0').indexOf('arm64'), -1,
'should not be found when version is < 1.8.0')
t.end()
})

test('validateListFromOptions does not take non-Array/String values', (t) => {
targets.supported.digits = new Set(['64', '65'])
t.notOk(targets.validateListFromOptions({digits: 64}, 'digits') instanceof Array,
Expand Down

0 comments on commit 43397e8

Please sign in to comment.