Skip to content

Commit

Permalink
Merge pull request #328 from malept/less-test-redundancy
Browse files Browse the repository at this point in the history
Don't need to test every single platform/arch combo for basic tests
  • Loading branch information
malept committed Apr 17, 2016
2 parents a71992f + 1923a18 commit 2b17248
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 23 deletions.
36 changes: 18 additions & 18 deletions test/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -509,26 +509,26 @@ test('download argument test: download.{arch,platform,version} does not overwrit
t.end()
})

util.testAllPlatforms('infer test', createInferTest)
util.testAllPlatforms('defaults test', createDefaultsTest)
util.testAllPlatforms('default_app.asar removal test', createDefaultAppAsarTest)
util.testAllPlatforms('out test', createOutTest)
util.testAllPlatforms('asar test', createAsarTest)
util.testAllPlatforms('prune test', createPruneTest)
util.testAllPlatforms('ignore test: string in array', createIgnoreTest, ['ignorethis'], 'ignorethis.txt')
util.testAllPlatforms('ignore test: string', createIgnoreTest, 'ignorethis', 'ignorethis.txt')
util.testAllPlatforms('ignore test: RegExp', createIgnoreTest, /ignorethis/, 'ignorethis.txt')
util.testAllPlatforms('ignore test: Function', createIgnoreTest, function (file) { return file.match(/ignorethis/) }, 'ignorethis.txt')
util.testAllPlatforms('ignore test: string with slash', createIgnoreTest, 'ignore/this',
util.testSinglePlatform('infer test', createInferTest)
util.testSinglePlatform('defaults test', createDefaultsTest)
util.testSinglePlatform('default_app.asar removal test', createDefaultAppAsarTest)
util.testSinglePlatform('out test', createOutTest)
util.testSinglePlatform('asar test', createAsarTest)
util.testSinglePlatform('prune test', createPruneTest)
util.testSinglePlatform('ignore test: string in array', createIgnoreTest, ['ignorethis'], 'ignorethis.txt')
util.testSinglePlatform('ignore test: string', createIgnoreTest, 'ignorethis', 'ignorethis.txt')
util.testSinglePlatform('ignore test: RegExp', createIgnoreTest, /ignorethis/, 'ignorethis.txt')
util.testSinglePlatform('ignore test: Function', createIgnoreTest, function (file) { return file.match(/ignorethis/) }, 'ignorethis.txt')
util.testSinglePlatform('ignore test: string with slash', createIgnoreTest, 'ignore/this',
path.join('ignore', 'this.txt'))
util.testAllPlatforms('ignore test: only match subfolder of app', createIgnoreTest, 'electron-packager',
util.testSinglePlatform('ignore test: only match subfolder of app', createIgnoreTest, 'electron-packager',
path.join('electron-packager', 'readme.txt'))
util.testAllPlatforms('overwrite test', createOverwriteTest)
util.testAllPlatforms('tmpdir test', createTmpdirTest)
util.testAllPlatforms('tmpdir test', createDisableTmpdirUsingTest)
util.testAllPlatforms('ignore out dir test', createIgnoreOutDirTest, 'ignoredOutDir')
util.testAllPlatforms('ignore out dir test: unnormalized path', createIgnoreOutDirTest, './ignoredOutDir')
util.testAllPlatforms('ignore out dir test: unnormalized path', createIgnoreImplicitOutDirTest)
util.testSinglePlatform('overwrite test', createOverwriteTest)
util.testSinglePlatform('tmpdir test', createTmpdirTest)
util.testSinglePlatform('tmpdir test', createDisableTmpdirUsingTest)
util.testSinglePlatform('ignore out dir test', createIgnoreOutDirTest, 'ignoredOutDir')
util.testSinglePlatform('ignore out dir test: unnormalized path', createIgnoreOutDirTest, './ignoredOutDir')
util.testSinglePlatform('ignore out dir test: unnormalized path', createIgnoreImplicitOutDirTest)

util.setup()
test('fails with invalid arch', function (t) {
Expand Down
7 changes: 2 additions & 5 deletions test/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,9 @@ exports.teardown = function teardown () {
})
}

exports.testAllPlatforms = function testAllPlatforms (name, createTest /*, ...createTestArgs */) {
exports.testSinglePlatform = function testSinglePlatform (name, createTest /*, ...createTestArgs */) {
var args = slice.call(arguments, 2)
exports.setup()
exports.forEachCombination(function (combination) {
test(`${name}: ${combination.platform}-${combination.arch}`,
createTest.apply(null, [Object.assign({}, combination)].concat(args)))
})
test(name, createTest.apply(null, [{platform: 'linux', arch: 'x64', version: version}].concat(args)))
exports.teardown()
}

0 comments on commit 2b17248

Please sign in to comment.