@lvce-editor/test-worker 4.21.0 → 4.22.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.
- package/dist/testWorkerMain.js +76 -12
- package/package.json +1 -1
package/dist/testWorkerMain.js
CHANGED
|
@@ -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,6 +982,11 @@ 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
991
|
const set$a = (id, rpc) => {
|
|
980
992
|
rpcs[id] = rpc;
|
|
@@ -1018,10 +1030,10 @@ const RendererWorker = {
|
|
|
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,
|
|
@@ -1071,7 +1083,7 @@ const executeTest = async (name, fn, globals = {}) => {
|
|
|
1071
1083
|
if (!(error instanceof VError)) {
|
|
1072
1084
|
error = new VError(error, `Test failed: ${name}`);
|
|
1073
1085
|
}
|
|
1074
|
-
|
|
1086
|
+
await printTestError(error);
|
|
1075
1087
|
}
|
|
1076
1088
|
let state;
|
|
1077
1089
|
let background;
|
|
@@ -1085,6 +1097,7 @@ const executeTest = async (name, fn, globals = {}) => {
|
|
|
1085
1097
|
text = `test passed in ${_formattedDuration}`;
|
|
1086
1098
|
state = Pass;
|
|
1087
1099
|
}
|
|
1100
|
+
// @ts-ignore
|
|
1088
1101
|
await invoke('TestFrameWork.showOverlay', state, background, text);
|
|
1089
1102
|
};
|
|
1090
1103
|
|
|
@@ -1501,6 +1514,7 @@ test.skip = async id => {
|
|
|
1501
1514
|
const state = 'skip';
|
|
1502
1515
|
const background = 'yellow';
|
|
1503
1516
|
const text = `test skipped ${id}`;
|
|
1517
|
+
// @ts-ignore
|
|
1504
1518
|
await invoke('TestFrameWork.showOverlay', state, background, text);
|
|
1505
1519
|
};
|
|
1506
1520
|
const {
|
|
@@ -1626,6 +1640,7 @@ const TestFrameWorkComponentBaseUrl = {
|
|
|
1626
1640
|
};
|
|
1627
1641
|
|
|
1628
1642
|
const execute$1 = async (id, ...args) => {
|
|
1643
|
+
// @ts-ignore
|
|
1629
1644
|
return invoke(id, ...args);
|
|
1630
1645
|
};
|
|
1631
1646
|
|
|
@@ -1644,27 +1659,35 @@ const TestFrameWorkComponentContextMenu = {
|
|
|
1644
1659
|
};
|
|
1645
1660
|
|
|
1646
1661
|
const openIframeInspector = async () => {
|
|
1662
|
+
// @ts-ignore
|
|
1647
1663
|
return invoke('Developer.openIframeInspector');
|
|
1648
1664
|
};
|
|
1649
1665
|
const openCacheFolder = async () => {
|
|
1666
|
+
// @ts-ignore
|
|
1650
1667
|
return invoke('Developer.openCacheFolder');
|
|
1651
1668
|
};
|
|
1652
1669
|
const openConfigFolder = async () => {
|
|
1670
|
+
// @ts-ignore
|
|
1653
1671
|
return invoke('Developer.openConfigFolder');
|
|
1654
1672
|
};
|
|
1655
1673
|
const openLogsFolder = async () => {
|
|
1674
|
+
// @ts-ignore
|
|
1656
1675
|
return invoke('Developer.openLogsFolder');
|
|
1657
1676
|
};
|
|
1658
1677
|
const openProcessExplorer = async () => {
|
|
1678
|
+
// @ts-ignore
|
|
1659
1679
|
return invoke('Developer.openProcessExplorer');
|
|
1660
1680
|
};
|
|
1661
1681
|
const reloadColorTheme = async () => {
|
|
1682
|
+
// @ts-ignore
|
|
1662
1683
|
return invoke('Developer.reloadColorTheme');
|
|
1663
1684
|
};
|
|
1664
1685
|
const reloadIconTheme = async () => {
|
|
1686
|
+
// @ts-ignore
|
|
1665
1687
|
return invoke('Developer.reloadIconTheme');
|
|
1666
1688
|
};
|
|
1667
1689
|
const toggleDeveloperTools = async () => {
|
|
1690
|
+
// @ts-ignore
|
|
1668
1691
|
return invoke('Developer.toggleDeveloperTools');
|
|
1669
1692
|
};
|
|
1670
1693
|
|
|
@@ -1687,7 +1710,8 @@ const openCompletion = async () => {
|
|
|
1687
1710
|
await invoke('Editor.openCompletion');
|
|
1688
1711
|
};
|
|
1689
1712
|
const closeCompletion = async () => {
|
|
1690
|
-
|
|
1713
|
+
// @ts-ignore
|
|
1714
|
+
await invoke('EditorCompletion.close');
|
|
1691
1715
|
};
|
|
1692
1716
|
const openEditorContextMenu = async () => {
|
|
1693
1717
|
await invoke('Editor.handleContextMenu', 0, 0);
|
|
@@ -1735,9 +1759,11 @@ const type = async text => {
|
|
|
1735
1759
|
await invoke('Editor.type', text);
|
|
1736
1760
|
};
|
|
1737
1761
|
const findAllReferences = async () => {
|
|
1762
|
+
// @ts-ignore
|
|
1738
1763
|
await invoke('SideBar.show', 'References', /* focus */true);
|
|
1739
1764
|
};
|
|
1740
1765
|
const findAllImplementations = async () => {
|
|
1766
|
+
// @ts-ignore
|
|
1741
1767
|
await invoke('SideBar.show', 'Implementations', /* focus */true);
|
|
1742
1768
|
};
|
|
1743
1769
|
const setSelections = async selections => {
|
|
@@ -1765,9 +1791,11 @@ const openCompletionDetails = async () => {
|
|
|
1765
1791
|
await invoke('EditorCompletion.openDetails');
|
|
1766
1792
|
};
|
|
1767
1793
|
const closeCompletionDetails = async () => {
|
|
1794
|
+
// @ts-ignore
|
|
1768
1795
|
await invoke('EditorCompletion.closeDetails');
|
|
1769
1796
|
};
|
|
1770
1797
|
const toggleCompletionDetails = async () => {
|
|
1798
|
+
// @ts-ignore
|
|
1771
1799
|
await invoke('EditorCompletion.toggleDetails');
|
|
1772
1800
|
};
|
|
1773
1801
|
const organizeImports = async () => {
|
|
@@ -1792,6 +1820,7 @@ const openColorPicker = async () => {
|
|
|
1792
1820
|
await invoke('Editor.openColorPicker');
|
|
1793
1821
|
};
|
|
1794
1822
|
const openFind = async () => {
|
|
1823
|
+
// @ts-ignore
|
|
1795
1824
|
await invoke('Editor.openFind2');
|
|
1796
1825
|
};
|
|
1797
1826
|
const deleteAllLeft = async () => {
|
|
@@ -1917,6 +1946,7 @@ const TestFrameWorkComponentEditorCompletion = {
|
|
|
1917
1946
|
};
|
|
1918
1947
|
|
|
1919
1948
|
const openContextMenu = async index => {
|
|
1949
|
+
// @ts-ignore
|
|
1920
1950
|
await invoke('Explorer.handleContextMenuKeyboard', index);
|
|
1921
1951
|
};
|
|
1922
1952
|
const handleDragLeave = async () => {
|
|
@@ -1932,6 +1962,7 @@ const focus$1 = async () => {
|
|
|
1932
1962
|
await invoke('Explorer.focusIndex', -1);
|
|
1933
1963
|
};
|
|
1934
1964
|
const focusNext$7 = async () => {
|
|
1965
|
+
// @ts-ignore
|
|
1935
1966
|
await invoke('Explorer.focusNext');
|
|
1936
1967
|
};
|
|
1937
1968
|
const selectUp = async () => {
|
|
@@ -1974,9 +2005,11 @@ const handleClick$1 = async index => {
|
|
|
1974
2005
|
await invoke('Explorer.handleClick', index);
|
|
1975
2006
|
};
|
|
1976
2007
|
const handleClickAt$1 = async (preventDefault, button, ctrlKey, shiftKey, x, y) => {
|
|
2008
|
+
// @ts-ignore
|
|
1977
2009
|
await invoke('Explorer.handleClickAt', preventDefault, button, ctrlKey, shiftKey, x, y);
|
|
1978
2010
|
};
|
|
1979
2011
|
const handleDrop = async (x, y, fileIds, fileList) => {
|
|
2012
|
+
// @ts-ignore
|
|
1980
2013
|
await invoke('Explorer.handleDrop', x, y, fileIds, fileIds);
|
|
1981
2014
|
};
|
|
1982
2015
|
const rename = async () => {
|
|
@@ -2107,16 +2140,19 @@ const getTmpDir = async ({
|
|
|
2107
2140
|
case Memfs:
|
|
2108
2141
|
return 'memfs:///workspace';
|
|
2109
2142
|
default:
|
|
2143
|
+
// @ts-ignore
|
|
2110
2144
|
return invoke('PlatformPaths.getTmpDir');
|
|
2111
2145
|
}
|
|
2112
2146
|
};
|
|
2113
2147
|
const chmod = async (uri, permissions) => {
|
|
2148
|
+
// @ts-ignore
|
|
2114
2149
|
await invoke('FileSystem.chmod', uri, permissions);
|
|
2115
2150
|
};
|
|
2116
2151
|
const createExecutable = async content => {
|
|
2117
2152
|
const tmpDir = await getTmpDir({
|
|
2118
2153
|
scheme: 'file'
|
|
2119
2154
|
});
|
|
2155
|
+
// @ts-ignore
|
|
2120
2156
|
const nodePath = await invoke('PlatformPaths.getNodePath');
|
|
2121
2157
|
const gitPath = `${tmpDir}/git`;
|
|
2122
2158
|
await writeFile(gitPath, `#!${nodePath}
|
|
@@ -2125,8 +2161,10 @@ const createExecutable = async content => {
|
|
|
2125
2161
|
return gitPath;
|
|
2126
2162
|
};
|
|
2127
2163
|
const createExecutableFrom = async path => {
|
|
2164
|
+
// @ts-ignore
|
|
2128
2165
|
const testPath = await invoke('PlatformPaths.getTestPath');
|
|
2129
2166
|
const absolutePath = testPath + Slash + path;
|
|
2167
|
+
// @ts-ignore
|
|
2130
2168
|
const content = await invoke('Ajax.getText', absolutePath);
|
|
2131
2169
|
return createExecutable(content);
|
|
2132
2170
|
};
|
|
@@ -2328,6 +2366,7 @@ const press = async key => {
|
|
|
2328
2366
|
bubbles: true,
|
|
2329
2367
|
...keyOptions
|
|
2330
2368
|
};
|
|
2369
|
+
// @ts-ignore
|
|
2331
2370
|
await invoke('TestFrameWork.performKeyBoardAction', 'press', options);
|
|
2332
2371
|
};
|
|
2333
2372
|
|
|
@@ -2417,6 +2456,7 @@ const getIsFirefox = () => {
|
|
|
2417
2456
|
const isFirefox$1 = getIsFirefox();
|
|
2418
2457
|
|
|
2419
2458
|
const getNodePath$1 = () => {
|
|
2459
|
+
// @ts-ignore
|
|
2420
2460
|
return invoke(/* Platform.getNodePath */'Platform.getNodePath');
|
|
2421
2461
|
};
|
|
2422
2462
|
|
|
@@ -2434,6 +2474,7 @@ const TestFrameWorkComponentPlatform = {
|
|
|
2434
2474
|
};
|
|
2435
2475
|
|
|
2436
2476
|
const show = async () => {
|
|
2477
|
+
// @ts-ignore
|
|
2437
2478
|
await invoke('Panel.selectIndex', 0);
|
|
2438
2479
|
};
|
|
2439
2480
|
|
|
@@ -2445,44 +2486,59 @@ const TestFrameWorkComponentProblems = {
|
|
|
2445
2486
|
const QuickPick = 'QuickPick';
|
|
2446
2487
|
|
|
2447
2488
|
const open$1 = async () => {
|
|
2489
|
+
// @ts-ignore
|
|
2448
2490
|
await invoke('Viewlet.openWidget', QuickPick, 'everything');
|
|
2449
2491
|
};
|
|
2450
2492
|
const handleInput$1 = async value => {
|
|
2493
|
+
// @ts-ignore
|
|
2451
2494
|
await invoke('QuickPick.handleInput', value, 0);
|
|
2452
2495
|
};
|
|
2453
2496
|
const handleClickAt = async (x, y) => {
|
|
2497
|
+
// @ts-ignore
|
|
2454
2498
|
await invoke('QuickPick.handleClickAt', x, y);
|
|
2455
2499
|
};
|
|
2456
2500
|
const setValue$1 = async value => {
|
|
2501
|
+
// @ts-ignore
|
|
2457
2502
|
await invoke('QuickPick.setValue', value);
|
|
2458
2503
|
};
|
|
2459
2504
|
const focusNext$2 = async () => {
|
|
2505
|
+
// @ts-ignore
|
|
2460
2506
|
await invoke('QuickPick.focusNext');
|
|
2461
2507
|
};
|
|
2462
2508
|
const focusFirst$2 = async () => {
|
|
2509
|
+
// @ts-ignore
|
|
2463
2510
|
await invoke('QuickPick.focusFirst');
|
|
2464
2511
|
};
|
|
2465
2512
|
const focusLast$1 = async () => {
|
|
2513
|
+
// @ts-ignore
|
|
2466
2514
|
await invoke('QuickPick.focusLast');
|
|
2467
2515
|
};
|
|
2468
2516
|
const focusIndex$2 = async index => {
|
|
2517
|
+
// @ts-ignore
|
|
2469
2518
|
await invoke('QuickPick.focusIndex', index);
|
|
2470
2519
|
};
|
|
2471
2520
|
const focusPrevious$2 = async () => {
|
|
2521
|
+
// @ts-ignore
|
|
2472
2522
|
await invoke('QuickPick.focusPrevious');
|
|
2473
2523
|
};
|
|
2474
2524
|
const selectItem = async label => {
|
|
2525
|
+
// @ts-ignore
|
|
2475
2526
|
await invoke('QuickPick.selectItem', label);
|
|
2476
2527
|
};
|
|
2477
2528
|
const selectIndex$2 = async index => {
|
|
2529
|
+
// @ts-ignore
|
|
2478
2530
|
await invoke('QuickPick.selectIndex', index);
|
|
2479
2531
|
};
|
|
2480
2532
|
const selectCurrentIndex = async () => {
|
|
2533
|
+
// @ts-ignore
|
|
2481
2534
|
await invoke('QuickPick.selectCurrentIndex');
|
|
2482
2535
|
};
|
|
2483
2536
|
const executeCommand = async label => {
|
|
2537
|
+
// @ts-ignore
|
|
2484
2538
|
await invoke('QuickPick.showCommands');
|
|
2539
|
+
// @ts-ignore
|
|
2485
2540
|
await invoke('QuickPick.handleInput', label, 0);
|
|
2541
|
+
// @ts-ignore
|
|
2486
2542
|
await invoke('QuickPick.selectItem', label);
|
|
2487
2543
|
};
|
|
2488
2544
|
|
|
@@ -2506,18 +2562,22 @@ const TestFrameWorkComponentQuickPick = {
|
|
|
2506
2562
|
const Script = 2;
|
|
2507
2563
|
|
|
2508
2564
|
const setValue = async value => {
|
|
2565
|
+
// @ts-ignore
|
|
2509
2566
|
await invoke('Search.handleInput', value, Script);
|
|
2510
2567
|
};
|
|
2511
2568
|
const setReplaceValue = async value => {
|
|
2569
|
+
// @ts-ignore
|
|
2512
2570
|
await invoke('Search.handleReplaceInput', value, Script);
|
|
2513
2571
|
};
|
|
2514
2572
|
const setExcludeValue = async value => {
|
|
2573
|
+
// @ts-ignore
|
|
2515
2574
|
await invoke('Search.handleExcludeInput', value, Script);
|
|
2516
2575
|
};
|
|
2517
2576
|
const replaceAll = async () => {
|
|
2518
2577
|
await invoke('Search.replaceAll');
|
|
2519
2578
|
};
|
|
2520
2579
|
const setIncludeValue = async value => {
|
|
2580
|
+
// @ts-ignore
|
|
2521
2581
|
await invoke('Search.handleIncludeInput', value, Script);
|
|
2522
2582
|
};
|
|
2523
2583
|
const clearSearchResults = async () => {
|
|
@@ -2548,6 +2608,7 @@ const handleWheel = async (deltaMode, deltaY) => {
|
|
|
2548
2608
|
await invoke('Search.handleWheel', deltaMode, deltaY);
|
|
2549
2609
|
};
|
|
2550
2610
|
const focusNextPage = async () => {
|
|
2611
|
+
// @ts-ignore
|
|
2551
2612
|
await invoke('Search.focusPage');
|
|
2552
2613
|
};
|
|
2553
2614
|
const focusPreviousPage = async () => {
|
|
@@ -2603,6 +2664,7 @@ const TestFrameWorkComponentSearch = {
|
|
|
2603
2664
|
};
|
|
2604
2665
|
|
|
2605
2666
|
const update$1 = settings => {
|
|
2667
|
+
// @ts-ignore
|
|
2606
2668
|
return invoke('Preferences.update', settings);
|
|
2607
2669
|
};
|
|
2608
2670
|
|
|
@@ -2625,6 +2687,7 @@ const TestFrameWorkComponentSideBar = {
|
|
|
2625
2687
|
};
|
|
2626
2688
|
|
|
2627
2689
|
const selectIndex = async index => {
|
|
2690
|
+
// @ts-ignore
|
|
2628
2691
|
await invoke('Source Control.selectIndex');
|
|
2629
2692
|
};
|
|
2630
2693
|
const acceptInput = async () => {
|
|
@@ -2664,6 +2727,7 @@ const focusFirst = async () => {
|
|
|
2664
2727
|
await invoke('TitleBarMenuBar.focusFirst');
|
|
2665
2728
|
};
|
|
2666
2729
|
const focusIndex = async index => {
|
|
2730
|
+
// @ts-ignore
|
|
2667
2731
|
await invoke('TitleBarMenuBar.focusIndex', index);
|
|
2668
2732
|
};
|
|
2669
2733
|
const focusLast = async () => {
|