Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dist/index.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.esm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.esm.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions lib/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ async function launchBrowser(puppeteerArgs) {

const launchOptions = {
headless: other.browserShellMode ? 'shell' : true,
pipe: puppeteerOptions.pipe,
userDataDir: puppeteerOptions.tempDir || './tmp/',
args: puppeteerArgs,
handleSIGINT: false,
Expand Down
1 change: 1 addition & 0 deletions lib/envs.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ const v = {

export const Config = z.object({
// puppeteer
PUPPETEER_PIPE: v.boolean(),
PUPPETEER_TEMP_DIR: v.path(),
PUPPETEER_LAUNCH_RETRY_WINDOW: v.nonNegativeNum(),

Expand Down
13 changes: 13 additions & 0 deletions lib/schemas/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ export const defaultConfig = {
type: 'string[]',
description: 'Arguments array to send to Puppeteer.'
},
pipe: {
value: false,
type: 'boolean',
envLink: 'PUPPETEER_PIPE',
description:
'Use a pipe instead of a WebSocket for the browser connection.'
},
launchRetryWindow: {
value: 30000,
type: 'number',
Expand Down Expand Up @@ -772,6 +779,12 @@ export const promptsConfig = {
message: 'Puppeteer arguments',
initial: defaultConfig.puppeteer.args.value.join(','),
separator: ','
},
{
type: 'toggle',
name: 'pipe',
message: 'Use a pipe for the browser connection',
initial: defaultConfig.puppeteer.pipe.value
}
],
highcharts: [
Expand Down
15 changes: 15 additions & 0 deletions tests/unit/envs.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
import { Config } from '../../lib/envs';

describe('Environment variables should be correctly parsed', () => {
test('PUPPETEER_PIPE should be a boolean', () => {
expect(
Config.partial().parse({ PUPPETEER_PIPE: 'true' }).PUPPETEER_PIPE
).toEqual(true);
expect(
Config.partial().parse({ PUPPETEER_PIPE: 'false' }).PUPPETEER_PIPE
).toEqual(false);
expect(
Config.partial().parse({ PUPPETEER_PIPE: '' }).PUPPETEER_PIPE
).toBeUndefined();
expect(() =>
Config.partial().parse({ PUPPETEER_PIPE: 'invalid' })
).toThrow();
});

test('PUPPETEER_TEMP_DIR should be a valid path', () => {
const env = { PUPPETEER_TEMP_DIR: '/path/to/dir' };
expect(Config.partial().parse(env).PUPPETEER_TEMP_DIR).toEqual(
Expand Down