0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-01 13:24:25 +01:00

Rename variables and remove unneeded return.

This commit is contained in:
XhmikosR 2017-09-29 19:27:32 +03:00
parent 874fd5b952
commit 7b514f48c7

View File

@ -17,13 +17,12 @@ const jsUnitSaucelabs = new JSUnitSaucelabs({
const testURL = 'http://localhost:3000/js/tests/index.html?hidepassed' const testURL = 'http://localhost:3000/js/tests/index.html?hidepassed'
const browsersFile = require(path.resolve(__dirname, './sauce_browsers.json')) const browsersFile = require(path.resolve(__dirname, './sauce_browsers.json'))
let jobsDone = 0 let jobsDone = 0
let jobsSuccess = 0 let jobsSucceeded = 0
const waitingCallback = (error, body, id) => { const waitingCallback = (error, body, id) => {
if (error) { if (error) {
console.error(error) console.error(error)
process.exit(1) process.exit(1)
return
} }
if (typeof body !== 'undefined') { if (typeof body !== 'undefined') {
@ -55,14 +54,14 @@ const waitingCallback = (error, body, id) => {
} }
if (passed) { if (passed) {
jobsSuccess++ jobsSucceeded++
} }
jobsDone++ jobsDone++
// Exit // Exit
if (jobsDone === browsersFile.length - 1) { if (jobsDone === browsersFile.length - 1) {
jsUnitSaucelabs.stop() jsUnitSaucelabs.stop()
process.exit(jobsDone === jobsSuccess ? 0 : 1) process.exit(jobsDone === jobsSucceeded ? 0 : 1)
} }
} }
} }
@ -70,14 +69,15 @@ const waitingCallback = (error, body, id) => {
jsUnitSaucelabs.on('tunnelCreated', () => { jsUnitSaucelabs.on('tunnelCreated', () => {
browsersFile.forEach((tmpBrowser) => { browsersFile.forEach((tmpBrowser) => {
const broPlatform = typeof tmpBrowser.platform === 'undefined' ? tmpBrowser.platformName : tmpBrowser.platform const browsersPlatform = typeof tmpBrowser.platform === 'undefined' ? tmpBrowser.platformName : tmpBrowser.platform
const arrayBro = [broPlatform, tmpBrowser.browserName, tmpBrowser.version] const browsersArray = [browsersPlatform, tmpBrowser.browserName, tmpBrowser.version]
jsUnitSaucelabs.start([arrayBro], testURL, 'qunit', (error, success) => {
jsUnitSaucelabs.start([browsersArray], testURL, 'qunit', (error, success) => {
if (typeof success !== 'undefined') { if (typeof success !== 'undefined') {
const taskIds = success['js tests'] const taskIds = success['js tests']
if (!taskIds || !taskIds.length) { if (!taskIds || !taskIds.length) {
throw new Error('Error starting tests through SauceLabs API') throw new Error('Error starting tests through Sauce Labs API')
} }
taskIds.forEach((id) => { taskIds.forEach((id) => {
@ -91,4 +91,5 @@ jsUnitSaucelabs.on('tunnelCreated', () => {
}) })
}) })
}) })
jsUnitSaucelabs.initTunnel() jsUnitSaucelabs.initTunnel()