@lvce-editor/test-with-playwright 17.4.0 → 18.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/main.js +27 -0
  2. package/package.json +3 -3
package/dist/main.js CHANGED
@@ -110,6 +110,24 @@ const commandMap = {
110
110
  [HandleResult]: handleResult
111
111
  };
112
112
 
113
+ const getHelpMessage = () => {
114
+ return `Usage: test-with-playwright [options]
115
+
116
+ Options:
117
+ --browser=<browser> Browser to run tests in: chromium or firefox
118
+ --filter=<pattern> Only run tests matching the filter
119
+ --headless Run the browser in headless mode
120
+ --only-extension=<path> Path to the extension under test
121
+ --server-path=<path> Path to the editor server entrypoint
122
+ --test-path=<path> Path to the test files
123
+ --trace-focus Log focus changes while tests run
124
+ -h, --help Show this help message
125
+
126
+ Environment:
127
+ ONLY_EXTENSION Default extension path
128
+ TEST_PATH Default test path`;
129
+ };
130
+
113
131
  function getDefaultExportFromCjs (x) {
114
132
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
115
133
  }
@@ -356,6 +374,9 @@ const parseCliArgs = argv => {
356
374
  if (parsed.filter) {
357
375
  result.filter = parsed.filter;
358
376
  }
377
+ if (parsed.help || parsed.h) {
378
+ result.help = true;
379
+ }
359
380
  if (parsed.headless) {
360
381
  result.headless = true;
361
382
  }
@@ -389,6 +410,7 @@ const defaultOptions = {
389
410
  browser: 'chromium',
390
411
  extensionPath: '',
391
412
  headless: false,
413
+ help: false,
392
414
  testPath: ''
393
415
  };
394
416
  const isBrowser = value => {
@@ -1375,11 +1397,16 @@ const handleCliArgs = async ({
1375
1397
  browser,
1376
1398
  filter,
1377
1399
  headless,
1400
+ help,
1378
1401
  onlyExtension,
1379
1402
  serverPath,
1380
1403
  testPath,
1381
1404
  traceFocus
1382
1405
  } = options;
1406
+ if (help) {
1407
+ console.info(getHelpMessage());
1408
+ return;
1409
+ }
1383
1410
  const timeout = 30_000;
1384
1411
  const testWorkerUri = getTestWorkerUrl();
1385
1412
  await runAllTests({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/test-with-playwright",
3
- "version": "17.4.0",
3
+ "version": "18.1.0",
4
4
  "description": "CLI tool for running Playwright tests",
5
5
  "repository": {
6
6
  "type": "git",
@@ -12,8 +12,8 @@
12
12
  "main": "dist/main.js",
13
13
  "bin": "bin/test-with-playwright.js",
14
14
  "dependencies": {
15
- "@lvce-editor/test-with-playwright-worker": "17.4.0",
16
- "@lvce-editor/test-worker": "^16.0.0"
15
+ "@lvce-editor/test-with-playwright-worker": "18.1.0",
16
+ "@lvce-editor/test-worker": "^16.2.0"
17
17
  },
18
18
  "engines": {
19
19
  "node": ">=24"