@web/test-runner-chrome
Advanced tools
Comparing version 0.5.20 to 0.5.21
# @web/test-runner-chrome | ||
## 0.5.21 | ||
### Patch Changes | ||
- f924a9b: improve support for puppeteer firefox | ||
## 0.5.20 | ||
@@ -4,0 +10,0 @@ |
@@ -43,4 +43,12 @@ "use strict"; | ||
if (this.customPuppeteer) { | ||
const mergedOptions = Object.assign(Object.assign({}, this.launchOptions), options); | ||
// launch using a custom puppeteer instance | ||
return this.customPuppeteer.launch(Object.assign(Object.assign({}, this.launchOptions), options)); | ||
return this.customPuppeteer.launch(mergedOptions).catch(error => { | ||
if (mergedOptions.product === 'firefox') { | ||
console.warn('\nUsing puppeteer with firefox is experimental.\n' + | ||
'Check the docs at https://github.com/modernweb-dev/web/tree/master/packages/test-runner-puppeteer' + | ||
' to learn how to set it up.\n'); | ||
} | ||
throw error; | ||
}); | ||
} | ||
@@ -99,5 +107,6 @@ // launch using puppeteer-core, connecting to an installed browser | ||
}); | ||
await page.runSession(url, false); | ||
await page.runSession(url, true); | ||
} | ||
async createNewPage(browser) { | ||
var _a; | ||
const puppeteerPagePromise = (this.createPageFunction | ||
@@ -111,3 +120,3 @@ ? this.createPageFunction({ config: this.config, browser }) | ||
}); | ||
return new ChromeLauncherPage_1.ChromeLauncherPage(this.config, this.testFiles, await puppeteerPagePromise); | ||
return new ChromeLauncherPage_1.ChromeLauncherPage(this.config, this.testFiles, (_a = this.launchOptions.product) !== null && _a !== void 0 ? _a : 'chromium', await puppeteerPagePromise); | ||
} | ||
@@ -114,0 +123,0 @@ async stopSession(sessionId) { |
@@ -7,7 +7,8 @@ import { Page } from 'puppeteer-core'; | ||
private testFiles; | ||
private product; | ||
puppeteerPage: Page; | ||
private nativeInstrumentationEnabled; | ||
private nativeInstrumentationEnabledOnPage; | ||
private logs; | ||
constructor(config: TestRunnerCoreConfig, testFiles: string[], puppeteerPage: Page); | ||
runSession(url: string, coverage: boolean): Promise<void>; | ||
constructor(config: TestRunnerCoreConfig, testFiles: string[], product: string, puppeteerPage: Page); | ||
runSession(url: string, debug: boolean): Promise<void>; | ||
stopSession(): Promise<SessionResult>; | ||
@@ -14,0 +15,0 @@ private collectTestCoverage; |
@@ -7,7 +7,8 @@ "use strict"; | ||
class ChromeLauncherPage { | ||
constructor(config, testFiles, puppeteerPage) { | ||
constructor(config, testFiles, product, puppeteerPage) { | ||
this.config = config; | ||
this.testFiles = testFiles; | ||
this.product = product; | ||
this.puppeteerPage = puppeteerPage; | ||
this.nativeInstrumentationEnabled = false; | ||
this.nativeInstrumentationEnabledOnPage = false; | ||
this.logs = []; | ||
@@ -38,8 +39,10 @@ this.onConsoleMessage = (message) => { | ||
} | ||
async runSession(url, coverage) { | ||
async runSession(url, debug) { | ||
var _a; | ||
if (coverage && | ||
!this.nativeInstrumentationEnabled && | ||
((_a = this.config.coverageConfig) === null || _a === void 0 ? void 0 : _a.nativeInstrumentation) !== false) { | ||
this.nativeInstrumentationEnabled = true; | ||
if (!debug && | ||
this.config.coverage && | ||
((_a = this.config.coverageConfig) === null || _a === void 0 ? void 0 : _a.nativeInstrumentation) !== false && | ||
!this.nativeInstrumentationEnabledOnPage && | ||
this.product === 'chromium') { | ||
this.nativeInstrumentationEnabledOnPage = true; | ||
await this.puppeteerPage.coverage.startJSCoverage(); | ||
@@ -70,3 +73,3 @@ } | ||
} | ||
if (!this.nativeInstrumentationEnabled) { | ||
if (!this.nativeInstrumentationEnabledOnPage) { | ||
return undefined; | ||
@@ -86,3 +89,3 @@ } | ||
await ((_e = this.puppeteerPage.coverage) === null || _e === void 0 ? void 0 : _e.stopJSCoverage()); | ||
this.nativeInstrumentationEnabled = false; | ||
this.nativeInstrumentationEnabledOnPage = false; | ||
return test_runner_coverage_v8_1.v8ToIstanbul(config, testFiles, v8Coverage); | ||
@@ -89,0 +92,0 @@ } |
{ | ||
"name": "@web/test-runner-chrome", | ||
"version": "0.5.20", | ||
"version": "0.5.21", | ||
"publishConfig": { | ||
@@ -5,0 +5,0 @@ "access": "public" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36663
366