@lvce-editor/test-worker 4.20.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 +96 -21
- 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);
|
|
@@ -708,6 +715,17 @@ const getErrorType = prettyError => {
|
|
|
708
715
|
}
|
|
709
716
|
return undefined;
|
|
710
717
|
};
|
|
718
|
+
const isAlreadyStack = line => {
|
|
719
|
+
return line.trim().startsWith('at ');
|
|
720
|
+
};
|
|
721
|
+
const getStack = prettyError => {
|
|
722
|
+
const stackString = prettyError.stack || '';
|
|
723
|
+
const newLineIndex = stackString.indexOf('\n');
|
|
724
|
+
if (newLineIndex !== -1 && !isAlreadyStack(stackString.slice(0, newLineIndex))) {
|
|
725
|
+
return stackString.slice(newLineIndex + 1);
|
|
726
|
+
}
|
|
727
|
+
return stackString;
|
|
728
|
+
};
|
|
711
729
|
const getErrorProperty = (error, prettyError) => {
|
|
712
730
|
if (error && error.code === E_COMMAND_NOT_FOUND) {
|
|
713
731
|
return {
|
|
@@ -720,7 +738,7 @@ const getErrorProperty = (error, prettyError) => {
|
|
|
720
738
|
code: Custom,
|
|
721
739
|
message: prettyError.message,
|
|
722
740
|
data: {
|
|
723
|
-
stack: prettyError
|
|
741
|
+
stack: getStack(prettyError),
|
|
724
742
|
codeFrame: prettyError.codeFrame,
|
|
725
743
|
type: getErrorType(prettyError),
|
|
726
744
|
code: prettyError.code,
|
|
@@ -964,8 +982,13 @@ const printError = error => {
|
|
|
964
982
|
}
|
|
965
983
|
};
|
|
966
984
|
|
|
985
|
+
const printTestError = async error => {
|
|
986
|
+
// TODO ask error worker to add codeframe
|
|
987
|
+
printError(error);
|
|
988
|
+
};
|
|
989
|
+
|
|
967
990
|
const rpcs = Object.create(null);
|
|
968
|
-
const set$
|
|
991
|
+
const set$a = (id, rpc) => {
|
|
969
992
|
rpcs[id] = rpc;
|
|
970
993
|
};
|
|
971
994
|
const get$1 = id => {
|
|
@@ -989,28 +1012,28 @@ const create$1 = rpcId => {
|
|
|
989
1012
|
return rpc.invokeAndTransfer(method, ...params);
|
|
990
1013
|
},
|
|
991
1014
|
set(rpc) {
|
|
992
|
-
set$
|
|
1015
|
+
set$a(rpcId, rpc);
|
|
993
1016
|
}
|
|
994
1017
|
};
|
|
995
1018
|
};
|
|
996
1019
|
const RendererWorker$1 = 1;
|
|
997
1020
|
const {
|
|
998
|
-
invoke: invoke$
|
|
999
|
-
invokeAndTransfer: invokeAndTransfer$
|
|
1000
|
-
set: set$
|
|
1021
|
+
invoke: invoke$5,
|
|
1022
|
+
invokeAndTransfer: invokeAndTransfer$5,
|
|
1023
|
+
set: set$5
|
|
1001
1024
|
} = create$1(RendererWorker$1);
|
|
1002
1025
|
const RendererWorker = {
|
|
1003
1026
|
__proto__: null,
|
|
1004
|
-
invoke: invoke$
|
|
1005
|
-
invokeAndTransfer: invokeAndTransfer$
|
|
1006
|
-
set: set$
|
|
1027
|
+
invoke: invoke$5,
|
|
1028
|
+
invokeAndTransfer: invokeAndTransfer$5,
|
|
1029
|
+
set: set$5
|
|
1007
1030
|
};
|
|
1008
1031
|
|
|
1009
1032
|
const {
|
|
1010
|
-
set: set$1
|
|
1033
|
+
set: set$1,
|
|
1034
|
+
invoke,
|
|
1035
|
+
invokeAndTransfer
|
|
1011
1036
|
} = RendererWorker;
|
|
1012
|
-
const invoke = RendererWorker.invoke;
|
|
1013
|
-
const invokeAndTransfer = RendererWorker.invokeAndTransfer;
|
|
1014
1037
|
|
|
1015
1038
|
const Rpc = {
|
|
1016
1039
|
__proto__: null,
|
|
@@ -1060,7 +1083,7 @@ const executeTest = async (name, fn, globals = {}) => {
|
|
|
1060
1083
|
if (!(error instanceof VError)) {
|
|
1061
1084
|
error = new VError(error, `Test failed: ${name}`);
|
|
1062
1085
|
}
|
|
1063
|
-
|
|
1086
|
+
await printTestError(error);
|
|
1064
1087
|
}
|
|
1065
1088
|
let state;
|
|
1066
1089
|
let background;
|
|
@@ -1074,6 +1097,7 @@ const executeTest = async (name, fn, globals = {}) => {
|
|
|
1074
1097
|
text = `test passed in ${_formattedDuration}`;
|
|
1075
1098
|
state = Pass;
|
|
1076
1099
|
}
|
|
1100
|
+
// @ts-ignore
|
|
1077
1101
|
await invoke('TestFrameWork.showOverlay', state, background, text);
|
|
1078
1102
|
};
|
|
1079
1103
|
|
|
@@ -1490,6 +1514,7 @@ test.skip = async id => {
|
|
|
1490
1514
|
const state = 'skip';
|
|
1491
1515
|
const background = 'yellow';
|
|
1492
1516
|
const text = `test skipped ${id}`;
|
|
1517
|
+
// @ts-ignore
|
|
1493
1518
|
await invoke('TestFrameWork.showOverlay', state, background, text);
|
|
1494
1519
|
};
|
|
1495
1520
|
const {
|
|
@@ -1615,6 +1640,7 @@ const TestFrameWorkComponentBaseUrl = {
|
|
|
1615
1640
|
};
|
|
1616
1641
|
|
|
1617
1642
|
const execute$1 = async (id, ...args) => {
|
|
1643
|
+
// @ts-ignore
|
|
1618
1644
|
return invoke(id, ...args);
|
|
1619
1645
|
};
|
|
1620
1646
|
|
|
@@ -1633,27 +1659,35 @@ const TestFrameWorkComponentContextMenu = {
|
|
|
1633
1659
|
};
|
|
1634
1660
|
|
|
1635
1661
|
const openIframeInspector = async () => {
|
|
1662
|
+
// @ts-ignore
|
|
1636
1663
|
return invoke('Developer.openIframeInspector');
|
|
1637
1664
|
};
|
|
1638
1665
|
const openCacheFolder = async () => {
|
|
1666
|
+
// @ts-ignore
|
|
1639
1667
|
return invoke('Developer.openCacheFolder');
|
|
1640
1668
|
};
|
|
1641
1669
|
const openConfigFolder = async () => {
|
|
1670
|
+
// @ts-ignore
|
|
1642
1671
|
return invoke('Developer.openConfigFolder');
|
|
1643
1672
|
};
|
|
1644
1673
|
const openLogsFolder = async () => {
|
|
1674
|
+
// @ts-ignore
|
|
1645
1675
|
return invoke('Developer.openLogsFolder');
|
|
1646
1676
|
};
|
|
1647
1677
|
const openProcessExplorer = async () => {
|
|
1678
|
+
// @ts-ignore
|
|
1648
1679
|
return invoke('Developer.openProcessExplorer');
|
|
1649
1680
|
};
|
|
1650
1681
|
const reloadColorTheme = async () => {
|
|
1682
|
+
// @ts-ignore
|
|
1651
1683
|
return invoke('Developer.reloadColorTheme');
|
|
1652
1684
|
};
|
|
1653
1685
|
const reloadIconTheme = async () => {
|
|
1686
|
+
// @ts-ignore
|
|
1654
1687
|
return invoke('Developer.reloadIconTheme');
|
|
1655
1688
|
};
|
|
1656
1689
|
const toggleDeveloperTools = async () => {
|
|
1690
|
+
// @ts-ignore
|
|
1657
1691
|
return invoke('Developer.toggleDeveloperTools');
|
|
1658
1692
|
};
|
|
1659
1693
|
|
|
@@ -1676,7 +1710,8 @@ const openCompletion = async () => {
|
|
|
1676
1710
|
await invoke('Editor.openCompletion');
|
|
1677
1711
|
};
|
|
1678
1712
|
const closeCompletion = async () => {
|
|
1679
|
-
|
|
1713
|
+
// @ts-ignore
|
|
1714
|
+
await invoke('EditorCompletion.close');
|
|
1680
1715
|
};
|
|
1681
1716
|
const openEditorContextMenu = async () => {
|
|
1682
1717
|
await invoke('Editor.handleContextMenu', 0, 0);
|
|
@@ -1724,9 +1759,11 @@ const type = async text => {
|
|
|
1724
1759
|
await invoke('Editor.type', text);
|
|
1725
1760
|
};
|
|
1726
1761
|
const findAllReferences = async () => {
|
|
1762
|
+
// @ts-ignore
|
|
1727
1763
|
await invoke('SideBar.show', 'References', /* focus */true);
|
|
1728
1764
|
};
|
|
1729
1765
|
const findAllImplementations = async () => {
|
|
1766
|
+
// @ts-ignore
|
|
1730
1767
|
await invoke('SideBar.show', 'Implementations', /* focus */true);
|
|
1731
1768
|
};
|
|
1732
1769
|
const setSelections = async selections => {
|
|
@@ -1754,9 +1791,11 @@ const openCompletionDetails = async () => {
|
|
|
1754
1791
|
await invoke('EditorCompletion.openDetails');
|
|
1755
1792
|
};
|
|
1756
1793
|
const closeCompletionDetails = async () => {
|
|
1794
|
+
// @ts-ignore
|
|
1757
1795
|
await invoke('EditorCompletion.closeDetails');
|
|
1758
1796
|
};
|
|
1759
1797
|
const toggleCompletionDetails = async () => {
|
|
1798
|
+
// @ts-ignore
|
|
1760
1799
|
await invoke('EditorCompletion.toggleDetails');
|
|
1761
1800
|
};
|
|
1762
1801
|
const organizeImports = async () => {
|
|
@@ -1781,6 +1820,7 @@ const openColorPicker = async () => {
|
|
|
1781
1820
|
await invoke('Editor.openColorPicker');
|
|
1782
1821
|
};
|
|
1783
1822
|
const openFind = async () => {
|
|
1823
|
+
// @ts-ignore
|
|
1784
1824
|
await invoke('Editor.openFind2');
|
|
1785
1825
|
};
|
|
1786
1826
|
const deleteAllLeft = async () => {
|
|
@@ -1906,6 +1946,7 @@ const TestFrameWorkComponentEditorCompletion = {
|
|
|
1906
1946
|
};
|
|
1907
1947
|
|
|
1908
1948
|
const openContextMenu = async index => {
|
|
1949
|
+
// @ts-ignore
|
|
1909
1950
|
await invoke('Explorer.handleContextMenuKeyboard', index);
|
|
1910
1951
|
};
|
|
1911
1952
|
const handleDragLeave = async () => {
|
|
@@ -1921,6 +1962,7 @@ const focus$1 = async () => {
|
|
|
1921
1962
|
await invoke('Explorer.focusIndex', -1);
|
|
1922
1963
|
};
|
|
1923
1964
|
const focusNext$7 = async () => {
|
|
1965
|
+
// @ts-ignore
|
|
1924
1966
|
await invoke('Explorer.focusNext');
|
|
1925
1967
|
};
|
|
1926
1968
|
const selectUp = async () => {
|
|
@@ -1963,9 +2005,11 @@ const handleClick$1 = async index => {
|
|
|
1963
2005
|
await invoke('Explorer.handleClick', index);
|
|
1964
2006
|
};
|
|
1965
2007
|
const handleClickAt$1 = async (preventDefault, button, ctrlKey, shiftKey, x, y) => {
|
|
2008
|
+
// @ts-ignore
|
|
1966
2009
|
await invoke('Explorer.handleClickAt', preventDefault, button, ctrlKey, shiftKey, x, y);
|
|
1967
2010
|
};
|
|
1968
2011
|
const handleDrop = async (x, y, fileIds, fileList) => {
|
|
2012
|
+
// @ts-ignore
|
|
1969
2013
|
await invoke('Explorer.handleDrop', x, y, fileIds, fileIds);
|
|
1970
2014
|
};
|
|
1971
2015
|
const rename = async () => {
|
|
@@ -2096,16 +2140,19 @@ const getTmpDir = async ({
|
|
|
2096
2140
|
case Memfs:
|
|
2097
2141
|
return 'memfs:///workspace';
|
|
2098
2142
|
default:
|
|
2143
|
+
// @ts-ignore
|
|
2099
2144
|
return invoke('PlatformPaths.getTmpDir');
|
|
2100
2145
|
}
|
|
2101
2146
|
};
|
|
2102
2147
|
const chmod = async (uri, permissions) => {
|
|
2148
|
+
// @ts-ignore
|
|
2103
2149
|
await invoke('FileSystem.chmod', uri, permissions);
|
|
2104
2150
|
};
|
|
2105
2151
|
const createExecutable = async content => {
|
|
2106
2152
|
const tmpDir = await getTmpDir({
|
|
2107
2153
|
scheme: 'file'
|
|
2108
2154
|
});
|
|
2155
|
+
// @ts-ignore
|
|
2109
2156
|
const nodePath = await invoke('PlatformPaths.getNodePath');
|
|
2110
2157
|
const gitPath = `${tmpDir}/git`;
|
|
2111
2158
|
await writeFile(gitPath, `#!${nodePath}
|
|
@@ -2114,8 +2161,10 @@ const createExecutable = async content => {
|
|
|
2114
2161
|
return gitPath;
|
|
2115
2162
|
};
|
|
2116
2163
|
const createExecutableFrom = async path => {
|
|
2164
|
+
// @ts-ignore
|
|
2117
2165
|
const testPath = await invoke('PlatformPaths.getTestPath');
|
|
2118
2166
|
const absolutePath = testPath + Slash + path;
|
|
2167
|
+
// @ts-ignore
|
|
2119
2168
|
const content = await invoke('Ajax.getText', absolutePath);
|
|
2120
2169
|
return createExecutable(content);
|
|
2121
2170
|
};
|
|
@@ -2317,6 +2366,7 @@ const press = async key => {
|
|
|
2317
2366
|
bubbles: true,
|
|
2318
2367
|
...keyOptions
|
|
2319
2368
|
};
|
|
2369
|
+
// @ts-ignore
|
|
2320
2370
|
await invoke('TestFrameWork.performKeyBoardAction', 'press', options);
|
|
2321
2371
|
};
|
|
2322
2372
|
|
|
@@ -2406,6 +2456,7 @@ const getIsFirefox = () => {
|
|
|
2406
2456
|
const isFirefox$1 = getIsFirefox();
|
|
2407
2457
|
|
|
2408
2458
|
const getNodePath$1 = () => {
|
|
2459
|
+
// @ts-ignore
|
|
2409
2460
|
return invoke(/* Platform.getNodePath */'Platform.getNodePath');
|
|
2410
2461
|
};
|
|
2411
2462
|
|
|
@@ -2423,6 +2474,7 @@ const TestFrameWorkComponentPlatform = {
|
|
|
2423
2474
|
};
|
|
2424
2475
|
|
|
2425
2476
|
const show = async () => {
|
|
2477
|
+
// @ts-ignore
|
|
2426
2478
|
await invoke('Panel.selectIndex', 0);
|
|
2427
2479
|
};
|
|
2428
2480
|
|
|
@@ -2434,44 +2486,59 @@ const TestFrameWorkComponentProblems = {
|
|
|
2434
2486
|
const QuickPick = 'QuickPick';
|
|
2435
2487
|
|
|
2436
2488
|
const open$1 = async () => {
|
|
2489
|
+
// @ts-ignore
|
|
2437
2490
|
await invoke('Viewlet.openWidget', QuickPick, 'everything');
|
|
2438
2491
|
};
|
|
2439
2492
|
const handleInput$1 = async value => {
|
|
2493
|
+
// @ts-ignore
|
|
2440
2494
|
await invoke('QuickPick.handleInput', value, 0);
|
|
2441
2495
|
};
|
|
2442
2496
|
const handleClickAt = async (x, y) => {
|
|
2497
|
+
// @ts-ignore
|
|
2443
2498
|
await invoke('QuickPick.handleClickAt', x, y);
|
|
2444
2499
|
};
|
|
2445
2500
|
const setValue$1 = async value => {
|
|
2501
|
+
// @ts-ignore
|
|
2446
2502
|
await invoke('QuickPick.setValue', value);
|
|
2447
2503
|
};
|
|
2448
2504
|
const focusNext$2 = async () => {
|
|
2505
|
+
// @ts-ignore
|
|
2449
2506
|
await invoke('QuickPick.focusNext');
|
|
2450
2507
|
};
|
|
2451
2508
|
const focusFirst$2 = async () => {
|
|
2509
|
+
// @ts-ignore
|
|
2452
2510
|
await invoke('QuickPick.focusFirst');
|
|
2453
2511
|
};
|
|
2454
2512
|
const focusLast$1 = async () => {
|
|
2513
|
+
// @ts-ignore
|
|
2455
2514
|
await invoke('QuickPick.focusLast');
|
|
2456
2515
|
};
|
|
2457
2516
|
const focusIndex$2 = async index => {
|
|
2517
|
+
// @ts-ignore
|
|
2458
2518
|
await invoke('QuickPick.focusIndex', index);
|
|
2459
2519
|
};
|
|
2460
2520
|
const focusPrevious$2 = async () => {
|
|
2521
|
+
// @ts-ignore
|
|
2461
2522
|
await invoke('QuickPick.focusPrevious');
|
|
2462
2523
|
};
|
|
2463
2524
|
const selectItem = async label => {
|
|
2525
|
+
// @ts-ignore
|
|
2464
2526
|
await invoke('QuickPick.selectItem', label);
|
|
2465
2527
|
};
|
|
2466
2528
|
const selectIndex$2 = async index => {
|
|
2529
|
+
// @ts-ignore
|
|
2467
2530
|
await invoke('QuickPick.selectIndex', index);
|
|
2468
2531
|
};
|
|
2469
2532
|
const selectCurrentIndex = async () => {
|
|
2533
|
+
// @ts-ignore
|
|
2470
2534
|
await invoke('QuickPick.selectCurrentIndex');
|
|
2471
2535
|
};
|
|
2472
2536
|
const executeCommand = async label => {
|
|
2537
|
+
// @ts-ignore
|
|
2473
2538
|
await invoke('QuickPick.showCommands');
|
|
2539
|
+
// @ts-ignore
|
|
2474
2540
|
await invoke('QuickPick.handleInput', label, 0);
|
|
2541
|
+
// @ts-ignore
|
|
2475
2542
|
await invoke('QuickPick.selectItem', label);
|
|
2476
2543
|
};
|
|
2477
2544
|
|
|
@@ -2495,18 +2562,22 @@ const TestFrameWorkComponentQuickPick = {
|
|
|
2495
2562
|
const Script = 2;
|
|
2496
2563
|
|
|
2497
2564
|
const setValue = async value => {
|
|
2565
|
+
// @ts-ignore
|
|
2498
2566
|
await invoke('Search.handleInput', value, Script);
|
|
2499
2567
|
};
|
|
2500
2568
|
const setReplaceValue = async value => {
|
|
2569
|
+
// @ts-ignore
|
|
2501
2570
|
await invoke('Search.handleReplaceInput', value, Script);
|
|
2502
2571
|
};
|
|
2503
2572
|
const setExcludeValue = async value => {
|
|
2573
|
+
// @ts-ignore
|
|
2504
2574
|
await invoke('Search.handleExcludeInput', value, Script);
|
|
2505
2575
|
};
|
|
2506
2576
|
const replaceAll = async () => {
|
|
2507
2577
|
await invoke('Search.replaceAll');
|
|
2508
2578
|
};
|
|
2509
2579
|
const setIncludeValue = async value => {
|
|
2580
|
+
// @ts-ignore
|
|
2510
2581
|
await invoke('Search.handleIncludeInput', value, Script);
|
|
2511
2582
|
};
|
|
2512
2583
|
const clearSearchResults = async () => {
|
|
@@ -2537,6 +2608,7 @@ const handleWheel = async (deltaMode, deltaY) => {
|
|
|
2537
2608
|
await invoke('Search.handleWheel', deltaMode, deltaY);
|
|
2538
2609
|
};
|
|
2539
2610
|
const focusNextPage = async () => {
|
|
2611
|
+
// @ts-ignore
|
|
2540
2612
|
await invoke('Search.focusPage');
|
|
2541
2613
|
};
|
|
2542
2614
|
const focusPreviousPage = async () => {
|
|
@@ -2592,6 +2664,7 @@ const TestFrameWorkComponentSearch = {
|
|
|
2592
2664
|
};
|
|
2593
2665
|
|
|
2594
2666
|
const update$1 = settings => {
|
|
2667
|
+
// @ts-ignore
|
|
2595
2668
|
return invoke('Preferences.update', settings);
|
|
2596
2669
|
};
|
|
2597
2670
|
|
|
@@ -2614,6 +2687,7 @@ const TestFrameWorkComponentSideBar = {
|
|
|
2614
2687
|
};
|
|
2615
2688
|
|
|
2616
2689
|
const selectIndex = async index => {
|
|
2690
|
+
// @ts-ignore
|
|
2617
2691
|
await invoke('Source Control.selectIndex');
|
|
2618
2692
|
};
|
|
2619
2693
|
const acceptInput = async () => {
|
|
@@ -2653,6 +2727,7 @@ const focusFirst = async () => {
|
|
|
2653
2727
|
await invoke('TitleBarMenuBar.focusFirst');
|
|
2654
2728
|
};
|
|
2655
2729
|
const focusIndex = async index => {
|
|
2730
|
+
// @ts-ignore
|
|
2656
2731
|
await invoke('TitleBarMenuBar.focusIndex', index);
|
|
2657
2732
|
};
|
|
2658
2733
|
const focusLast = async () => {
|