Skip to content

Commit

Permalink
chore: rename chrome-headless-shell to shell
Browse files Browse the repository at this point in the history
  • Loading branch information
OrKoN committed Feb 2, 2024
1 parent cffe9c9 commit 802e792
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 36 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ for automation tasks where the complete Chrome feature set is not needed. If the
is more important for your use case, switch to `chrome-headless-shell` as following:

```ts
const browser = await puppeteer.launch({headless: 'chrome-headless-shell'});
const browser = await puppeteer.launch({headless: 'shell'});
```

To launch a "headful" version of Chrome, set the
Expand Down
14 changes: 7 additions & 7 deletions docs/api/puppeteer.browserlaunchargumentoptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ export interface BrowserLaunchArgumentOptions

## Properties

| Property | Modifiers | Type | Description | Default |
| ------------- | --------------------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
| args | <code>optional</code> | string\[\] | Additional command line arguments to pass to the browser instance. | |
| debuggingPort | <code>optional</code> | number | Specify the debugging port number to use | |
| devtools | <code>optional</code> | boolean | Whether to auto-open a DevTools panel for each tab. If this is set to <code>true</code>, then <code>headless</code> will be forced to <code>false</code>. | <code>false</code> |
| headless | <code>optional</code> | boolean \| 'chrome-headless-shell' | Whether to run the browser in headless mode. | <code>true</code> |
| userDataDir | <code>optional</code> | string | Path to a user data directory. [see the Chromium docs](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/user_data_dir.md) for more info. | |
| Property | Modifiers | Type | Description | Default |
| ------------- | --------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
| args | <code>optional</code> | string\[\] | Additional command line arguments to pass to the browser instance. | |
| debuggingPort | <code>optional</code> | number | Specify the debugging port number to use | |
| devtools | <code>optional</code> | boolean | Whether to auto-open a DevTools panel for each tab. If this is set to <code>true</code>, then <code>headless</code> will be forced to <code>false</code>. | <code>false</code> |
| headless | <code>optional</code> | boolean \| 'shell' | Whether to run the browser in headless mode. | <code>true</code> |
| userDataDir | <code>optional</code> | string | Path to a user data directory. [see the Chromium docs](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/user_data_dir.md) for more info. | |
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ for automation tasks where the complete Chrome feature set is not needed. If the
is more important for your use case, switch to `chrome-headless-shell` as following:

```ts
const browser = await puppeteer.launch({headless: 'chrome-headless-shell'});
const browser = await puppeteer.launch({headless: 'shell'});
```

