@lvce-editor/test-with-playwright 12.0.0 → 12.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 (3) hide show
  1. package/README.md +0 -4
  2. package/dist/main.js +54 -54
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -16,7 +16,3 @@ test('sample.hello-world', async () => {
16
16
  await expect(sideBar).toBeVisible()
17
17
  })
18
18
  ```
19
-
20
- ## Gitpod
21
-
22
- [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/lvce-editor/test-with-playwright)
package/dist/main.js CHANGED
@@ -43,11 +43,11 @@ const getFinalResultMessage = (passed, skipped, failed, duration) => {
43
43
 
44
44
  const handleFinalResult = finalResult => {
45
45
  const {
46
- passed,
46
+ end,
47
47
  failed,
48
+ passed,
48
49
  skipped,
49
- start,
50
- end
50
+ start
51
51
  } = finalResult;
52
52
  const duration = end - start;
53
53
  const message = getFinalResultMessage(passed, skipped, failed, duration);
@@ -70,9 +70,9 @@ const getDuration = (start, end) => {
70
70
  };
71
71
  const handleResultPassed = result => {
72
72
  const {
73
+ end,
73
74
  name,
74
- start,
75
- end
75
+ start
76
76
  } = result;
77
77
  const duration = getDuration(start, end);
78
78
  const formattedDuration = formatDuration(duration);
@@ -86,8 +86,8 @@ const handleResultSkipped = result => {
86
86
  };
87
87
  const handleResultFailed = result => {
88
88
  const {
89
- name,
90
- error
89
+ error,
90
+ name
91
91
  } = result;
92
92
  console.error(`${Fail$1} ${name}: ${error}`);
93
93
  };
@@ -97,6 +97,10 @@ const handleResult = result => {
97
97
  } = result;
98
98
  switch (status) {
99
99
  // @ts-ignore
100
+ case Fail:
101
+ handleResultFailed(result);
102
+ break;
103
+ // @ts-ignore
100
104
  case Pass:
101
105
  handleResultPassed(result);
102
106
  break;
@@ -104,18 +108,14 @@ const handleResult = result => {
104
108
  case Skip:
105
109
  handleResultSkipped(result);
106
110
  break;
107
- // @ts-ignore
108
- case Fail:
109
- handleResultFailed(result);
110
- break;
111
111
  default:
112
112
  throw new Error(`unexpected test state: ${status}`);
113
113
  }
114
114
  };
115
115
 
116
116
  const commandMap = {
117
- [HandleResult]: handleResult,
118
- [HandleFinalResult]: handleFinalResult
117
+ [HandleFinalResult]: handleFinalResult,
118
+ [HandleResult]: handleResult
119
119
  };
120
120
 
121
121
  function getDefaultExportFromCjs (x) {
@@ -385,9 +385,9 @@ const parseEnv = env => {
385
385
  };
386
386
 
387
387
  const defaultOptions = {
388
- testPath: '',
389
388
  extensionPath: '',
390
- headless: false
389
+ headless: false,
390
+ testPath: ''
391
391
  };
392
392
  const getOptions = ({
393
393
  argv,
@@ -636,8 +636,8 @@ const getModuleNotFoundError = stderr => {
636
636
  const messageIndex = lines.findIndex(isModuleNotFoundMessage);
637
637
  const message = lines[messageIndex];
638
638
  return {
639
- message,
640
- code: ERR_MODULE_NOT_FOUND
639
+ code: ERR_MODULE_NOT_FOUND,
640
+ message
641
641
  };
642
642
  };
643
643
  const isModuleNotFoundError = stderr => {
@@ -660,14 +660,14 @@ const isUnhelpfulNativeModuleError = stderr => {
660
660
  const getNativeModuleErrorMessage = stderr => {
661
661
  const message = getMessageCodeBlock(stderr);
662
662
  return {
663
- message: `Incompatible native node module: ${message}`,
664
- code: E_INCOMPATIBLE_NATIVE_MODULE
663
+ code: E_INCOMPATIBLE_NATIVE_MODULE,
664
+ message: `Incompatible native node module: ${message}`
665
665
  };
666
666
  };
667
667
  const getModuleSyntaxError = () => {
668
668
  return {
669
- message: `ES Modules are not supported in electron`,
670
- code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON
669
+ code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON,
670
+ message: `ES Modules are not supported in electron`
671
671
  };
672
672
  };
673
673
  const getHelpfulChildProcessError = (stdout, stderr) => {
@@ -686,8 +686,8 @@ const getHelpfulChildProcessError = (stdout, stderr) => {
686
686
  rest
687
687
  } = getDetails(lines);
688
688
  return {
689
- message: actualMessage,
690
689
  code: '',
690
+ message: actualMessage,
691
691
  stack: rest
692
692
  };
693
693
  };
@@ -697,8 +697,8 @@ class IpcError extends VError {
697
697
  if (stdout || stderr) {
698
698
  // @ts-ignore
699
699
  const {
700
- message,
701
700
  code,
701
+ message,
702
702
  stack
703
703
  } = getHelpfulChildProcessError(stdout, stderr);
704
704
  const cause = new Error(message);
@@ -734,8 +734,8 @@ const removeListener = (emitter, type, callback) => {
734
734
  };
735
735
  const getFirstEvent = (eventEmitter, eventMap) => {
736
736
  const {
737
- resolve,
738
- promise
737
+ promise,
738
+ resolve
739
739
  } = Promise.withResolvers();
740
740
  const listenerMap = Object.create(null);
741
741
  const cleanup = value => {
@@ -747,8 +747,8 @@ const getFirstEvent = (eventEmitter, eventMap) => {
747
747
  for (const [event, type] of Object.entries(eventMap)) {
748
748
  const listener = event => {
749
749
  cleanup({
750
- type,
751
- event
750
+ event,
751
+ type
752
752
  });
753
753
  };
754
754
  addListener(eventEmitter, event, listener);
@@ -771,18 +771,18 @@ const fixNodeWorkerParameters = value => {
771
771
  };
772
772
  const getFirstNodeWorkerEvent = worker => {
773
773
  return getFirstEvent(worker, {
774
- message: Message$1,
774
+ error: Error$2,
775
775
  exit: Exit,
776
- error: Error$2
776
+ message: Message$1
777
777
  });
778
778
  };
779
779
  const create$1$1 = async ({
780
- path,
781
780
  argv = [],
782
781
  env = process.env,
783
782
  execArgv = [],
784
- stdio,
785
- name
783
+ name,
784
+ path,
785
+ stdio
786
786
  }) => {
787
787
  string(path);
788
788
  const actualArgv = ['--ipc-type=node-worker', ...argv];
@@ -798,13 +798,13 @@ const create$1$1 = async ({
798
798
  argv: actualArgv,
799
799
  env: actualEnv,
800
800
  execArgv,
801
- stdout: ignoreStdio,
801
+ name,
802
802
  stderr: ignoreStdio,
803
- name
803
+ stdout: ignoreStdio
804
804
  });
805
805
  const {
806
- type,
807
- event
806
+ event,
807
+ type
808
808
  } = await getFirstNodeWorkerEvent(worker);
809
809
  if (type === Exit) {
810
810
  throw new IpcError(`Worker exited before ipc connection was established`);
@@ -1330,21 +1330,21 @@ const NodeWorkerRpcParent = {
1330
1330
  const RunAllTests = 'RunAllTests';
1331
1331
 
1332
1332
  const runAllTests = async ({
1333
- onlyExtension,
1334
- testPath,
1333
+ commandMap,
1335
1334
  cwd,
1336
1335
  headless,
1337
- timeout,
1338
- commandMap,
1336
+ onlyExtension,
1337
+ serverPath,
1338
+ testPath,
1339
1339
  testWorkerUri,
1340
- serverPath
1340
+ timeout
1341
1341
  }) => {
1342
1342
  // TODO use `using` once supported
1343
1343
  const path = fileURLToPath(testWorkerUri);
1344
1344
  const rpc = await NodeWorkerRpcParent.create({
1345
- path,
1346
1345
  argv: [],
1347
1346
  commandMap,
1347
+ path,
1348
1348
  stdio: 'inherit'
1349
1349
  });
1350
1350
  await rpc.invoke(RunAllTests, onlyExtension, testPath, cwd, headless, timeout, serverPath);
@@ -1353,32 +1353,32 @@ const runAllTests = async ({
1353
1353
 
1354
1354
  const handleCliArgs = async ({
1355
1355
  argv,
1356
- env,
1357
1356
  commandMap,
1358
- cwd
1357
+ cwd,
1358
+ env
1359
1359
  }) => {
1360
1360
  const options = getOptions({
1361
1361
  argv,
1362
1362
  env
1363
1363
  });
1364
1364
  const {
1365
- onlyExtension,
1366
- testPath,
1367
1365
  headless,
1368
- serverPath
1366
+ onlyExtension,
1367
+ serverPath,
1368
+ testPath
1369
1369
  } = options;
1370
1370
  const timeout = 30_000;
1371
1371
  const testWorkerUri = getTestWorkerUrl();
1372
1372
  await runAllTests({
1373
+ commandMap,
1374
+ cwd,
1375
+ headless,
1373
1376
  // @ts-ignore
1374
1377
  onlyExtension,
1378
+ serverPath,
1375
1379
  testPath,
1376
- cwd,
1377
- headless,
1378
- timeout,
1379
- commandMap,
1380
1380
  testWorkerUri,
1381
- serverPath
1381
+ timeout
1382
1382
  });
1383
1383
  };
1384
1384
 
@@ -1400,9 +1400,9 @@ const main = async () => {
1400
1400
  on('uncaughtExceptionMonitor', handleUncaughtExceptionMonitor);
1401
1401
  await handleCliArgs({
1402
1402
  argv: argv,
1403
- env: env,
1404
1403
  commandMap: commandMap,
1405
- cwd: process.cwd()
1404
+ cwd: process.cwd(),
1405
+ env: env
1406
1406
  });
1407
1407
  };
1408
1408
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/test-with-playwright",
3
- "version": "12.0.0",
3
+ "version": "12.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": "12.0.0",
16
- "@lvce-editor/test-worker": "^10.7.0"
15
+ "@lvce-editor/test-with-playwright-worker": "12.1.0",
16
+ "@lvce-editor/test-worker": "^11.0.0"
17
17
  },
18
18
  "engines": {
19
19
  "node": ">=22"