Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
suiteSetup(async function() {
chai.should();
service.start({
port: 3000,
// Make sure that our fake adb gets used instead of the real thing.
adbPath: path.resolve(__dirname, './adb')
});
await tcpPortUsed.waitUntilUsed(3000);
});
fp(3000, (err, port) => {
const webpackApp = execa('yarn', ['start:dev', '--port', port]);
webpackApp.stdout.pipe(process.stdout);
tcpPortUsed.waitUntilUsed(port, 500, 1000 * 60 * 5)
.then(() => {
const cypressShell = execa('cypress', ['run', '--config', `baseUrl=http://localhost:${port}`]);
cypressShell.stdout.pipe(process.stdout);
return cypressShell;
})
.then(() => kill(port))
.then(() => process.exit(0))
.catch((err) => { console.error(err); process.exit(1); }); // eslint-disable-line no-shadow
});
run(options) {
const openUrl = openUrls[options.open];
const port = parseInt(url.parse(openUrl).port, 10);
if(port) {
// wait for whatever (storybook/gatsby) to be listening on the port
// try every 500ms and give up after 30s
tcpPortUsed.waitUntilUsed(port, 500, 30000)
.then(() => open(openUrl))
.catch(e => console.error(e.stack));
}
return tasks.start.run(options);
},
}),
export async function waitForDebugPort(
debugPort: number,
timeoutDuration: number,
channelLogger: ChannelLogger
): Promise {
try {
// this function always attempts once no matter the timeoutDuration
await tcpPortUsed.waitUntilUsed(debugPort, SAM_LOCAL_PORT_CHECK_RETRY_INTERVAL_MILLIS, timeoutDuration)
} catch (err) {
getLogger().warn(`Timed out after ${timeoutDuration} ms waiting for port ${debugPort} to open`, err as Error)
channelLogger.warn(
'AWS.samcli.local.invoke.port.not.open',
// tslint:disable-next-line:max-line-length
"The debug port doesn't appear to be open. The debugger might not succeed when attaching to your SAM Application."
)
}
}
'127.0.0.1:8888',
'calendarserver.php'
], {
cwd: __dirname + '/SabreDAV'
});
server.stdout.on('data', function(chunk) {
debug(chunk.toString());
});
server.stderr.on('data', function(chunk) {
debug(chunk.toString());
});
debug('Wait for dav server to start.');
return tcpPortUsed.waitUntilUsed(8888, 100, 20000);
});
if (!fs.existsSync(command)) {
console.log('Could not find chromedriver in default path: ', command);
console.log('Falling back to use global chromedriver bin');
command = process.platform === 'win32' ? 'chromedriver.exe' : 'chromedriver';
}
const cp = require('child_process').spawn(command, args);
cp.stdout.pipe(process.stdout);
cp.stderr.pipe(process.stderr);
exports.defaultInstance = cp;
if (!returnPromise) {
return cp;
}
const port = getPortFromArgs(args);
const pollInterval = 100;
const timeout = 10000;
return tcpPortUsed.waitUntilUsed(port, pollInterval, timeout)
.then(function () {
return cp;
});
};
exports.stop = function () {
proxy: 'http://localhost:' + configs.port,
files: [configs.static_dir + 'css/*.css'],
port: configs.BSport,
online: false,
open: false,
snippetOptions: {
rule: {
match: /<\/html>$/,
fn: function (s, m) {
return m + s;
}
}
}
});
TPU.waitUntilUsed(configs.port, 200, 30000).then(function () {
serverStarted = true;
browserSync.reload();
});
}
});
});
.then(nextAvailablePort => {
url = `${protocol}://${ip}:${nextAvailablePort}`;
return tcpPortUsed.waitUntilUsed(nextAvailablePort, retryIntervalMs, timeoutMs);
})
.then(() => {