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() }) })
// backup crontab db app.get(routes.backup, function(req, res) { crontab.backup(); res.end(); });
function onend() { if ( didOnEnd ) return; didOnEnd = true; dest.end(); }
describe('API /healthz', () => { it('it should return 200', (done) => { chai.request(app) .get('/healthz') .end((err, res) => { res.should.have.status(200); done(); }); }); });
tape("configBadFileSync", (test) => { test.plan(1); test.throws( function badFileCall() { markdownlint.readConfigSync("./test/config/config-badfile.json"); }, /ENOENT/, "Did not get correct exception for bad file." ); test.end(); });
it('should be chainable', function() { expect(base.setHeader('one', '1')).to.equal(base); expect(base.setHeaders({ one: '1' })).to.equal(base); expect(base.type('text/plain')).to.equal(base); expect(base.send('body')).to.equal(base); expect(base.json({ foo: 'bar' })).to.equal(base); expect(base.end()).to.equal(base); });
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() }) })
// remove a job app.post(routes.remove, function(req, res) { crontab.remove(req.body._id); res.end(); });
test('clinic bubbleprof --version', function (t) { cli({}, ['clinic', 'bubbleprof', '--version'], function (err, stdout) { t.ifError(err) t.strictEqual( stdout, `v${require('@nearform/bubbleprof/package.json').version}\n` ) t.end() }) })
test('clinic', function (t) { cli({}, ['clinic'], function (err, stdout) { t.strictDeepEqual(err, new Error('process exited with exit code 1')) t.ok(/Clinic[^\w ]/.test(stdout.split('\n')[1])) t.end() }) })
test('clinic clean --help', function (t) { cli({}, ['clinic', 'clean', '--help'], function (err, stdout) { t.ifError(err) t.ok(/Clinic.js Clean[^\w ]/.test(stdout.split('\n')[1])) t.end() }) })
test('clinic doctor - should accept full path to node.js', function (t) { cli({}, ['clinic', 'doctor', '--no-open', '--', process.execPath, '-e', 'setTimeout(() => {}, 10)'], function (err, stdout) { t.ifError(err) t.ok(/Generated HTML file is (.*?)\.clinic[/\\](\d+).clinic-doctor/.test(stdout)) t.end() }) })
test('clinic clean -h', function (t) { cli({}, ['clinic', 'clean', '-h'], function (err, stdout) { t.ifError(err) t.ok(/Clinic.js Clean[^\w ]/.test(stdout.split('\n')[1])) t.end() }) })
test('clinic doctor - should error early if non-node script', function (t) { cli({}, ['clinic', 'doctor', '--', 'sh', 'wrapper.sh'], function (err, stdout) { t.strictDeepEqual(err, new Error('process exited with exit code 1')) t.ok(/Clinic.js Doctor[^\w ]/.test(stdout.split('\n')[1])) t.end() }) })
test('clinic flame -h', function (t) { cli({}, ['clinic', 'flame', '-h'], function (err, stdout) { t.ifError(err) t.ok(/Clinic.js Flame[^\w ]/.test(stdout.split('\n')[1])) t.end() }) })