To launch a "headful" version of Chrome, set the
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"test:chrome:bidi-local": "wireit",
"test:chrome:headful": "wireit",
"test:chrome:headless": "wireit",
"test:chrome:chrome-headless-shell": "wireit",
"test:chrome:shell": "wireit",
"test:firefox": "wireit",
"test:firefox:bidi": "wireit",
"test:firefox:bidi:headful": "wireit",
Expand Down Expand Up @@ -83,7 +83,7 @@
"test:chrome:bidi",
"test:chrome:headful",
"test:chrome:headless",
"test:chrome:chrome-headless-shell"
"test:chrome:shell"
]
},
"test:chrome:bidi": {
Expand All @@ -98,7 +98,7 @@
"test:chrome:headless": {
"command": "npm test -- --test-suite chrome-headless"
},
"test:chrome:chrome-headless-shell": {
"test:chrome:shell": {
"command": "npm test -- --test-suite chrome-headless-shell"
},
"test:firefox:bidi": {
Expand Down
2 changes: 1 addition & 1 deletion packages/puppeteer-core/src/common/PDFOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export interface PDFOptions {
*
* @remarks
* If this is enabled the PDF will also be tagged (accessible)
* Currently only works in old Headless (headless = 'chrome-headless-shell')
* Currently only works in old Headless (headless = 'shell')
* crbug/840455#c47
*
* @defaultValue `false`
Expand Down
2 changes: 1 addition & 1 deletion packages/puppeteer-core/src/node/ChromeLauncher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export class ChromeLauncher extends ProductLauncher {

override executablePath(
channel?: ChromeReleaseChannel,
headless?: boolean | 'chrome-headless-shell'
headless?: boolean | 'shell'
): string {
if (channel) {
return computeSystemExecutablePath({
Expand Down
6 changes: 3 additions & 3 deletions packages/puppeteer-core/src/node/LaunchOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ export interface BrowserLaunchArgumentOptions {
* {@link https://developer.chrome.com/articles/new-headless/ | new headless}
* mode.
*
* - `'chrome-headless-shell'` launches
* {@link https://developer.chrome.com/blog/chrome-headless-shell | chrome-headless-shell}
* - `'shell'` launches
* {@link https://developer.chrome.com/blog/chrome-headless-shell | shell}
* known as the old headless mode.
*
* @defaultValue `true`
*/
headless?: boolean | 'chrome-headless-shell';
headless?: boolean | 'shell';
/**
* Path to a user data directory.
* {@link https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/user_data_dir.md | see the Chromium docs}
Expand Down
11 changes: 3 additions & 8 deletions packages/puppeteer-core/src/node/ProductLauncher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,7 @@ export abstract class ProductLauncher {
/**
* @internal
*/
protected resolveExecutablePath(
headless?: boolean | 'chrome-headless-shell'
): string {
protected resolveExecutablePath(headless?: boolean | 'shell'): string {
let executablePath = this.puppeteer.configuration.executablePath;
if (executablePath) {
if (!existsSync(executablePath)) {
Expand All @@ -406,13 +404,10 @@ export abstract class ProductLauncher {
return executablePath;
}

function productToBrowser(
product?: Product,
headless?: boolean | 'chrome-headless-shell'
) {
function productToBrowser(product?: Product, headless?: boolean | 'shell') {
switch (product) {
case 'chrome':
if (headless === 'chrome-headless-shell') {
if (headless === 'shell') {
return InstalledBrowser.CHROMEHEADLESSSHELL;
}
return InstalledBrowser.CHROME;
Expand Down
2 changes: 1 addition & 1 deletion test/TestSuites.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"HEADLESS": "false"
},
"chrome-headless-shell": {
"HEADLESS": "chrome-headless-shell"
"HEADLESS": "shell"
},
"webDriverBiDi": {
"PUPPETEER_PROTOCOL": "webDriverBiDi"
Expand Down
2 changes: 1 addition & 1 deletion test/src/fixtures.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('Fixtures', function () {
it('dumpio option should work with pipe option', async () => {
const {defaultBrowserOptions, puppeteerPath, headless} =
await getTestState();
if (headless !== 'chrome-headless-shell') {
if (headless !== 'shell') {
// This test only works in the old headless mode.
return;
}
Expand Down
14 changes: 5 additions & 9 deletions test/src/mocha-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,8 @@ const product =
const headless = (process.env['HEADLESS'] || 'true').trim().toLowerCase() as
| 'true'
| 'false'
| 'chrome-headless-shell';
export const isHeadless =
headless === 'true' || headless === 'chrome-headless-shell';
| 'shell';
export const isHeadless = headless === 'true' || headless === 'shell';
const isFirefox = product === 'firefox';
const isChrome = product === 'chrome';
const protocol = (process.env['PUPPETEER_PROTOCOL'] || 'cdp') as
Expand All @@ -94,10 +93,7 @@ const defaultBrowserOptions = Object.assign(
{
handleSIGINT: true,
executablePath: process.env['BINARY'],
headless:
headless === 'chrome-headless-shell'
? ('chrome-headless-shell' as const)
: isHeadless,
headless: headless === 'shell' ? ('shell' as const) : isHeadless,
dumpio: !!process.env['DUMPIO'],
protocol,
},
Expand All @@ -119,7 +115,7 @@ if (defaultBrowserOptions.executablePath) {

const processVariables: {
product: string;
headless: 'true' | 'false' | 'chrome-headless-shell';
headless: 'true' | 'false' | 'shell';
isHeadless: boolean;
isFirefox: boolean;
isChrome: boolean;
Expand Down Expand Up @@ -249,7 +245,7 @@ export interface PuppeteerTestState {
isFirefox: boolean;
isChrome: boolean;
isHeadless: boolean;
headless: 'true' | 'false' | 'chrome-headless-shell';
headless: 'true' | 'false' | 'shell';
puppeteerPath: string;
}
const state: Partial<PuppeteerTestState> = {};
Expand Down

0 comments on commit 802e792

Please sign in to comment.