test('cli errors if legacy --electron flag is set', function (t) { const cwd = tempy.directory() writeConfig(cwd, { providers: ['airtap-ignored-foo'], browsers: [{ name: 'test' }] }) exec(`node ${bin} --electron test.js`, { env, cwd }, (err, stdout, stderr) => { t.ok(err, 'should error') t.is(stderr.trim(), read('no-electron.txt').trim()) t.end() }) })
function isRunning(pid, callback) { pid ? cp.exec(util.format(CHECK_RUNNING_CMD, pid), function (err, stdout, stderr) { callback(!err && !!stdout.toString().trim()); }) : callback(); }
test('cli errors if browsers is ' + JSON.stringify(input), function (t) { const cwd = tempy.directory() const config = input === undefined ? {} : { browsers: input } writeConfig(cwd, { providers: ['airtap-default'], ...config }) exec(`node ${bin} test.js`, { env, cwd }, (err, stdout, stderr) => { t.ok(err, 'should error') t.is(stderr.trim(), read('no-input.txt').trim()) t.end() }) })
describe(`Typescript`, () => { describe(`build`, () => { it(`must build without error`, done => { exec(`tsc`, {cwd: path.join(`test`, `typescript`)}, error => { expect(error).toBe(null); done(); }); }); }); });
test('cli errors if no files are specified', function (t) { exec(`node ${bin}`, { env }, (err, stdout, stderr) => { t.ok(err, 'should error') t.is(stderr.trim(), 'At least one file must be specified.') t.end() }) })
function doTask(date) { const env = {DATE: date} console.log('DATE=', date) const p1 = exec('node reduce.js', {env: env}, (err) => { assert.ifError(err) const p2 = exec('indexer -c sphinx.conf hash_delta --rotate', {env: env}, (err) => { assert.ifError(err) const p3 = exec('indexer -c sphinx.conf --merge hash hash_delta --rotate', (err) => { assert.ifError(err) console.log(new Date(), date, 'task done') }) p3.stdout.pipe(process.stdout) }) p2.stdout.pipe(process.stdout) }) p1.stdout.pipe(process.stdout) }
function sendFile(filePath, res) { if(filePath.match(/files/)) { let dirName = `${filePath}.tar.gz` exec(`tar -zcvf ${dirName} ${filePath}`, (error, stdout, stderr) => { if (error) { cons(`exec error: ${error}`);
test('cli errors if provider does not exist', function (t) { const cwd = tempy.directory() writeConfig(cwd, { providers: ['airtap-non-existing-abc'], browsers: [{ name: 'test' }] }) exec(`node ${bin} test.js`, { env, cwd }, (err, stdout, stderr) => { t.ok(err, 'should error') t.ok(/cannot find module/i.test(stderr)) t.end() }) })
test('cli prints out version with -v', function (t) { exec(`node ${bin} -v`, { env }, (err, stdout, stderr) => { t.ifError(err, 'no error') t.is(stdout.trim(), '3.0.0') t.is(stderr.trim(), '') t.end() }) })
test('cli warns if sauce labs credentials are provided in root config', function (t) { const cwd = tempy.directory() const expected = read('deprecated-creds.txt') writeConfig(cwd, { username: 'test', key: 'test', providers: ['airtap-ignored-abc'], browsers: [{ name: 'test' }] }) exec(`node ${bin} test.js`, { env, cwd }, (err, stdout, stderr) => { t.ok(err, 'should error') t.is(stderr.trim().slice(0, expected.length), expected) t.end() }) })
var getFingerprint = function(certfile) { return new Promise(function(resolve, reject) { exec('openssl x509 -noout -in ' + certfile + ' -fingerprint -sha256', { cwd: global.paths.basepath }, function(error, stdout, stderr) { var filter = /=([A-F0-9\:]*)/; var matches = filter.exec(stdout) var fingerprint = matches[1]; resolve(fingerprint); }); }); }
test('cli errors if legacy --local and --open flags are set', function (t) { const cwd = tempy.directory() writeConfig(cwd, { providers: ['airtap-ignored-foo'], browsers: [{ name: 'test' }] }) exec(`node ${bin} --local --open test.js`, { env, cwd }, (err, stdout, stderr) => { t.ok(err, 'should error') t.is(stderr.trim(), read('no-local-open.txt').trim()) t.end() }) })
test('cli errors if legacy --local flag is set', function (t) { const cwd = tempy.directory() writeConfig(cwd, { providers: ['airtap-ignored-foo'], browsers: [{ name: 'test' }] }) exec(`node ${bin} --local test.js`, { env, cwd }, (err, stdout, stderr) => { t.ok(err, 'should error') t.is(stderr.trim(), read('no-local.txt').trim()) t.end() }) })
test('cli errors if providers is ' + JSON.stringify(input), function (t) { const cwd = tempy.directory() const config = input === undefined ? {} : { providers: input } writeConfig(cwd, { ...config }) exec(`node ${bin} test.js`, { env, cwd }, (err, stdout, stderr) => { t.ok(err, 'should error') t.is(stderr.trim(), read('no-input.txt').trim()) t.end() }) })