Skip to content
Merged
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
28 changes: 14 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
"test": "playwright test"
},
"devDependencies": {
"@playwright/test": "1.65.0-alpha-2026-10-30",
"@playwright/test": "1.66.0-alpha-1793916328000",
"@types/node": "^25.2.1"
},
"dependencies": {
"playwright": "1.65.0-alpha-2026-10-30",
"playwright-core": "1.65.0-alpha-2026-10-30"
"playwright": "1.66.0-alpha-1793916328000",
"playwright-core": "1.66.0-alpha-1793916328000"
},
"bin": {
"playwright-cli": "playwright-cli.js"
Expand Down
15 changes: 10 additions & 5 deletions playwright-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const fs = require('fs');
const path = require('path');
const { spawn } = require('child_process');

const { program } = require('playwright-core/lib/tools/cli-client/program');
const { parseArgs, program } = require('playwright-core/lib/tools/cli-client/program');
const coreBundle = require('playwright-core/lib/coreBundle');
const { tools, registry } = coreBundle;
const { checkInstalledSkills, frame } = require('./skillCheck');
Expand All @@ -34,16 +34,21 @@ const UPDATE_CHECK_COMMANDS = new Set(['open', 'attach', 'list', 'install', 'ins
main();

async function main() {
await checkForUpdates().catch(() => {});
program({ embedderVersion: packageJson.version });
// Parse once and inspect the arguments before program() runs, as it may mutate them.
const args = parseArgs(process.argv.slice(2));
await checkForUpdates(args).catch(() => {});
await program({ args, embedderVersion: packageJson.version });
}

async function checkForUpdates() {
/**
* @param {ReturnType<typeof parseArgs>} args
*/
async function checkForUpdates(args) {
if (process.env.NO_UPDATE_NOTIFIER || process.env.CI)
return;

// The check spawns npm, so keep its cost to the commands that start a workflow.
const command = process.argv.slice(2).find(arg => !arg.startsWith('-'));
const command = args._[0];
if (!command || !UPDATE_CHECK_COMMANDS.has(command))
return;

Expand Down
2 changes: 2 additions & 0 deletions skills/playwright-cli/references/running-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ playwright-cli run-code "async page => {
}"
```

Event listener errors are reported as console errors.

## Complex Workflows

```bash
Expand Down
3 changes: 2 additions & 1 deletion tests/integration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ test('update check asks npm for the latest version on setup commands only', asyn
}));
expect(npmRegistry.requests).toEqual([]);

expect(await runCli(['list'], env)).toEqual(expect.objectContaining({
// The command is recognized behind the global options.
expect(await runCli(['--session', 'foo', 'list'], env)).toEqual(expect.objectContaining({
error: expect.stringContaining('Update available for @playwright/cli'),
exitCode: 0,
}));
Expand Down
Loading