@lvce-editor/test-worker 4.33.0 → 4.35.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/api.d.ts +21 -6
- package/dist/testWorkerMain.js +88 -23
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -29,6 +29,9 @@ declare const openProcessExplorer: () => Promise<void>;
|
|
|
29
29
|
declare const reloadColorTheme: () => Promise<void>;
|
|
30
30
|
declare const reloadIconTheme: () => Promise<void>;
|
|
31
31
|
declare const toggleDeveloperTools: () => Promise<void>;
|
|
32
|
+
declare const showSaveFilePicker: () => Promise<void>;
|
|
33
|
+
declare const mockSaveFilePicker: (fn: () => string) => Promise<void>;
|
|
34
|
+
declare const executeMock: (id: number) => string;
|
|
32
35
|
declare const setCursor: (rowIndex: number, columnIndex: number) => Promise<void>;
|
|
33
36
|
declare const openCompletion: () => Promise<void>;
|
|
34
37
|
declare const closeCompletion: () => Promise<void>;
|
|
@@ -187,11 +190,15 @@ declare const focusFirst$4: () => Promise<void>;
|
|
|
187
190
|
declare const focusNext$6: () => Promise<void>;
|
|
188
191
|
declare const focusPrevious$4: () => Promise<void>;
|
|
189
192
|
declare const focusLast$4: () => Promise<void>;
|
|
193
|
+
declare const show$1: () => Promise<void>;
|
|
194
|
+
declare const handleFilterInput: (text: string) => Promise<void>;
|
|
195
|
+
declare const selectChannel: (channelId: string) => Promise<void>;
|
|
196
|
+
declare const clear: () => Promise<void>;
|
|
190
197
|
declare const open$2: (id: string) => Promise<void>;
|
|
191
198
|
declare const getNodePath: () => Promise<string>;
|
|
192
199
|
declare const isFirefox: () => boolean;
|
|
193
|
-
declare const show$
|
|
194
|
-
declare const handleFilterInput: (text: string) => Promise<void>;
|
|
200
|
+
declare const show$2: () => Promise<void>;
|
|
201
|
+
declare const handleFilterInput$1: (text: string) => Promise<void>;
|
|
195
202
|
declare const copyMessage: () => Promise<void>;
|
|
196
203
|
declare const focusIndex$1: (index: number) => Promise<void>;
|
|
197
204
|
declare const handleArrowLeft$1: () => Promise<void>;
|
|
@@ -245,11 +252,11 @@ declare const togglePreserveCase: () => Promise<void>;
|
|
|
245
252
|
declare const toggleUseRegularExpression: () => Promise<void>;
|
|
246
253
|
declare const toggleReplace: () => Promise<void>;
|
|
247
254
|
declare const update: (settings: any) => Promise<void>;
|
|
248
|
-
declare const show$
|
|
255
|
+
declare const show$3: () => Promise<void>;
|
|
249
256
|
declare const handleInput$2: (searchValue: string) => Promise<void>;
|
|
250
257
|
declare const usePreviousSearchValue: () => Promise<void>;
|
|
251
258
|
declare const useNextSearchValue: () => Promise<void>;
|
|
252
|
-
declare const clear: (searchValue: string) => Promise<void>;
|
|
259
|
+
declare const clear$1: (searchValue: string) => Promise<void>;
|
|
253
260
|
declare const selectTab$1: (tabId: string) => Promise<void>;
|
|
254
261
|
declare const selectWorkspace: () => Promise<void>;
|
|
255
262
|
declare const selectTextEditor: () => Promise<void>;
|
|
@@ -309,6 +316,9 @@ declare namespace ContextMenu {
|
|
|
309
316
|
declare namespace Developer {
|
|
310
317
|
export { openCacheFolder, openConfigFolder, openIframeInspector, openLogsFolder, openProcessExplorer, reloadColorTheme, reloadIconTheme, toggleDeveloperTools };
|
|
311
318
|
}
|
|
319
|
+
declare namespace Dialog {
|
|
320
|
+
export { executeMock, mockSaveFilePicker, showSaveFilePicker };
|
|
321
|
+
}
|
|
312
322
|
declare namespace Editor {
|
|
313
323
|
export { addAllMissingImports, closeColorPicker, closeCompletion, closeCompletionDetails, copy, copyLineDown, copyLineUp, cursorCharacterLeft, cursorCharacterRight, cursorDown, cursorEnd, cursorHome, cursorUp, cursorWordLeft, cursorWordPartLeft, cursorWordPartRight, cursorWordRight, deleteAllLeft, deleteAllRight, executeTabCompletion, findAllImplementations, findAllReferences, format, getText, goToDefinition, goToTypeDefinition, insertLineBreak, invokeBraceCompletion, invokeTabCompletion, openColorPicker, openCompletion, openCompletionDetails, openContextMenu, openEditorContextMenu, openFind, openFindWidget, openHover, openRename, openSourceActions, organizeImports, rename, selectAll, setCursor, setDeltaY, setSelections, shouldHaveText, showHover, sortImports, sourceActionsSelectCurrent, toggleBlockComment, toggleCompletionDetails, toggleLineComment, type };
|
|
314
324
|
}
|
|
@@ -345,6 +355,9 @@ declare namespace KeyBoard {
|
|
|
345
355
|
declare namespace Main {
|
|
346
356
|
export { closeActiveEditor, closeAllEditors, closeOthers, closeTabsLeft, closeTabsRight, focusFirst$4 as focusFirst, focusLast$4 as focusLast, focusNext$6 as focusNext, focusPrevious$4 as focusPrevious, openKeyBindings, openUri, splitRight };
|
|
347
357
|
}
|
|
358
|
+
declare namespace Output {
|
|
359
|
+
export { clear, handleFilterInput, selectChannel, show$1 as show };
|
|
360
|
+
}
|
|
348
361
|
declare namespace Panel {
|
|
349
362
|
export { open$2 as open };
|
|
350
363
|
}
|
|
@@ -352,7 +365,7 @@ declare namespace Platform {
|
|
|
352
365
|
export { getNodePath, isFirefox };
|
|
353
366
|
}
|
|
354
367
|
declare namespace Problems {
|
|
355
|
-
export { copyMessage, focusIndex$1 as focusIndex, handleArrowLeft$1 as handleArrowLeft, handleArrowRight, handleClickAt$1 as handleClickAt, handleFilterInput, handleIconThemeChange, show$
|
|
368
|
+
export { copyMessage, focusIndex$1 as focusIndex, handleArrowLeft$1 as handleArrowLeft, handleArrowRight, handleClickAt$1 as handleClickAt, handleFilterInput$1 as handleFilterInput, handleIconThemeChange, show$2 as show, viewAsList, viewAsTable };
|
|
356
369
|
}
|
|
357
370
|
declare namespace QuickPick {
|
|
358
371
|
export { executeCommand, focusFirst$5 as focusFirst, focusIndex$2 as focusIndex, focusLast$5 as focusLast, focusNext$7 as focusNext, focusPrevious$5 as focusPrevious, handleClickAt$2 as handleClickAt, handleInput$1 as handleInput, open$3 as open, selectCurrentIndex$1 as selectCurrentIndex, selectIndex$2 as selectIndex, selectItem$1 as selectItem, setValue$1 as setValue };
|
|
@@ -367,7 +380,7 @@ declare namespace Settings {
|
|
|
367
380
|
export { update };
|
|
368
381
|
}
|
|
369
382
|
declare namespace SettingsView {
|
|
370
|
-
export { clear, handleInput$2 as handleInput, handleScroll$1 as handleScroll, selectExtensions, selectTab$1 as selectTab, selectTextEditor, selectWorkspace, show$
|
|
383
|
+
export { clear$1 as clear, handleInput$2 as handleInput, handleScroll$1 as handleScroll, selectExtensions, selectTab$1 as selectTab, selectTextEditor, selectWorkspace, show$3 as show, useNextSearchValue, usePreviousSearchValue };
|
|
371
384
|
}
|
|
372
385
|
declare namespace SideBar {
|
|
373
386
|
export { hide, open$4 as open };
|
|
@@ -396,6 +409,7 @@ export interface TestApi {
|
|
|
396
409
|
readonly Command: typeof Command,
|
|
397
410
|
readonly ContextMenu: typeof ContextMenu,
|
|
398
411
|
readonly Developer: typeof Developer,
|
|
412
|
+
readonly Dialog: typeof Dialog,
|
|
399
413
|
readonly Editor: typeof Editor,
|
|
400
414
|
readonly EditorCompletion: typeof EditorCompletion,
|
|
401
415
|
readonly Explorer: typeof Explorer,
|
|
@@ -408,6 +422,7 @@ export interface TestApi {
|
|
|
408
422
|
readonly KeyBindingsEditor: typeof KeyBindingsEditor,
|
|
409
423
|
readonly KeyBoard: typeof KeyBoard,
|
|
410
424
|
readonly Main: typeof Main,
|
|
425
|
+
readonly Output: typeof Output,
|
|
411
426
|
readonly Panel: typeof Panel,
|
|
412
427
|
readonly Platform: typeof Platform,
|
|
413
428
|
readonly Problems: typeof Problems,
|
package/dist/testWorkerMain.js
CHANGED
|
@@ -620,7 +620,8 @@ const splitLines = lines => {
|
|
|
620
620
|
return lines.split(NewLine);
|
|
621
621
|
};
|
|
622
622
|
const getCurrentStack = () => {
|
|
623
|
-
const
|
|
623
|
+
const stackLinesToSkip = 3;
|
|
624
|
+
const currentStack = joinLines(splitLines(new Error().stack || '').slice(stackLinesToSkip));
|
|
624
625
|
return currentStack;
|
|
625
626
|
};
|
|
626
627
|
const getNewLineIndex = (string, startIndex = undefined) => {
|
|
@@ -891,6 +892,12 @@ const invokeAndTransfer$1 = (ipc, method, ...params) => {
|
|
|
891
892
|
return invokeHelper(ipc, method, params, true);
|
|
892
893
|
};
|
|
893
894
|
|
|
895
|
+
class CommandNotFoundError extends Error {
|
|
896
|
+
constructor(command) {
|
|
897
|
+
super(`Command not found ${command}`);
|
|
898
|
+
this.name = 'CommandNotFoundError';
|
|
899
|
+
}
|
|
900
|
+
}
|
|
894
901
|
const commands = Object.create(null);
|
|
895
902
|
const register = commandMap => {
|
|
896
903
|
Object.assign(commands, commandMap);
|
|
@@ -901,7 +908,7 @@ const getCommand = key => {
|
|
|
901
908
|
const execute$2 = (command, ...args) => {
|
|
902
909
|
const fn = getCommand(command);
|
|
903
910
|
if (!fn) {
|
|
904
|
-
throw new
|
|
911
|
+
throw new CommandNotFoundError(command);
|
|
905
912
|
}
|
|
906
913
|
return fn(...args);
|
|
907
914
|
};
|
|
@@ -958,7 +965,7 @@ const listen$1 = async (module, options) => {
|
|
|
958
965
|
const ipc = module.wrap(rawIpc);
|
|
959
966
|
return ipc;
|
|
960
967
|
};
|
|
961
|
-
const create$
|
|
968
|
+
const create$e = async ({
|
|
962
969
|
commandMap,
|
|
963
970
|
messagePort,
|
|
964
971
|
isMessagePortOpen
|
|
@@ -976,7 +983,7 @@ const create$d = async ({
|
|
|
976
983
|
};
|
|
977
984
|
const MessagePortRpcParent = {
|
|
978
985
|
__proto__: null,
|
|
979
|
-
create: create$
|
|
986
|
+
create: create$e
|
|
980
987
|
};
|
|
981
988
|
const create$2 = async ({
|
|
982
989
|
commandMap
|
|
@@ -1060,13 +1067,6 @@ const {
|
|
|
1060
1067
|
invokeAndTransfer
|
|
1061
1068
|
} = RendererWorker;
|
|
1062
1069
|
|
|
1063
|
-
const Rpc = {
|
|
1064
|
-
__proto__: null,
|
|
1065
|
-
invoke,
|
|
1066
|
-
invokeAndTransfer,
|
|
1067
|
-
set: set$1
|
|
1068
|
-
};
|
|
1069
|
-
|
|
1070
1070
|
const stringifyError = error => {
|
|
1071
1071
|
if (!error) {
|
|
1072
1072
|
return `${error}`;
|
|
@@ -1161,19 +1161,18 @@ const get = id => {
|
|
|
1161
1161
|
return webViews[id];
|
|
1162
1162
|
};
|
|
1163
1163
|
|
|
1164
|
-
const
|
|
1164
|
+
const getLocatorInvoke = locator => {
|
|
1165
1165
|
if (locator.webViewId) {
|
|
1166
|
-
|
|
1166
|
+
const module = get(locator.webViewId);
|
|
1167
|
+
return module.invoke;
|
|
1167
1168
|
}
|
|
1168
|
-
return
|
|
1169
|
+
return invoke;
|
|
1169
1170
|
};
|
|
1170
1171
|
|
|
1171
1172
|
const locatorInvoke = (locator, method, ...params) => {
|
|
1172
1173
|
object(locator);
|
|
1173
1174
|
string$1(method);
|
|
1174
|
-
const
|
|
1175
|
-
invoke
|
|
1176
|
-
} = getLocatorRpc(locator);
|
|
1175
|
+
const invoke = getLocatorInvoke(locator);
|
|
1177
1176
|
return invoke(method, ...params);
|
|
1178
1177
|
};
|
|
1179
1178
|
|
|
@@ -1503,8 +1502,8 @@ const Locator = function (selector, {
|
|
|
1503
1502
|
this._hasText = hasText;
|
|
1504
1503
|
};
|
|
1505
1504
|
const performAction = async (locator, action, options) => {
|
|
1506
|
-
const
|
|
1507
|
-
return
|
|
1505
|
+
const invoke = getLocatorInvoke(locator);
|
|
1506
|
+
return invoke('TestFrameWork.performAction', locator, action, options);
|
|
1508
1507
|
};
|
|
1509
1508
|
Locator.prototype.click = async function ({
|
|
1510
1509
|
button = 'left'
|
|
@@ -1579,7 +1578,7 @@ const TestFrameWork = {
|
|
|
1579
1578
|
test
|
|
1580
1579
|
};
|
|
1581
1580
|
|
|
1582
|
-
const show$
|
|
1581
|
+
const show$3 = async () => {
|
|
1583
1582
|
return invoke('About.showAbout');
|
|
1584
1583
|
};
|
|
1585
1584
|
const handleClickOk = async () => {
|
|
@@ -1605,7 +1604,7 @@ const TestFrameWorkComponentAbout = {
|
|
|
1605
1604
|
handleClickClose,
|
|
1606
1605
|
handleClickCopy,
|
|
1607
1606
|
handleClickOk,
|
|
1608
|
-
show: show$
|
|
1607
|
+
show: show$3
|
|
1609
1608
|
};
|
|
1610
1609
|
|
|
1611
1610
|
const focus$2 = async () => {
|
|
@@ -1777,6 +1776,41 @@ const TestFrameWorkComponentDeveloper = {
|
|
|
1777
1776
|
toggleDeveloperTools
|
|
1778
1777
|
};
|
|
1779
1778
|
|
|
1779
|
+
const createId = () => {
|
|
1780
|
+
return Math.random();
|
|
1781
|
+
};
|
|
1782
|
+
|
|
1783
|
+
const mocks = Object.create(null);
|
|
1784
|
+
const registerMock = fn => {
|
|
1785
|
+
const id = createId();
|
|
1786
|
+
mocks[id] = fn;
|
|
1787
|
+
return id;
|
|
1788
|
+
};
|
|
1789
|
+
const executeMock$1 = id => {
|
|
1790
|
+
const fn = mocks[id];
|
|
1791
|
+
return fn();
|
|
1792
|
+
};
|
|
1793
|
+
|
|
1794
|
+
const showSaveFilePicker = async () => {
|
|
1795
|
+
// @ts-ignore
|
|
1796
|
+
await invoke('FilePicker.showSaveFilePicker');
|
|
1797
|
+
};
|
|
1798
|
+
const mockSaveFilePicker = async fn => {
|
|
1799
|
+
const id = registerMock(fn);
|
|
1800
|
+
// @ts-ignore
|
|
1801
|
+
await invoke('FilePicker.mockSaveFilePicker', id);
|
|
1802
|
+
};
|
|
1803
|
+
const executeMock = id => {
|
|
1804
|
+
return executeMock$1(id);
|
|
1805
|
+
};
|
|
1806
|
+
|
|
1807
|
+
const TestFrameWorkComponentDialog = {
|
|
1808
|
+
__proto__: null,
|
|
1809
|
+
executeMock,
|
|
1810
|
+
mockSaveFilePicker,
|
|
1811
|
+
showSaveFilePicker
|
|
1812
|
+
};
|
|
1813
|
+
|
|
1780
1814
|
const setCursor = async (rowIndex, columnIndex) => {
|
|
1781
1815
|
await invoke('Editor.cursorSet', rowIndex, columnIndex);
|
|
1782
1816
|
};
|
|
@@ -2574,6 +2608,33 @@ const TestFrameWorkComponentMain = {
|
|
|
2574
2608
|
splitRight
|
|
2575
2609
|
};
|
|
2576
2610
|
|
|
2611
|
+
const Script = 2;
|
|
2612
|
+
|
|
2613
|
+
const show$2 = async () => {
|
|
2614
|
+
// @ts-ignore
|
|
2615
|
+
await invoke('Panel.selectIndex', 1);
|
|
2616
|
+
};
|
|
2617
|
+
const handleFilterInput$1 = async text => {
|
|
2618
|
+
// @ts-ignore
|
|
2619
|
+
await invoke('Output.handleFilterInput', text, Script);
|
|
2620
|
+
};
|
|
2621
|
+
const selectChannel = async channelId => {
|
|
2622
|
+
// @ts-ignore
|
|
2623
|
+
await invoke('Output.selectChannel', channelId);
|
|
2624
|
+
};
|
|
2625
|
+
const clear$1 = async () => {
|
|
2626
|
+
// @ts-ignore
|
|
2627
|
+
await invoke('Output.clear');
|
|
2628
|
+
};
|
|
2629
|
+
|
|
2630
|
+
const TestFrameWorkComponentOutput = {
|
|
2631
|
+
__proto__: null,
|
|
2632
|
+
clear: clear$1,
|
|
2633
|
+
handleFilterInput: handleFilterInput$1,
|
|
2634
|
+
selectChannel,
|
|
2635
|
+
show: show$2
|
|
2636
|
+
};
|
|
2637
|
+
|
|
2577
2638
|
const open$2 = async id => {
|
|
2578
2639
|
await invoke('Layout.showPanel', id);
|
|
2579
2640
|
};
|
|
@@ -2795,8 +2856,6 @@ const TestFrameWorkComponentRunAndDebug = {
|
|
|
2795
2856
|
setPauseOnExceptions
|
|
2796
2857
|
};
|
|
2797
2858
|
|
|
2798
|
-
const Script = 2;
|
|
2799
|
-
|
|
2800
2859
|
const setValue = async value => {
|
|
2801
2860
|
// @ts-ignore
|
|
2802
2861
|
await invoke('Search.handleInput', value, Script);
|
|
@@ -3187,6 +3246,7 @@ const TestFrameWorkComponent = {
|
|
|
3187
3246
|
Command: TestFrameWorkComponentCommand,
|
|
3188
3247
|
ContextMenu: TestFrameWorkComponentContextMenu,
|
|
3189
3248
|
Developer: TestFrameWorkComponentDeveloper,
|
|
3249
|
+
Dialog: TestFrameWorkComponentDialog,
|
|
3190
3250
|
Editor: TestFrameWorkComponentEditor,
|
|
3191
3251
|
EditorCompletion: TestFrameWorkComponentEditorCompletion,
|
|
3192
3252
|
Explorer: TestFrameWorkComponentExplorer,
|
|
@@ -3199,6 +3259,7 @@ const TestFrameWorkComponent = {
|
|
|
3199
3259
|
KeyBindingsEditor: TestFrameWorkComponentKeyBindingsEditor,
|
|
3200
3260
|
KeyBoard: TestFrameWorkComponentKeyBoard,
|
|
3201
3261
|
Main: TestFrameWorkComponentMain,
|
|
3262
|
+
Output: TestFrameWorkComponentOutput,
|
|
3202
3263
|
Panel: TestFrameWorkComponentPanel,
|
|
3203
3264
|
Platform: TestFrameWorkComponentPlatform,
|
|
3204
3265
|
Problems: TestFrameWorkComponentProblems,
|
|
@@ -3216,6 +3277,10 @@ const TestFrameWorkComponent = {
|
|
|
3216
3277
|
Workspace: TestFrameWorkComponentWorkspace
|
|
3217
3278
|
};
|
|
3218
3279
|
|
|
3280
|
+
// TODO move this into three steps:
|
|
3281
|
+
// 1. import test module
|
|
3282
|
+
// 2. execute test
|
|
3283
|
+
// 3. print out results
|
|
3219
3284
|
const execute = async href => {
|
|
3220
3285
|
const globals = {
|
|
3221
3286
|
...TestFrameWorkComponent,
|