@lvce-editor/test-worker 4.21.0 → 4.23.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.
@@ -513,7 +513,7 @@ const create$4 = (method, params) => {
513
513
  };
514
514
  };
515
515
  const callbacks = Object.create(null);
516
- const set$2 = (id, fn) => {
516
+ const set$3 = (id, fn) => {
517
517
  callbacks[id] = fn;
518
518
  };
519
519
  const get$2 = id => {
@@ -532,7 +532,7 @@ const registerPromise = () => {
532
532
  resolve,
533
533
  promise
534
534
  } = Promise.withResolvers();
535
- set$2(id, resolve);
535
+ set$3(id, resolve);
536
536
  return {
537
537
  id,
538
538
  promise
@@ -605,6 +605,16 @@ const constructError = (message, type, name) => {
605
605
  }
606
606
  return new ErrorConstructor(message);
607
607
  };
608
+ const joinLines = lines => {
609
+ return lines.join(NewLine);
610
+ };
611
+ const splitLines = lines => {
612
+ return lines.split(NewLine);
613
+ };
614
+ const getCurrentStack = () => {
615
+ const currentStack = joinLines(splitLines(new Error().stack || '').slice(2));
616
+ return currentStack;
617
+ };
608
618
  const getNewLineIndex = (string, startIndex = undefined) => {
609
619
  return string.indexOf(NewLine, startIndex);
610
620
  };
@@ -615,19 +625,16 @@ const getParentStack = error => {
615
625
  }
616
626
  return parentStack;
617
627
  };
618
- const joinLines = lines => {
619
- return lines.join(NewLine);
620
- };
621
628
  const MethodNotFound = -32601;
622
629
  const Custom = -32001;
623
- const splitLines = lines => {
624
- return lines.split(NewLine);
625
- };
626
630
  const restoreJsonRpcError = error => {
631
+ const currentStack = getCurrentStack();
627
632
  if (error && error instanceof Error) {
633
+ if (typeof error.stack === 'string') {
634
+ error.stack = error.stack + NewLine + currentStack;
635
+ }
628
636
  return error;
629
637
  }
630
- const currentStack = joinLines(splitLines(new Error().stack || '').slice(1));
631
638
  if (error && error.code && error.code === MethodNotFound) {
632
639
  const restoredError = new JsonRpcError(error.message);
633
640
  const parentStack = getParentStack(error);
@@ -975,8 +982,13 @@ const printError = error => {
975
982
  }
976
983
  };
977
984
 
985
+ const printTestError = async error => {
986
+ // TODO ask error worker to add codeframe
987
+ printError(error);
988
+ };
989
+
978
990
  const rpcs = Object.create(null);
979
- const set$a = (id, rpc) => {
991
+ const set$b = (id, rpc) => {
980
992
  rpcs[id] = rpc;
981
993
  };
982
994
  const get$1 = id => {
@@ -1000,28 +1012,28 @@ const create$1 = rpcId => {
1000
1012
  return rpc.invokeAndTransfer(method, ...params);
1001
1013
  },
1002
1014
  set(rpc) {
1003
- set$a(rpcId, rpc);
1015
+ set$b(rpcId, rpc);
1004
1016
  }
1005
1017
  };
1006
1018
  };
1007
1019
  const RendererWorker$1 = 1;
1008
1020
  const {
1009
- invoke: invoke$5,
1010
- invokeAndTransfer: invokeAndTransfer$5,
1011
- set: set$5
1021
+ invoke: invoke$2,
1022
+ invokeAndTransfer: invokeAndTransfer$2,
1023
+ set: set$2
1012
1024
  } = create$1(RendererWorker$1);
1013
1025
  const RendererWorker = {
1014
1026
  __proto__: null,
1015
- invoke: invoke$5,
1016
- invokeAndTransfer: invokeAndTransfer$5,
1017
- set: set$5
1027
+ invoke: invoke$2,
1028
+ invokeAndTransfer: invokeAndTransfer$2,
1029
+ set: set$2
1018
1030
  };
1019
1031
 
1020
1032
  const {
1021
- set: set$1
1033
+ set: set$1,
1034
+ invoke,
1035
+ invokeAndTransfer
1022
1036
  } = RendererWorker;
1023
- const invoke = RendererWorker.invoke;
1024
- const invokeAndTransfer = RendererWorker.invokeAndTransfer;
1025
1037
 
1026
1038
  const Rpc = {
1027
1039
  __proto__: null,
@@ -1059,6 +1071,7 @@ const executeTest = async (name, fn, globals = {}) => {
1059
1071
  _end = now();
1060
1072
  _duration = _end - _start;
1061
1073
  _formattedDuration = formatDuration(_duration);
1074
+ // eslint-disable-next-line no-console
1062
1075
  console.info(`PASS ${name} in ${_formattedDuration}`);
1063
1076
  } catch (error) {
1064
1077
  if (error &&
@@ -1071,7 +1084,7 @@ const executeTest = async (name, fn, globals = {}) => {
1071
1084
  if (!(error instanceof VError)) {
1072
1085
  error = new VError(error, `Test failed: ${name}`);
1073
1086
  }
1074
- printError(error);
1087
+ await printTestError(error);
1075
1088
  }
1076
1089
  let state;
1077
1090
  let background;
@@ -1085,6 +1098,7 @@ const executeTest = async (name, fn, globals = {}) => {
1085
1098
  text = `test passed in ${_formattedDuration}`;
1086
1099
  state = Pass;
1087
1100
  }
1101
+ // @ts-ignore
1088
1102
  await invoke('TestFrameWork.showOverlay', state, background, text);
1089
1103
  };
1090
1104
 
@@ -1501,6 +1515,7 @@ test.skip = async id => {
1501
1515
  const state = 'skip';
1502
1516
  const background = 'yellow';
1503
1517
  const text = `test skipped ${id}`;
1518
+ // @ts-ignore
1504
1519
  await invoke('TestFrameWork.showOverlay', state, background, text);
1505
1520
  };
1506
1521
  const {
@@ -1626,6 +1641,7 @@ const TestFrameWorkComponentBaseUrl = {
1626
1641
  };
1627
1642
 
1628
1643
  const execute$1 = async (id, ...args) => {
1644
+ // @ts-ignore
1629
1645
  return invoke(id, ...args);
1630
1646
  };
1631
1647
 
@@ -1644,27 +1660,35 @@ const TestFrameWorkComponentContextMenu = {
1644
1660
  };
1645
1661
 
1646
1662
  const openIframeInspector = async () => {
1663
+ // @ts-ignore
1647
1664
  return invoke('Developer.openIframeInspector');
1648
1665
  };
1649
1666
  const openCacheFolder = async () => {
1667
+ // @ts-ignore
1650
1668
  return invoke('Developer.openCacheFolder');
1651
1669
  };
1652
1670
  const openConfigFolder = async () => {
1671
+ // @ts-ignore
1653
1672
  return invoke('Developer.openConfigFolder');
1654
1673
  };
1655
1674
  const openLogsFolder = async () => {
1675
+ // @ts-ignore
1656
1676
  return invoke('Developer.openLogsFolder');
1657
1677
  };
1658
1678
  const openProcessExplorer = async () => {
1679
+ // @ts-ignore
1659
1680
  return invoke('Developer.openProcessExplorer');
1660
1681
  };
1661
1682
  const reloadColorTheme = async () => {
1683
+ // @ts-ignore
1662
1684
  return invoke('Developer.reloadColorTheme');
1663
1685
  };
1664
1686
  const reloadIconTheme = async () => {
1687
+ // @ts-ignore
1665
1688
  return invoke('Developer.reloadIconTheme');
1666
1689
  };
1667
1690
  const toggleDeveloperTools = async () => {
1691
+ // @ts-ignore
1668
1692
  return invoke('Developer.toggleDeveloperTools');
1669
1693
  };
1670
1694
 
@@ -1687,7 +1711,8 @@ const openCompletion = async () => {
1687
1711
  await invoke('Editor.openCompletion');
1688
1712
  };
1689
1713
  const closeCompletion = async () => {
1690
- await invoke('Editor.closeCompletion');
1714
+ // @ts-ignore
1715
+ await invoke('EditorCompletion.close');
1691
1716
  };
1692
1717
  const openEditorContextMenu = async () => {
1693
1718
  await invoke('Editor.handleContextMenu', 0, 0);
@@ -1735,9 +1760,11 @@ const type = async text => {
1735
1760
  await invoke('Editor.type', text);
1736
1761
  };
1737
1762
  const findAllReferences = async () => {
1763
+ // @ts-ignore
1738
1764
  await invoke('SideBar.show', 'References', /* focus */true);
1739
1765
  };
1740
1766
  const findAllImplementations = async () => {
1767
+ // @ts-ignore
1741
1768
  await invoke('SideBar.show', 'Implementations', /* focus */true);
1742
1769
  };
1743
1770
  const setSelections = async selections => {
@@ -1765,9 +1792,11 @@ const openCompletionDetails = async () => {
1765
1792
  await invoke('EditorCompletion.openDetails');
1766
1793
  };
1767
1794
  const closeCompletionDetails = async () => {
1795
+ // @ts-ignore
1768
1796
  await invoke('EditorCompletion.closeDetails');
1769
1797
  };
1770
1798
  const toggleCompletionDetails = async () => {
1799
+ // @ts-ignore
1771
1800
  await invoke('EditorCompletion.toggleDetails');
1772
1801
  };
1773
1802
  const organizeImports = async () => {
@@ -1792,6 +1821,7 @@ const openColorPicker = async () => {
1792
1821
  await invoke('Editor.openColorPicker');
1793
1822
  };
1794
1823
  const openFind = async () => {
1824
+ // @ts-ignore
1795
1825
  await invoke('Editor.openFind2');
1796
1826
  };
1797
1827
  const deleteAllLeft = async () => {
@@ -1916,7 +1946,9 @@ const TestFrameWorkComponentEditorCompletion = {
1916
1946
  selectIndex: selectIndex$4
1917
1947
  };
1918
1948
 
1949
+ /* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
1919
1950
  const openContextMenu = async index => {
1951
+ // @ts-ignore
1920
1952
  await invoke('Explorer.handleContextMenuKeyboard', index);
1921
1953
  };
1922
1954
  const handleDragLeave = async () => {
@@ -1932,6 +1964,7 @@ const focus$1 = async () => {
1932
1964
  await invoke('Explorer.focusIndex', -1);
1933
1965
  };
1934
1966
  const focusNext$7 = async () => {
1967
+ // @ts-ignore
1935
1968
  await invoke('Explorer.focusNext');
1936
1969
  };
1937
1970
  const selectUp = async () => {
@@ -1974,9 +2007,11 @@ const handleClick$1 = async index => {
1974
2007
  await invoke('Explorer.handleClick', index);
1975
2008
  };
1976
2009
  const handleClickAt$1 = async (preventDefault, button, ctrlKey, shiftKey, x, y) => {
2010
+ // @ts-ignore
1977
2011
  await invoke('Explorer.handleClickAt', preventDefault, button, ctrlKey, shiftKey, x, y);
1978
2012
  };
1979
2013
  const handleDrop = async (x, y, fileIds, fileList) => {
2014
+ // @ts-ignore
1980
2015
  await invoke('Explorer.handleDrop', x, y, fileIds, fileIds);
1981
2016
  };
1982
2017
  const rename = async () => {
@@ -2107,16 +2142,19 @@ const getTmpDir = async ({
2107
2142
  case Memfs:
2108
2143
  return 'memfs:///workspace';
2109
2144
  default:
2145
+ // @ts-ignore
2110
2146
  return invoke('PlatformPaths.getTmpDir');
2111
2147
  }
2112
2148
  };
2113
2149
  const chmod = async (uri, permissions) => {
2150
+ // @ts-ignore
2114
2151
  await invoke('FileSystem.chmod', uri, permissions);
2115
2152
  };
2116
2153
  const createExecutable = async content => {
2117
2154
  const tmpDir = await getTmpDir({
2118
2155
  scheme: 'file'
2119
2156
  });
2157
+ // @ts-ignore
2120
2158
  const nodePath = await invoke('PlatformPaths.getNodePath');
2121
2159
  const gitPath = `${tmpDir}/git`;
2122
2160
  await writeFile(gitPath, `#!${nodePath}
@@ -2125,8 +2163,10 @@ const createExecutable = async content => {
2125
2163
  return gitPath;
2126
2164
  };
2127
2165
  const createExecutableFrom = async path => {
2166
+ // @ts-ignore
2128
2167
  const testPath = await invoke('PlatformPaths.getTestPath');
2129
2168
  const absolutePath = testPath + Slash + path;
2169
+ // @ts-ignore
2130
2170
  const content = await invoke('Ajax.getText', absolutePath);
2131
2171
  return createExecutable(content);
2132
2172
  };
@@ -2328,6 +2368,7 @@ const press = async key => {
2328
2368
  bubbles: true,
2329
2369
  ...keyOptions
2330
2370
  };
2371
+ // @ts-ignore
2331
2372
  await invoke('TestFrameWork.performKeyBoardAction', 'press', options);
2332
2373
  };
2333
2374
 
@@ -2417,6 +2458,7 @@ const getIsFirefox = () => {
2417
2458
  const isFirefox$1 = getIsFirefox();
2418
2459
 
2419
2460
  const getNodePath$1 = () => {
2461
+ // @ts-ignore
2420
2462
  return invoke(/* Platform.getNodePath */'Platform.getNodePath');
2421
2463
  };
2422
2464
 
@@ -2434,6 +2476,7 @@ const TestFrameWorkComponentPlatform = {
2434
2476
  };
2435
2477
 
2436
2478
  const show = async () => {
2479
+ // @ts-ignore
2437
2480
  await invoke('Panel.selectIndex', 0);
2438
2481
  };
2439
2482
 
@@ -2445,44 +2488,59 @@ const TestFrameWorkComponentProblems = {
2445
2488
  const QuickPick = 'QuickPick';
2446
2489
 
2447
2490
  const open$1 = async () => {
2491
+ // @ts-ignore
2448
2492
  await invoke('Viewlet.openWidget', QuickPick, 'everything');
2449
2493
  };
2450
2494
  const handleInput$1 = async value => {
2495
+ // @ts-ignore
2451
2496
  await invoke('QuickPick.handleInput', value, 0);
2452
2497
  };
2453
2498
  const handleClickAt = async (x, y) => {
2499
+ // @ts-ignore
2454
2500
  await invoke('QuickPick.handleClickAt', x, y);
2455
2501
  };
2456
2502
  const setValue$1 = async value => {
2503
+ // @ts-ignore
2457
2504
  await invoke('QuickPick.setValue', value);
2458
2505
  };
2459
2506
  const focusNext$2 = async () => {
2507
+ // @ts-ignore
2460
2508
  await invoke('QuickPick.focusNext');
2461
2509
  };
2462
2510
  const focusFirst$2 = async () => {
2511
+ // @ts-ignore
2463
2512
  await invoke('QuickPick.focusFirst');
2464
2513
  };
2465
2514
  const focusLast$1 = async () => {
2515
+ // @ts-ignore
2466
2516
  await invoke('QuickPick.focusLast');
2467
2517
  };
2468
2518
  const focusIndex$2 = async index => {
2519
+ // @ts-ignore
2469
2520
  await invoke('QuickPick.focusIndex', index);
2470
2521
  };
2471
2522
  const focusPrevious$2 = async () => {
2523
+ // @ts-ignore
2472
2524
  await invoke('QuickPick.focusPrevious');
2473
2525
  };
2474
2526
  const selectItem = async label => {
2527
+ // @ts-ignore
2475
2528
  await invoke('QuickPick.selectItem', label);
2476
2529
  };
2477
2530
  const selectIndex$2 = async index => {
2531
+ // @ts-ignore
2478
2532
  await invoke('QuickPick.selectIndex', index);
2479
2533
  };
2480
2534
  const selectCurrentIndex = async () => {
2535
+ // @ts-ignore
2481
2536
  await invoke('QuickPick.selectCurrentIndex');
2482
2537
  };
2483
2538
  const executeCommand = async label => {
2539
+ // @ts-ignore
2484
2540
  await invoke('QuickPick.showCommands');
2541
+ // @ts-ignore
2485
2542
  await invoke('QuickPick.handleInput', label, 0);
2543
+ // @ts-ignore
2486
2544
  await invoke('QuickPick.selectItem', label);
2487
2545
  };
2488
2546
 
@@ -2506,18 +2564,22 @@ const TestFrameWorkComponentQuickPick = {
2506
2564
  const Script = 2;
2507
2565
 
2508
2566
  const setValue = async value => {
2567
+ // @ts-ignore
2509
2568
  await invoke('Search.handleInput', value, Script);
2510
2569
  };
2511
2570
  const setReplaceValue = async value => {
2571
+ // @ts-ignore
2512
2572
  await invoke('Search.handleReplaceInput', value, Script);
2513
2573
  };
2514
2574
  const setExcludeValue = async value => {
2575
+ // @ts-ignore
2515
2576
  await invoke('Search.handleExcludeInput', value, Script);
2516
2577
  };
2517
2578
  const replaceAll = async () => {
2518
2579
  await invoke('Search.replaceAll');
2519
2580
  };
2520
2581
  const setIncludeValue = async value => {
2582
+ // @ts-ignore
2521
2583
  await invoke('Search.handleIncludeInput', value, Script);
2522
2584
  };
2523
2585
  const clearSearchResults = async () => {
@@ -2548,6 +2610,7 @@ const handleWheel = async (deltaMode, deltaY) => {
2548
2610
  await invoke('Search.handleWheel', deltaMode, deltaY);
2549
2611
  };
2550
2612
  const focusNextPage = async () => {
2613
+ // @ts-ignore
2551
2614
  await invoke('Search.focusPage');
2552
2615
  };
2553
2616
  const focusPreviousPage = async () => {
@@ -2603,6 +2666,7 @@ const TestFrameWorkComponentSearch = {
2603
2666
  };
2604
2667
 
2605
2668
  const update$1 = settings => {
2669
+ // @ts-ignore
2606
2670
  return invoke('Preferences.update', settings);
2607
2671
  };
2608
2672
 
@@ -2625,6 +2689,7 @@ const TestFrameWorkComponentSideBar = {
2625
2689
  };
2626
2690
 
2627
2691
  const selectIndex = async index => {
2692
+ // @ts-ignore
2628
2693
  await invoke('Source Control.selectIndex');
2629
2694
  };
2630
2695
  const acceptInput = async () => {
@@ -2664,6 +2729,7 @@ const focusFirst = async () => {
2664
2729
  await invoke('TitleBarMenuBar.focusFirst');
2665
2730
  };
2666
2731
  const focusIndex = async index => {
2732
+ // @ts-ignore
2667
2733
  await invoke('TitleBarMenuBar.focusIndex', index);
2668
2734
  };
2669
2735
  const focusLast = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/test-worker",
3
- "version": "4.21.0",
3
+ "version": "4.23.0",
4
4
  "description": "Test Worker",
5
5
  "repository": {
6
6
  "type": "git",