Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@web/test-runner-chrome

Package Overview
Dependencies
Maintainers
6
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@web/test-runner-chrome - npm Package Compare versions

Comparing version 0.5.16 to 0.5.17

6

CHANGELOG.md
# @web/test-runner-chrome
## 0.5.17
### Patch Changes
- 432f090: expose browser name from BrowserLauncher
## 0.5.16

@@ -4,0 +10,0 @@

15

dist/ChromeLauncher.d.ts
import * as puppeteerCore from 'puppeteer-core';
import { Browser, Page, LaunchOptions } from 'puppeteer-core';
import { BrowserLauncher, TestRunnerCoreConfig, TestSession, Viewport } from '@web/test-runner-core';
import { BrowserLauncher, TestRunnerCoreConfig, Viewport } from '@web/test-runner-core';
import { ChromeLauncherPage } from './ChromeLauncherPage';

@@ -13,2 +13,3 @@ export declare type CreatePageFunction = (args: {

private createPageFunction?;
name: string;
private config?;

@@ -24,12 +25,12 @@ private testFiles?;

constructor(launchOptions: LaunchOptions, customPuppeteer?: typeof puppeteerCore | undefined, createPageFunction?: CreatePageFunction | undefined);
start(config: TestRunnerCoreConfig, testFiles: string[]): Promise<string>;
start(config: TestRunnerCoreConfig, testFiles: string[]): Promise<void>;
launchBrowser(options?: LaunchOptions): Promise<puppeteerCore.Browser>;
stop(): Promise<void>;
startSession(session: TestSession, url: string): Promise<void>;
isActive(session: TestSession): boolean;
startDebugSession(session: TestSession, url: string): Promise<void>;
startSession(sessionId: string, url: string): Promise<void>;
isActive(sessionId: string): boolean;
startDebugSession(sessionId: string, url: string): Promise<void>;
createNewPage(browser: Browser): Promise<ChromeLauncherPage>;
stopSession(session: TestSession): Promise<import("@web/test-runner-core").SessionResult>;
setViewport(session: TestSession, viewport: Viewport): Promise<void>;
stopSession(sessionId: string): Promise<import("@web/test-runner-core").SessionResult>;
setViewport(sessionId: string, viewport: Viewport): Promise<void>;
}
//# sourceMappingURL=ChromeLauncher.d.ts.map

@@ -7,2 +7,5 @@ "use strict";

const ChromeLauncherPage_1 = require("./ChromeLauncherPage");
function capitalize(str) {
return `${str[0].toUpperCase()}${str.substring(1)}`;
}
const errorHelp = 'This could be because of a mismatch between the version of puppeteer and Chrome or Chromium. ' +

@@ -19,3 +22,16 @@ 'Try updating either of them, or adjust the executablePath option to point to another browser installation. ' +

this.inactivePages = [];
this.testCoveragePerSession = new WeakMap();
this.testCoveragePerSession = new Map();
if (!customPuppeteer) {
// without a custom puppeteer, we use the locally installed chrome
this.name = 'Chrome';
}
else if (!this.launchOptions.product || this.launchOptions.product === 'chrome') {
// with puppeteer we use the a packaged chromium, puppeteer calls it chrome but we
// should call it chromium to avoid confusion
this.name = 'Chromium';
}
else {
// otherwise take the product name directly
this.name = capitalize(this.launchOptions.product);
}
}

@@ -26,5 +42,2 @@ async start(config, testFiles) {

this.browser = await this.launchBrowser();
return this.launchOptions.product
? this.launchOptions.product[0].toUpperCase() + this.launchOptions.product.substring(1)
: 'Chrome';
}

@@ -61,3 +74,3 @@ launchBrowser(options = {}) {

}
async startSession(session, url) {
async startSession(sessionId, url) {
var _a, _b;

@@ -74,10 +87,10 @@ if (!((_a = this.browser) === null || _a === void 0 ? void 0 : _a.isConnected())) {

}
this.activePages.set(session.id, page);
this.testCoveragePerSession.delete(session);
this.activePages.set(sessionId, page);
this.testCoveragePerSession.delete(sessionId);
await page.runSession(url, !!((_b = this.config) === null || _b === void 0 ? void 0 : _b.coverage));
}
isActive(session) {
return this.activePages.has(session.id);
isActive(sessionId) {
return this.activePages.has(sessionId);
}
async startDebugSession(session, url) {
async startDebugSession(sessionId, url) {
if (!this.debugBrowser) {

@@ -87,5 +100,5 @@ this.debugBrowser = await this.launchBrowser({ devtools: true });

const page = await this.createNewPage(this.debugBrowser);
this.activeDebugPages.set(session.id, page);
this.activeDebugPages.set(sessionId, page);
page.puppeteerPage.on('close', () => {
this.activeDebugPages.delete(session.id);
this.activeDebugPages.delete(sessionId);
});

@@ -105,7 +118,7 @@ await page.runSession(url, false);

}
async stopSession(session) {
const page = this.activePages.get(session.id);
async stopSession(sessionId) {
const page = this.activePages.get(sessionId);
if (page) {
const result = await page.stopSession();
this.activePages.delete(session.id);
this.activePages.delete(sessionId);
this.inactivePages.push(page);

@@ -115,10 +128,10 @@ return result;

else {
throw new Error(`No page for session ${session.id}`);
throw new Error(`No page for session ${sessionId}`);
}
}
setViewport(session, viewport) {
const page = this.activePages.get(session.id);
const debugPage = this.activeDebugPages.get(session.id);
setViewport(sessionId, viewport) {
const page = this.activePages.get(sessionId);
const debugPage = this.activeDebugPages.get(sessionId);
if (!page && !debugPage) {
throw new Error(`Cannot set viewport for inactive session: ${session.id}`);
throw new Error(`Cannot set viewport for inactive session: ${sessionId}`);
}

@@ -125,0 +138,0 @@ return (page || debugPage).puppeteerPage.setViewport(viewport);

{
"name": "@web/test-runner-chrome",
"version": "0.5.16",
"version": "0.5.17",
"publishConfig": {

@@ -47,5 +47,5 @@ "access": "public"

"@web/test-runner-mocha": "^0.2.9",
"@web/test-runner-server": "^0.5.12",
"@web/test-runner-server": "^0.5.13",
"portfinder": "^1.0.26"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc