Update ci script to pass linting

This commit is contained in:
Gregg Van Hove
2019-06-12 12:15:34 -07:00
parent c73c5a9dbd
commit 0f4e53d0e6

View File

@@ -1,16 +1,14 @@
const path = require("path"), /* eslint-env node, es6 */
fs = require('fs'), const path = require('path'),
util = require('util'), jasmineBrowser = require('jasmine-browser-runner'),
jasmineBrowser = require('jasmine-browser-runner'), jasmineCore = require('../../lib/jasmine-core'),
ConsoleReporter = require('jasmine').ConsoleReporter, useSauce = process.env.USE_SAUCE === 'true';
jasmineCore = require('../../lib/jasmine-core'),
useSauce = process.env.USE_SAUCE === 'true';
var config = require(path.resolve('spec/support/jasmine-browser.json')); var config = require(path.resolve('spec/support/jasmine-browser.json'));
config.jasmineCore = jasmineCore; config.jasmineCore = jasmineCore;
function buildWebdriver() { function buildWebdriver() {
const webdriver = require("selenium-webdriver"), const webdriver = require('selenium-webdriver'),
Capability = webdriver.Capability; Capability = webdriver.Capability;
if (useSauce) { if (useSauce) {
const username = process.env['SAUCE_USERNAME'], const username = process.env['SAUCE_USERNAME'],
@@ -23,26 +21,32 @@ function buildWebdriver() {
[Capability.VERSION]: process.env['SAUCE_BROWSER_VERSION'], [Capability.VERSION]: process.env['SAUCE_BROWSER_VERSION'],
build: `Core ${process.env['TRAVIS_BUILD_NUMBER'] || 'Ran locally'}`, build: `Core ${process.env['TRAVIS_BUILD_NUMBER'] || 'Ran locally'}`,
tags: ['Jasmine-Core'], tags: ['Jasmine-Core'],
"tunnel-identifier": process.env['TRAVIS_JOB_NUMBER'] ? process.env['TRAVIS_JOB_NUMBER'].toString() : null 'tunnel-identifier': process.env['TRAVIS_JOB_NUMBER']
? process.env['TRAVIS_JOB_NUMBER'].toString()
: null
}) })
.usingServer(`http://${username}:${accessKey}@localhost:4445/wd/hub`) .usingServer(`http://${username}:${accessKey}@localhost:4445/wd/hub`)
.build(); .build();
} else { } else {
return new webdriver.Builder() return new webdriver.Builder()
.forBrowser(process.env["JASMINE_BROWSER"] || "firefox") .forBrowser(process.env['JASMINE_BROWSER'] || 'firefox')
.build(); .build();
} }
} }
const driver = buildWebdriver(); const driver = buildWebdriver();
jasmineBrowser.runSpecs(config, driver).then(function(runDetails) { jasmineBrowser
process.exitCode = runDetails.overallStatus === 'passed' ? 0 : 1; .runSpecs(config, driver)
.then(function(runDetails) {
process.exitCode = runDetails.overallStatus === 'passed' ? 0 : 1;
if (useSauce) { if (useSauce) {
driver.executeScript(`sauce:job-result=${process.exitCode === 0}`); driver.executeScript(`sauce:job-result=${process.exitCode === 0}`);
} }
}).catch(error => { })
console.error(error); .catch(error => {
}).then(function () { console.error(error);
return driver ? driver.close() : true; })
}); .then(function() {
return driver ? driver.close() : true;
});