test: convert functions to async & eliminate duplicates (#37316)
test: convert functions to async Co-authored-by: Milan Burda <miburda@microsoft.com>
This commit is contained in:
parent
969665eaa2
commit
f97d68c4bf
24 changed files with 225 additions and 343 deletions
|
@ -5,8 +5,8 @@ import * as os from 'os';
|
|||
import * as path from 'path';
|
||||
import * as ChildProcess from 'child_process';
|
||||
import { session, net } from 'electron/main';
|
||||
import { Socket, AddressInfo } from 'net';
|
||||
import { ifit } from './lib/spec-helpers';
|
||||
import { Socket } from 'net';
|
||||
import { ifit, listen } from './lib/spec-helpers';
|
||||
import { emittedOnce } from './lib/events-helpers';
|
||||
|
||||
const appPath = path.join(__dirname, 'fixtures', 'api', 'net-log');
|
||||
|
@ -20,12 +20,8 @@ describe('netLog module', () => {
|
|||
let serverUrl: string;
|
||||
const connections: Set<Socket> = new Set();
|
||||
|
||||
before(done => {
|
||||
before(async () => {
|
||||
server = http.createServer();
|
||||
server.listen(0, '127.0.0.1', () => {
|
||||
serverUrl = `http://127.0.0.1:${(server.address() as AddressInfo).port}`;
|
||||
done();
|
||||
});
|
||||
server.on('connection', (connection) => {
|
||||
connections.add(connection);
|
||||
connection.once('close', () => {
|
||||
|
@ -35,6 +31,7 @@ describe('netLog module', () => {
|
|||
server.on('request', (request, response) => {
|
||||
response.end();
|
||||
});
|
||||
serverUrl = (await listen(server)).url;
|
||||
});
|
||||
|
||||
after(done => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue