fix(core): update

This commit is contained in:
Philipp Kunz 2021-08-17 15:22:10 +02:00
parent ed1522062e
commit 87d7460183
5 changed files with 16 additions and 6 deletions

7
package-lock.json generated
View File

@ -11,7 +11,8 @@
"dependencies": {
"@pushrocks/smartdelay": "^2.0.13",
"@pushrocks/smartenv": "^4.0.16",
"puppeteer": "^10.2.0"
"puppeteer": "^10.2.0",
"tree-kill": "^1.2.2"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.26",
@ -13680,7 +13681,6 @@
"version": "1.2.2",
"resolved": "https://verdaccio.lossless.one/tree-kill/-/tree-kill-1.2.2.tgz",
"integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==",
"dev": true,
"license": "MIT",
"bin": {
"tree-kill": "cli.js"
@ -24975,8 +24975,7 @@
"tree-kill": {
"version": "1.2.2",
"resolved": "https://verdaccio.lossless.one/tree-kill/-/tree-kill-1.2.2.tgz",
"integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==",
"dev": true
"integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A=="
},
"trim-right": {
"version": "1.0.1",

View File

@ -23,7 +23,8 @@
"dependencies": {
"@pushrocks/smartdelay": "^2.0.13",
"@pushrocks/smartenv": "^4.0.16",
"puppeteer": "^10.2.0"
"puppeteer": "^10.2.0",
"tree-kill": "^1.2.2"
},
"files": [
"ts/**/*",

View File

@ -5,7 +5,15 @@ tap.test('first test', async (tools) => {
const headlessBrowser = await smartpuppeteer.getEnvAwareBrowserInstance({
forceNoSandbox: true,
});
const page = await headlessBrowser.newPage();
await headlessBrowser.close();
});
tap.test('should get and stop an Incognito browser', async () => {
const incognitoInstance = new smartpuppeteer.IncognitoBrowser();
await incognitoInstance.start();
const page = await incognitoInstance.browser.newPage();
await incognitoInstance.stop();
})
tap.start();

View File

@ -28,6 +28,7 @@ export class IncognitoBrowser {
*/
public async stop() {
this.status = 'stopped';
plugins.treeKill(this.browser.process().pid);
await this.browser.close();
}

View File

@ -11,5 +11,6 @@ export { smartdelay, smartenv };
// third party scope
import puppeteer from 'puppeteer';
import treeKill from 'tree-kill';
export { puppeteer };
export { puppeteer, treeKill };