test('clinic bubbleprof -v', function (t) { cli({}, ['clinic', 'bubbleprof', '-v'], function (err, stdout) { t.ifError(err) t.strictEqual( stdout, `v${require('@nearform/bubbleprof/package.json').version}\n` ) t.end() }) })
[ './file-proxy', './plugin-handler', './http-proxy', './final-handler', './error-handler'].map(function(mod) { return require(mod); })
var loadModule = function(filepath) { try { return require(filepath); } catch (e) {} }
describe('server listening', () => { it('should be listening', async () => { const server = require('../index.js'); const isOpen = await waitPort({port: PORT}); expect(isOpen).to.be.true; server.close(); }); });
// Start listening Promise.fromNode(cb => { api.listen(config.LANDO_API_PORT, cb); }) // Load our routes .then(() => { fs.readdirSync(path.join(__dirname, 'routes')).map(file => { require(`./routes/${file}`)(api, handler, {config, slack}); log.info('Loaded route %s', file); }); log.info('Listening on port: %s', config.LANDO_API_PORT); });
_(config.LANDO_METRICS_PLUGINS) .map(plugin => _.merge({}, plugin, {path: path.resolve(__dirname, 'plugins', `${plugin.name}.js`)})) .filter(plugin => fs.existsSync(plugin.path)) .map(plugin => _.merge({}, plugin, {Reporter: require(plugin.path)})) .value()
/* * Toggle a toggle */ updateUserConfig(data = {}) { const Yaml = require('./yaml'); const yaml = new Yaml(); const configFile = path.join(this.defaultConfig().userConfRoot, 'config.yml'); const config = (fs.existsSync(configFile)) ? yaml.load(configFile) : {}; const file = yaml.dump(configFile, _.assign({}, config, data)); return yaml.load(file); }
(function main() { const version = require('./package.json').version; let preload = fs.readFileSync('./lib/preload/ndb/preload.js', 'utf8'); preload = preload.replace(/process\.versions\['ndb'\] = '[\d+\.]+';/, `process.versions['ndb'] = '${version}';`); fs.writeFileSync('./lib/preload/ndb/preload.js', preload, 'utf8'); })();
async function init(frontend, env, cols, rows) { try { const pty = require('node-pty'); return rpc.handle(new Terminal(frontend, pty, env, cols, rows)); } catch (e) { await frontend.initFailed(e.stack); setImmediate(() => process.exit(0)); return null; } }
require("child_process").exec(`ps -o comm --no-headers --sort=+pid -g ${pid} | tail -1`, (e, proc) => { if (e !== null) { reject(e); } else { resolve(proc.trim()); } });
function tocHtml() { if (tocHtml_) return tocHtml_; const MarkdownIt = require('markdown-it'); const markdownIt = new MarkdownIt(); let md = tocMd(); md = md.replace(/# Table of contents/, ''); md = replaceGitHubByJoplinAppLinks(md); tocHtml_ = markdownIt.render(md); tocHtml_ = `<div id="toc">${tocHtml_}</div>`; return tocHtml_; }
(GPU.isHeadlessGLSupported ? test : skip)('getFeatures() headlessgl', () => { const canvas = null; const context = require('gl')(1, 1); testGetFeatures(canvas, context); });
/* * Helper to load request library * We do this for testing so we can stub axios and ensure it isn't auto cached * via require when we new Lando() */ const requestClient = () => { const axios = require('axios'); // @todo: is it ok to turn redirects off here? // if we don't we get an error every time http tries to redirect to https return axios.create({maxRedirects: 0, httpsAgent: new https.Agent({rejectUnauthorized: false})}); }
test('clinic --version', function (t) { cli({}, ['clinic', '--version'], function (err, stdout) { t.ifError(err) t.strictEqual( stdout, `v${require('../package.json').version}\n` ) t.end() }) })
test('clinic doctor -v', function (t) { cli({}, ['clinic', 'doctor', '-v'], function (err, stdout) { t.ifError(err) t.strictEqual( stdout, `v${require('@nearform/doctor/package.json').version}\n` ) t.end() }) })