smoke - use tree kill also here

This commit is contained in:
Benjamin Pasero 2020-02-26 09:04:03 +01:00
parent 3de5a8a6a2
commit afcaaa6131
3 changed files with 12 additions and 8 deletions

View file

@ -28,7 +28,8 @@
"concurrently": "^3.5.1",
"cpx": "^1.5.0",
"typescript": "3.7.5",
"watch": "^1.0.2"
"watch": "^1.0.2",
"tree-kill": "1.2.2"
},
"dependencies": {
"mkdirp": "^0.5.1",

View file

@ -10,6 +10,7 @@ import { mkdir } from 'fs';
import { promisify } from 'util';
import { IDriver, IDisposable } from './driver';
import { URI } from 'vscode-uri';
import * as kill from 'tree-kill';
const width = 1200;
const height = 800;
@ -93,6 +94,7 @@ let workspacePath: string | undefined;
export async function launch(userDataDir: string, _workspacePath: string, codeServerPath = process.env.VSCODE_REMOTE_SERVER_PATH): Promise<void> {
workspacePath = _workspacePath;
const agentFolder = userDataDir;
await promisify(mkdir)(agentFolder);
const env = {
@ -121,7 +123,7 @@ export async function launch(userDataDir: string, _workspacePath: string, codeSe
function teardown(): void {
if (server) {
server.kill();
kill(server.pid);
server = undefined;
}
}
@ -137,13 +139,9 @@ function waitForEndpoint(): Promise<string> {
});
}
export function connect(engine: 'chromium' | 'webkit' | 'firefox' = 'chromium'): Promise<{ client: IDisposable, driver: IDriver }> {
export function connect(browserType: 'chromium' | 'webkit' | 'firefox' = 'chromium'): Promise<{ client: IDisposable, driver: IDriver }> {
return new Promise(async (c) => {
const browser = await playwright[engine].launch({
// Run in Edge dev on macOS
// executablePath: '/Applications/Microsoft\ Edge\ Dev.app/Contents/MacOS/Microsoft\ Edge\ Dev',
headless: false
});
const browser = await playwright[browserType].launch({ headless: false, dumpio: true });
const context = await browser.newContext();
const page = await context.newPage();
await page.setViewportSize({ width, height });

View file

@ -1634,6 +1634,11 @@ to-regex@^3.0.1, to-regex@^3.0.2:
regex-not "^1.0.2"
safe-regex "^1.1.0"
tree-kill@1.2.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.2.tgz#4ca09a9092c88b73a7cdc5e8a01b507b0790a0cc"
integrity sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==
tree-kill@^1.1.0:
version "1.2.1"
resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.1.tgz#5398f374e2f292b9dcc7b2e71e30a5c3bb6c743a"