@lvce-editor/test-worker 4.33.0 → 4.34.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 CHANGED
@@ -187,11 +187,14 @@ declare const focusFirst$4: () => Promise<void>;
187
187
  declare const focusNext$6: () => Promise<void>;
188
188
  declare const focusPrevious$4: () => Promise<void>;
189
189
  declare const focusLast$4: () => Promise<void>;
190
+ declare const show$1: () => Promise<void>;
191
+ declare const handleFilterInput: (text: string) => Promise<void>;
192
+ declare const selectChannel: (channelId: string) => Promise<void>;
190
193
  declare const open$2: (id: string) => Promise<void>;
191
194
  declare const getNodePath: () => Promise<string>;
192
195
  declare const isFirefox: () => boolean;
193
- declare const show$1: () => Promise<void>;
194
- declare const handleFilterInput: (text: string) => Promise<void>;
196
+ declare const show$2: () => Promise<void>;
197
+ declare const handleFilterInput$1: (text: string) => Promise<void>;
195
198
  declare const copyMessage: () => Promise<void>;
196
199
  declare const focusIndex$1: (index: number) => Promise<void>;
197
200
  declare const handleArrowLeft$1: () => Promise<void>;
@@ -245,7 +248,7 @@ declare const togglePreserveCase: () => Promise<void>;
245
248
  declare const toggleUseRegularExpression: () => Promise<void>;
246
249
  declare const toggleReplace: () => Promise<void>;
247
250
  declare const update: (settings: any) => Promise<void>;
248
- declare const show$2: () => Promise<void>;
251
+ declare const show$3: () => Promise<void>;
249
252
  declare const handleInput$2: (searchValue: string) => Promise<void>;
250
253
  declare const usePreviousSearchValue: () => Promise<void>;
251
254
  declare const useNextSearchValue: () => Promise<void>;
@@ -345,6 +348,9 @@ declare namespace KeyBoard {
345
348
  declare namespace Main {
346
349
  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
350
  }
351
+ declare namespace Output {
352
+ export { handleFilterInput, selectChannel, show$1 as show };
353
+ }
348
354
  declare namespace Panel {
349
355
  export { open$2 as open };
350
356
  }
@@ -352,7 +358,7 @@ declare namespace Platform {
352
358
  export { getNodePath, isFirefox };
353
359
  }
354
360
  declare namespace Problems {
355
- export { copyMessage, focusIndex$1 as focusIndex, handleArrowLeft$1 as handleArrowLeft, handleArrowRight, handleClickAt$1 as handleClickAt, handleFilterInput, handleIconThemeChange, show$1 as show, viewAsList, viewAsTable };
361
+ 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
362
  }
357
363
  declare namespace QuickPick {
358
364
  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 +373,7 @@ declare namespace Settings {
367
373
  export { update };
368
374
  }
369
375
  declare namespace SettingsView {
370
- export { clear, handleInput$2 as handleInput, handleScroll$1 as handleScroll, selectExtensions, selectTab$1 as selectTab, selectTextEditor, selectWorkspace, show$2 as show, useNextSearchValue, usePreviousSearchValue };
376
+ export { clear, handleInput$2 as handleInput, handleScroll$1 as handleScroll, selectExtensions, selectTab$1 as selectTab, selectTextEditor, selectWorkspace, show$3 as show, useNextSearchValue, usePreviousSearchValue };
371
377
  }
372
378
  declare namespace SideBar {
373
379
  export { hide, open$4 as open };
@@ -408,6 +414,7 @@ export interface TestApi {
408
414
  readonly KeyBindingsEditor: typeof KeyBindingsEditor,
409
415
  readonly KeyBoard: typeof KeyBoard,
410
416
  readonly Main: typeof Main,
417
+ readonly Output: typeof Output,
411
418
  readonly Panel: typeof Panel,
412
419
  readonly Platform: typeof Platform,
413
420
  readonly Problems: typeof Problems,
@@ -620,7 +620,8 @@ const splitLines = lines => {
620
620
  return lines.split(NewLine);
621
621
  };
622
622
  const getCurrentStack = () => {
623
- const currentStack = joinLines(splitLines(new Error().stack || '').slice(2));
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 Error(`command not found ${command}`);
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$d = async ({
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$d
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 getLocatorRpc = locator => {
1164
+ const getLocatorInvoke = locator => {
1165
1165
  if (locator.webViewId) {
1166
- return get(locator.webViewId);
1166
+ const module = get(locator.webViewId);
1167
+ return module.invoke;
1167
1168
  }
1168
- return Rpc;
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 rpc = getLocatorRpc(locator);
1507
- return rpc.invoke('TestFrameWork.performAction', locator, action, options);
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$2 = async () => {
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$2
1607
+ show: show$3
1609
1608
  };
1610
1609
 
1611
1610
  const focus$2 = async () => {
@@ -2574,6 +2573,26 @@ const TestFrameWorkComponentMain = {
2574
2573
  splitRight
2575
2574
  };
2576
2575
 
2576
+ const show$2 = async () => {
2577
+ // @ts-ignore
2578
+ await invoke('Panel.selectIndex', 1);
2579
+ };
2580
+ const handleFilterInput$1 = async text => {
2581
+ // @ts-ignore
2582
+ await invoke('Output.handleFilterInput', text);
2583
+ };
2584
+ const selectChannel = async channelId => {
2585
+ // @ts-ignore
2586
+ await invoke('Output.selectChannel', channelId);
2587
+ };
2588
+
2589
+ const TestFrameWorkComponentOutput = {
2590
+ __proto__: null,
2591
+ handleFilterInput: handleFilterInput$1,
2592
+ selectChannel,
2593
+ show: show$2
2594
+ };
2595
+
2577
2596
  const open$2 = async id => {
2578
2597
  await invoke('Layout.showPanel', id);
2579
2598
  };
@@ -3199,6 +3218,7 @@ const TestFrameWorkComponent = {
3199
3218
  KeyBindingsEditor: TestFrameWorkComponentKeyBindingsEditor,
3200
3219
  KeyBoard: TestFrameWorkComponentKeyBoard,
3201
3220
  Main: TestFrameWorkComponentMain,
3221
+ Output: TestFrameWorkComponentOutput,
3202
3222
  Panel: TestFrameWorkComponentPanel,
3203
3223
  Platform: TestFrameWorkComponentPlatform,
3204
3224
  Problems: TestFrameWorkComponentProblems,
@@ -3216,6 +3236,10 @@ const TestFrameWorkComponent = {
3216
3236
  Workspace: TestFrameWorkComponentWorkspace
3217
3237
  };
3218
3238
 
3239
+ // TODO move this into three steps:
3240
+ // 1. import test module
3241
+ // 2. execute test
3242
+ // 3. print out results
3219
3243
  const execute = async href => {
3220
3244
  const globals = {
3221
3245
  ...TestFrameWorkComponent,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/test-worker",
3
- "version": "4.33.0",
3
+ "version": "4.34.0",
4
4
  "description": "Test Worker",
5
5
  "repository": {
6
6
  "type": "git",