@web/test-runner-playwright
Advanced tools
Comparing version 0.5.2 to 0.5.3
# @web/test-runner-playwright | ||
## 0.5.3 | ||
### Patch Changes | ||
- 22c85b5: fix handle race condition when starting browser | ||
## 0.5.2 | ||
@@ -4,0 +10,0 @@ |
@@ -23,2 +23,3 @@ import playwright, { Browser, Page, LaunchOptions } from 'playwright'; | ||
private testCoveragePerSession; | ||
private __launchBrowserPromise?; | ||
constructor(product: ProductType, launchOptions: LaunchOptions, createPageFunction?: CreatePageFunction | undefined); | ||
@@ -25,0 +26,0 @@ start(config: TestRunnerCoreConfig, testFiles: string[]): Promise<void>; |
@@ -88,4 +88,9 @@ "use strict"; | ||
var _a; | ||
if (this.__launchBrowserPromise) { | ||
return this.__launchBrowserPromise; | ||
} | ||
if (!this.browser || !((_a = this.browser) === null || _a === void 0 ? void 0 : _a.isConnected())) { | ||
this.browser = await playwright_1.default[this.product].launch(this.launchOptions); | ||
this.__launchBrowserPromise = playwright_1.default[this.product].launch(this.launchOptions); | ||
this.browser = await this.__launchBrowserPromise; | ||
this.__launchBrowserPromise = undefined; | ||
} | ||
@@ -92,0 +97,0 @@ return this.browser; |
{ | ||
"name": "@web/test-runner-playwright", | ||
"version": "0.5.2", | ||
"version": "0.5.3", | ||
"publishConfig": { | ||
@@ -5,0 +5,0 @@ "access": "public" |
@@ -27,2 +27,3 @@ import playwright, { Browser, Page, LaunchOptions } from 'playwright'; | ||
private testCoveragePerSession = new Map<string, CoverageMapData>(); | ||
private __launchBrowserPromise?: Promise<Browser>; | ||
@@ -112,4 +113,10 @@ constructor( | ||
private async getOrStartBrowser(): Promise<Browser> { | ||
if (this.__launchBrowserPromise) { | ||
return this.__launchBrowserPromise; | ||
} | ||
if (!this.browser || !this.browser?.isConnected()) { | ||
this.browser = await playwright[this.product].launch(this.launchOptions); | ||
this.__launchBrowserPromise = playwright[this.product].launch(this.launchOptions); | ||
this.browser = await this.__launchBrowserPromise; | ||
this.__launchBrowserPromise = undefined; | ||
} | ||
@@ -116,0 +123,0 @@ return this.browser; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
42627
528
0