mirror of
https://github.com/twbs/bootstrap.git
synced 2025-01-17 09:52:29 +01:00
ES6-ify build/saucelabs-unit-test.js.
This commit is contained in:
parent
210bb221a8
commit
bec0eb21d5
@ -1,6 +1,6 @@
|
||||
const JSUnitSaucelabs = require('jsunitsaucelabs')
|
||||
|
||||
var jsUnitSaucelabs = new JSUnitSaucelabs({
|
||||
const jsUnitSaucelabs = new JSUnitSaucelabs({
|
||||
username: process.env.SAUCE_USERNAME,
|
||||
password: process.env.SAUCE_ACCESS_KEY
|
||||
})
|
||||
@ -8,17 +8,18 @@ var jsUnitSaucelabs = new JSUnitSaucelabs({
|
||||
|
||||
// TODO : get all the browsers in sauce_browsers.yml
|
||||
|
||||
var testURL = 'http://localhost:3000/js/tests/index.html?hidepassed'
|
||||
const testURL = 'http://localhost:3000/js/tests/index.html?hidepassed'
|
||||
|
||||
jsUnitSaucelabs.start([
|
||||
['Windows 8', 'internet explorer', '10']
|
||||
], testURL, 'qunit', function (error, success) {
|
||||
], testURL, 'qunit', (error, success) => {
|
||||
if (typeof success !== 'undefined') {
|
||||
var taskIds = success['js tests']
|
||||
const taskIds = success['js tests']
|
||||
if (!taskIds || !taskIds.length) {
|
||||
throw new Error('Error starting tests through SauceLabs API')
|
||||
}
|
||||
|
||||
var waitingCallback = function (error, success) {
|
||||
const waitingCallback = (error, success) => {
|
||||
if (error) {
|
||||
console.error(error)
|
||||
return
|
||||
@ -28,20 +29,20 @@ jsUnitSaucelabs.start([
|
||||
if (!success.completed) {
|
||||
jsUnitSaucelabs.getStatus(taskIds[0], waitingCallback)
|
||||
} else {
|
||||
var test = success['js tests'][0]
|
||||
var passed = false
|
||||
const test = success['js tests'][0]
|
||||
let passed = false
|
||||
if (test.result !== null) {
|
||||
passed = test.result.total === test.result.passed
|
||||
}
|
||||
console.log('Tested ' + testURL)
|
||||
console.log('Platform: ' + test.platform.join(','))
|
||||
console.log('Passed: ' + passed.toString())
|
||||
console.log('Url ' + test.url)
|
||||
console.log(`Tested ${testURL}`)
|
||||
console.log(`Platform: ${test.platform.join(',')}`)
|
||||
console.log(`Passed: ${passed.toString()}`)
|
||||
console.log(`Url ${test.url}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
taskIds.forEach(function (id) {
|
||||
taskIds.forEach((id) => {
|
||||
jsUnitSaucelabs.getStatus(id, waitingCallback)
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user