@scalar/helpers
Advanced tools
| import type { FullConfig } from '@playwright/test'; | ||
| export type WebServer = NonNullable<FullConfig['webServer']>; | ||
| /** Default playwright version */ | ||
| export declare const DEFAULT_PLAYWRIGHT_VERSION = "1.59.1"; | ||
| /** Options for getting a docker server */ | ||
| type GetDockerServerOptions = { | ||
| version: string; | ||
| port: number; | ||
| } & Partial<WebServer>; | ||
| /** | ||
| * Builds a Playwright {@link https://playwright.dev/docs/test-webserver | webServer} config | ||
| * that starts the browser-side `playwright run-server` inside | ||
| * {@link https://hub.docker.com/r/scalarapi/playwright-runner | `scalarapi/playwright-runner`}. | ||
| * | ||
| * **Important:** The `version` must stay aligned with the workspace `@playwright/test` major/minor | ||
| * so the client and container speak the same protocol. | ||
| */ | ||
| export declare const getDockerServer: (opts?: Partial<GetDockerServerOptions>) => WebServer; | ||
| export {}; | ||
| //# sourceMappingURL=docker.d.ts.map |
| {"version":3,"file":"docker.d.ts","sourceRoot":"","sources":["../../src/playwright/docker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,MAAM,MAAM,SAAS,GAAG,WAAW,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAA;AAE5D,iCAAiC;AACjC,eAAO,MAAM,0BAA0B,WAAW,CAAA;AAElD,0CAA0C;AAC1C,KAAK,sBAAsB,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;CACb,GAAG,OAAO,CAAC,SAAS,CAAC,CAAA;AAQtB;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAAI,OAAM,OAAO,CAAC,sBAAsB,CAAM,KAAG,SAe5E,CAAA"} |
| /** Default playwright version */ | ||
| export const DEFAULT_PLAYWRIGHT_VERSION = '1.59.1'; | ||
| /** Default options for getting a docker server */ | ||
| const DEFAULT_OPTS = { | ||
| version: DEFAULT_PLAYWRIGHT_VERSION, | ||
| port: 5001, | ||
| }; | ||
| /** | ||
| * Builds a Playwright {@link https://playwright.dev/docs/test-webserver | webServer} config | ||
| * that starts the browser-side `playwright run-server` inside | ||
| * {@link https://hub.docker.com/r/scalarapi/playwright-runner | `scalarapi/playwright-runner`}. | ||
| * | ||
| * **Important:** The `version` must stay aligned with the workspace `@playwright/test` major/minor | ||
| * so the client and container speak the same protocol. | ||
| */ | ||
| export const getDockerServer = (opts = {}) => { | ||
| const { version, port, ...rest } = { ...DEFAULT_OPTS, ...opts }; | ||
| return { | ||
| name: 'Playwright', | ||
| command: `docker run --name scalar-playwright --rm --platform linux/amd64 --entrypoint="playwright" --network=host scalarapi/playwright-runner:${version} run-server --port ${port} --host 0.0.0.0`, | ||
| url: `http://localhost:${port}`, | ||
| timeout: 120 * 1000, | ||
| reuseExistingServer: !process.env.CI, | ||
| gracefulShutdown: { | ||
| signal: 'SIGTERM', | ||
| timeout: 10 * 1000, | ||
| }, | ||
| // Apply any additional option overrides | ||
| ...rest, | ||
| }; | ||
| }; |
+6
-0
| # @scalar/helpers | ||
| ## 0.5.3 | ||
| ### Patch Changes | ||
| - [#8971](https://github.com/scalar/scalar/pull/8971): feat(helpers): add a helper playwright utilities | ||
| ## 0.5.2 | ||
@@ -4,0 +10,0 @@ |
+7
-1
@@ -17,3 +17,3 @@ { | ||
| ], | ||
| "version": "0.5.2", | ||
| "version": "0.5.3", | ||
| "engines": { | ||
@@ -86,2 +86,7 @@ "node": ">=22" | ||
| }, | ||
| "./playwright/*": { | ||
| "import": "./dist/playwright/*.js", | ||
| "types": "./dist/playwright/*.d.ts", | ||
| "default": "./dist/playwright/*.js" | ||
| }, | ||
| "./regex/*": { | ||
@@ -119,2 +124,3 @@ "import": "./dist/regex/*.js", | ||
| "devDependencies": { | ||
| "@playwright/test": "1.59.1", | ||
| "jsdom": "27.4.0", | ||
@@ -121,0 +127,0 @@ "vitest": "4.1.0" |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
212337
1.44%204
1.49%4714
1.07%3
50%2
100%