From 45f493da6c6e5a70c35e6b63e414a4819f012cd8 Mon Sep 17 00:00:00 2001 From: Simon Knott Date: Tue, 27 May 2025 22:19:25 +0200 Subject: [PATCH] chore: make library test run under older Node versions (#479) --- README.md | 5 ++++- tests/library.spec.ts | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index dd0403d..daf103b 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,10 @@ Playwright MCP server supports following arguments. They can be provided in the --ignore-https-errors ignore https errors --isolated keep the browser profile in memory, do not save it to disk. - --no-image-responses do not send image responses to the client. + --image-responses whether to send image responses to the client. + Can be "allow", "omit", or "auto". Defaults to + "auto", which sends images if the client can + display them. --no-sandbox disable the sandbox for all process types that are normally sandboxed. --output-dir path to the directory for output files. diff --git a/tests/library.spec.ts b/tests/library.spec.ts index eee405d..954403f 100644 --- a/tests/library.spec.ts +++ b/tests/library.spec.ts @@ -20,8 +20,9 @@ import child_process from 'node:child_process'; test('library can be used from CommonJS', { annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright-mcp/issues/456' } }, async ({}, testInfo) => { const file = testInfo.outputPath('main.cjs'); await fs.writeFile(file, ` - const playwrightMCP = require('@playwright/mcp'); - playwrightMCP.createConnection().then(() => console.log('OK')); + import('@playwright/mcp') + .then(playwrightMCP => playwrightMCP.createConnection()) + .then(() => console.log('OK')); `); expect(child_process.execSync(`node ${file}`, { encoding: 'utf-8' })).toContain('OK'); });