本文整理汇总了TypeScript中get-port.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: startNonCodeNodeKibana
before(async function() {
nonCodePort = await getPort();
codePort = await getPort();
// @ts-ignore
await startServers.bind(this)();
await startNonCodeNodeKibana();
});
示例2: buildGoExecutable
export const newTest = async (pluginsDir = ''): Promise<GotifyTest> => {
const port = await getPort();
const gotifyFile = testFilePath();
await buildGoExecutable(gotifyFile);
const gotifyInstance = startGotify(gotifyFile, port, pluginsDir);
const gotifyURL = 'http://localhost:' + port;
await waitForGotify('http-get://localhost:' + port);
const browser = await puppeteer.launch({
headless: process.env.CI === 'true',
args: [`--window-size=1920,1080`, '--no-sandbox'],
});
const page = await browser.newPage();
await page.setViewport({width: 1920, height: 1080});
await page.goto(gotifyURL);
return {
close: async () => {
await Promise.all([
browser.close(),
new Promise((resolve) => kill(gotifyInstance.pid, 'SIGKILL', () => resolve())),
]);
rimraf.sync(gotifyFile, {maxBusyTries: 8});
},
url: gotifyURL,
browser,
page,
};
};
示例3: suiteSetup
suiteSetup(async () => {
let port = await getPort();
server = new ServerMock(null,
{
host: "localhost",
port: port,
key: await fs.readFile("test/unitTests/testAssets/private.pem"),
cert: await fs.readFile("test/unitTests/testAssets/public.pem")
});
httpsServerUrl = `https://127.0.0.1:${port}`;
});
示例4: setPort
function setPort(name: string) {
let port = config.app[name.toLowerCase()] || process.env[name];
port = parseInt(port);
return getPort({
port: port
}).then(function(result) {
if (result != port) {
console.log(`${name}: ${port} was taken`);
}
process.env[name] = result;
});
}
示例5: CreateMockHttpsServer
public static async CreateMockHttpsServer(): Promise<MockHttpsServer> {
let port = await getPort();
let server = new ServerMock(null,
{
host: "localhost",
port: port,
key: await fs.readFile("test/unitTests/testAssets/private.pem"),
cert: await fs.readFile("test/unitTests/testAssets/public.pem")
});
return new MockHttpsServer(server, `https://localhost:${port}`);
}
示例6: async
return async (): Promise<TestServer> => {
const port = await getPort();
const server = http.createServer(fn) as TestServer;
server.host = host;
server.port = port;
server.url = `http://${host}:${port}`;
server.protocol = 'http';
server.listen(port);
server.close = pify(server.close);
return server;
};
示例7: createServer
export function createServer () {
return getPort().then(port => {
const s = http.createServer((req, resp) => s.emit(req.url, req, resp));
s.host = host;
s.port = port;
s.url = `http://${host}:${port}`;
s.protocol = 'http';
s.listen = pify(s.listen, Promise);
s.close = pify(s.close, Promise);
return s;
});
};
示例8: getPort
async getPort() {
if (!this.options.lsp.detach) {
return await getPort();
}
return TS_LANG_DETACH_PORT;
}