@lvce-editor/test-worker 6.6.0 → 6.7.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 +1 -1
- package/dist/testWorkerMain.js +199 -206
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -275,7 +275,7 @@ interface FileSystem {
|
|
|
275
275
|
readonly createExecutable: (content: string) => Promise<string>;
|
|
276
276
|
readonly createExecutableFrom: (uri: string) => Promise<string>;
|
|
277
277
|
readonly getTmpDir: ({ scheme }?: FileSystemTmpDirOptions) => Promise<string>;
|
|
278
|
-
readonly loadFixture: (
|
|
278
|
+
readonly loadFixture: (url: string) => Promise<string>;
|
|
279
279
|
readonly mkdir: (uri: string) => Promise<void>;
|
|
280
280
|
readonly readFile: (uri: string) => Promise<string>;
|
|
281
281
|
readonly remove: (uri: string) => Promise<void>;
|
package/dist/testWorkerMain.js
CHANGED
|
@@ -1109,109 +1109,6 @@ const createLazyRpc = rpcId => {
|
|
|
1109
1109
|
};
|
|
1110
1110
|
};
|
|
1111
1111
|
|
|
1112
|
-
const callFunction = async (fn, args) => {
|
|
1113
|
-
try {
|
|
1114
|
-
await fn(args);
|
|
1115
|
-
return undefined;
|
|
1116
|
-
} catch (error) {
|
|
1117
|
-
return error;
|
|
1118
|
-
}
|
|
1119
|
-
};
|
|
1120
|
-
|
|
1121
|
-
const formatDuration = duration => {
|
|
1122
|
-
return duration.toFixed(2) + 'ms';
|
|
1123
|
-
};
|
|
1124
|
-
|
|
1125
|
-
const Fail = 'fail';
|
|
1126
|
-
const Pass = 'pass';
|
|
1127
|
-
|
|
1128
|
-
const executeTest2 = async (name, fn, globals, timestampGenerator) => {
|
|
1129
|
-
const getTimestamp = timestampGenerator;
|
|
1130
|
-
const start = getTimestamp();
|
|
1131
|
-
const error = await callFunction(fn, globals);
|
|
1132
|
-
const end = getTimestamp();
|
|
1133
|
-
const duration = end - start;
|
|
1134
|
-
const formattedDuration = formatDuration(duration);
|
|
1135
|
-
if (error) {
|
|
1136
|
-
return {
|
|
1137
|
-
error,
|
|
1138
|
-
start,
|
|
1139
|
-
end,
|
|
1140
|
-
duration,
|
|
1141
|
-
formattedDuration,
|
|
1142
|
-
name,
|
|
1143
|
-
type: Fail,
|
|
1144
|
-
background: 'red',
|
|
1145
|
-
text: `test failed: ${error}`
|
|
1146
|
-
};
|
|
1147
|
-
}
|
|
1148
|
-
return {
|
|
1149
|
-
error: undefined,
|
|
1150
|
-
start,
|
|
1151
|
-
end,
|
|
1152
|
-
duration,
|
|
1153
|
-
formattedDuration,
|
|
1154
|
-
name,
|
|
1155
|
-
type: Pass,
|
|
1156
|
-
background: 'green',
|
|
1157
|
-
text: `test passed in ${formattedDuration}`
|
|
1158
|
-
};
|
|
1159
|
-
};
|
|
1160
|
-
|
|
1161
|
-
const printError = error => {
|
|
1162
|
-
if (error && error.constructor.name === 'AssertionError') {
|
|
1163
|
-
console.error(error.message);
|
|
1164
|
-
} else {
|
|
1165
|
-
console.error(error);
|
|
1166
|
-
}
|
|
1167
|
-
};
|
|
1168
|
-
|
|
1169
|
-
const printTestError = async error => {
|
|
1170
|
-
// TODO ask error worker to add codeframe
|
|
1171
|
-
printError(error);
|
|
1172
|
-
};
|
|
1173
|
-
|
|
1174
|
-
const now = () => {
|
|
1175
|
-
return performance.now();
|
|
1176
|
-
};
|
|
1177
|
-
|
|
1178
|
-
const executeTest = async (name, fn, globals = {}) => {
|
|
1179
|
-
const {
|
|
1180
|
-
error,
|
|
1181
|
-
formattedDuration,
|
|
1182
|
-
background,
|
|
1183
|
-
text,
|
|
1184
|
-
type
|
|
1185
|
-
} = await executeTest2(name, fn, globals, now);
|
|
1186
|
-
if (error) {
|
|
1187
|
-
await printTestError(error);
|
|
1188
|
-
} else {
|
|
1189
|
-
// eslint-disable-next-line no-console
|
|
1190
|
-
console.info(`PASS ${name} in ${formattedDuration}`);
|
|
1191
|
-
}
|
|
1192
|
-
// @ts-ignore
|
|
1193
|
-
await invoke$1('TestFrameWork.showOverlay', type, background, text);
|
|
1194
|
-
};
|
|
1195
|
-
|
|
1196
|
-
const importScript = async url => {
|
|
1197
|
-
try {
|
|
1198
|
-
return await import(url);
|
|
1199
|
-
} catch (error) {
|
|
1200
|
-
throw error;
|
|
1201
|
-
// TODO
|
|
1202
|
-
// const actualErrorMessage = await TryToGetactualImportErrorMessage.tryToGetActualImportErrorMessage(url, error)
|
|
1203
|
-
// throw new Error(actualErrorMessage)
|
|
1204
|
-
}
|
|
1205
|
-
};
|
|
1206
|
-
|
|
1207
|
-
const importTest = async url => {
|
|
1208
|
-
try {
|
|
1209
|
-
return await importScript(url);
|
|
1210
|
-
} catch (error) {
|
|
1211
|
-
throw new VError(error, 'Failed to import test');
|
|
1212
|
-
}
|
|
1213
|
-
};
|
|
1214
|
-
|
|
1215
1112
|
class AssertionError extends Error {
|
|
1216
1113
|
constructor(message) {
|
|
1217
1114
|
super(message);
|
|
@@ -1656,14 +1553,6 @@ const {
|
|
|
1656
1553
|
expect
|
|
1657
1554
|
} = Expect$1;
|
|
1658
1555
|
|
|
1659
|
-
const TestFrameWork = {
|
|
1660
|
-
__proto__: null,
|
|
1661
|
-
Locator: create,
|
|
1662
|
-
expect,
|
|
1663
|
-
getTmpDir: getTmpDir$1,
|
|
1664
|
-
test
|
|
1665
|
-
};
|
|
1666
|
-
|
|
1667
1556
|
const show$4 = async () => {
|
|
1668
1557
|
return invoke$1('About.showAbout');
|
|
1669
1558
|
};
|
|
@@ -1683,7 +1572,7 @@ const focusPrevious$8 = async () => {
|
|
|
1683
1572
|
return invoke$1('About.focusPrevious');
|
|
1684
1573
|
};
|
|
1685
1574
|
|
|
1686
|
-
const
|
|
1575
|
+
const About = {
|
|
1687
1576
|
__proto__: null,
|
|
1688
1577
|
focusNext: focusNext$9,
|
|
1689
1578
|
focusPrevious: focusPrevious$8,
|
|
@@ -1718,7 +1607,7 @@ const selectCurrent = async () => {
|
|
|
1718
1607
|
await invoke$1('ActivityBar.selectCurrent');
|
|
1719
1608
|
};
|
|
1720
1609
|
|
|
1721
|
-
const
|
|
1610
|
+
const ActivityBar = {
|
|
1722
1611
|
__proto__: null,
|
|
1723
1612
|
focus: focus$2,
|
|
1724
1613
|
focusFirst: focusFirst$7,
|
|
@@ -1770,7 +1659,7 @@ const getBaseUrl = () => {
|
|
|
1770
1659
|
return `${location.origin}/${assetDir}`;
|
|
1771
1660
|
};
|
|
1772
1661
|
|
|
1773
|
-
const
|
|
1662
|
+
const BaseUrl = {
|
|
1774
1663
|
__proto__: null,
|
|
1775
1664
|
getBaseUrl
|
|
1776
1665
|
};
|
|
@@ -1804,7 +1693,7 @@ const shouldHaveText$1 = async expectedText => {
|
|
|
1804
1693
|
}
|
|
1805
1694
|
};
|
|
1806
1695
|
|
|
1807
|
-
const
|
|
1696
|
+
const ClipBoard = {
|
|
1808
1697
|
__proto__: null,
|
|
1809
1698
|
disableMemoryClipBoard,
|
|
1810
1699
|
enableMemoryClipBoard,
|
|
@@ -1818,7 +1707,7 @@ const execute$1 = async (id, ...args) => {
|
|
|
1818
1707
|
return invoke$1(id, ...args);
|
|
1819
1708
|
};
|
|
1820
1709
|
|
|
1821
|
-
const
|
|
1710
|
+
const Command = {
|
|
1822
1711
|
__proto__: null,
|
|
1823
1712
|
execute: execute$1
|
|
1824
1713
|
};
|
|
@@ -1827,7 +1716,7 @@ const selectItem$1 = async text => {
|
|
|
1827
1716
|
await invoke$1('Menu.selectItem', text);
|
|
1828
1717
|
};
|
|
1829
1718
|
|
|
1830
|
-
const
|
|
1719
|
+
const ContextMenu = {
|
|
1831
1720
|
__proto__: null,
|
|
1832
1721
|
selectItem: selectItem$1
|
|
1833
1722
|
};
|
|
@@ -1865,7 +1754,7 @@ const toggleDeveloperTools = async () => {
|
|
|
1865
1754
|
return invoke$1('Developer.toggleDeveloperTools');
|
|
1866
1755
|
};
|
|
1867
1756
|
|
|
1868
|
-
const
|
|
1757
|
+
const Developer = {
|
|
1869
1758
|
__proto__: null,
|
|
1870
1759
|
openCacheFolder,
|
|
1871
1760
|
openConfigFolder,
|
|
@@ -1910,7 +1799,7 @@ const executeMock = (id, ...args) => {
|
|
|
1910
1799
|
return executeMock$1(id, ...args);
|
|
1911
1800
|
};
|
|
1912
1801
|
|
|
1913
|
-
const
|
|
1802
|
+
const Dialog = {
|
|
1914
1803
|
__proto__: null,
|
|
1915
1804
|
executeMock,
|
|
1916
1805
|
mockConfirm,
|
|
@@ -2152,7 +2041,7 @@ const redo = async () => {
|
|
|
2152
2041
|
await invoke('Editor.redo');
|
|
2153
2042
|
};
|
|
2154
2043
|
|
|
2155
|
-
const
|
|
2044
|
+
const Editor = {
|
|
2156
2045
|
__proto__: null,
|
|
2157
2046
|
addAllMissingImports,
|
|
2158
2047
|
closeColorPicker,
|
|
@@ -2230,7 +2119,7 @@ const handleWheel$2 = async (deltaMode, deltaY) => {
|
|
|
2230
2119
|
await invoke$1('EditorCompletion.handleWheel', deltaMode, deltaY);
|
|
2231
2120
|
};
|
|
2232
2121
|
|
|
2233
|
-
const
|
|
2122
|
+
const EditorCompletion = {
|
|
2234
2123
|
__proto__: null,
|
|
2235
2124
|
close: close$2,
|
|
2236
2125
|
handleWheel: handleWheel$2,
|
|
@@ -2246,7 +2135,7 @@ const close$1 = async () => {
|
|
|
2246
2135
|
await invoke$1('EditorHover.close');
|
|
2247
2136
|
};
|
|
2248
2137
|
|
|
2249
|
-
const
|
|
2138
|
+
const EditorHover = {
|
|
2250
2139
|
__proto__: null,
|
|
2251
2140
|
close: close$1,
|
|
2252
2141
|
show: show$3
|
|
@@ -2265,7 +2154,7 @@ const cancel = async () => {
|
|
|
2265
2154
|
await invoke$1('EditorRename.cancel');
|
|
2266
2155
|
};
|
|
2267
2156
|
|
|
2268
|
-
const
|
|
2157
|
+
const EditorRename = {
|
|
2269
2158
|
__proto__: null,
|
|
2270
2159
|
accept,
|
|
2271
2160
|
cancel,
|
|
@@ -2281,7 +2170,7 @@ const selectCurrentIndex$1 = async () => {
|
|
|
2281
2170
|
await invoke$1('EditorSourceAction.selectCurrentIndex');
|
|
2282
2171
|
};
|
|
2283
2172
|
|
|
2284
|
-
const
|
|
2173
|
+
const EditorSourceAction = {
|
|
2285
2174
|
__proto__: null,
|
|
2286
2175
|
selectCurrentIndex: selectCurrentIndex$1,
|
|
2287
2176
|
selectIndex: selectIndex$5
|
|
@@ -2407,7 +2296,7 @@ const toggleIndividualSelection = async index => {
|
|
|
2407
2296
|
await invoke$1('Explorer.toggleIndividualSelection', index);
|
|
2408
2297
|
};
|
|
2409
2298
|
|
|
2410
|
-
const
|
|
2299
|
+
const Explorer = {
|
|
2411
2300
|
__proto__: null,
|
|
2412
2301
|
acceptEdit,
|
|
2413
2302
|
cancelEdit,
|
|
@@ -2458,7 +2347,7 @@ const addNodeExtension = async relativePath => {
|
|
|
2458
2347
|
await invoke$1('ExtensionMeta.addNodeExtension', absolutePath);
|
|
2459
2348
|
};
|
|
2460
2349
|
|
|
2461
|
-
const
|
|
2350
|
+
const Extension = {
|
|
2462
2351
|
__proto__: null,
|
|
2463
2352
|
addNodeExtension,
|
|
2464
2353
|
addWebExtension
|
|
@@ -2526,7 +2415,7 @@ const handleScroll$1 = async scrollTop => {
|
|
|
2526
2415
|
return invoke$1('ExtensionDetail.handleScroll', scrollTop);
|
|
2527
2416
|
};
|
|
2528
2417
|
|
|
2529
|
-
const
|
|
2418
|
+
const ExtensionDetail = {
|
|
2530
2419
|
__proto__: null,
|
|
2531
2420
|
handleClickCategory,
|
|
2532
2421
|
handleClickDisable,
|
|
@@ -2689,7 +2578,7 @@ const loadFixture = async (platform, url) => {
|
|
|
2689
2578
|
return toFileUrl(url);
|
|
2690
2579
|
};
|
|
2691
2580
|
|
|
2692
|
-
const
|
|
2581
|
+
const FileSystem = {
|
|
2693
2582
|
__proto__: null,
|
|
2694
2583
|
chmod,
|
|
2695
2584
|
createDroppedFileHandle,
|
|
@@ -2764,7 +2653,7 @@ const focusPreviousElement = async () => {
|
|
|
2764
2653
|
await invoke$1('FindWidget.focusPreviousElement');
|
|
2765
2654
|
};
|
|
2766
2655
|
|
|
2767
|
-
const
|
|
2656
|
+
const FindWidget = {
|
|
2768
2657
|
__proto__: null,
|
|
2769
2658
|
close,
|
|
2770
2659
|
focusElement,
|
|
@@ -2787,7 +2676,7 @@ const setIconTheme = async id => {
|
|
|
2787
2676
|
await invoke$1('IconTheme.setIconTheme', id);
|
|
2788
2677
|
};
|
|
2789
2678
|
|
|
2790
|
-
const
|
|
2679
|
+
const IconTheme = {
|
|
2791
2680
|
__proto__: null,
|
|
2792
2681
|
setIconTheme
|
|
2793
2682
|
};
|
|
@@ -2808,7 +2697,7 @@ const focusLast$4 = async () => {
|
|
|
2808
2697
|
return invoke$1('IframeInspector.focusLast');
|
|
2809
2698
|
};
|
|
2810
2699
|
|
|
2811
|
-
const
|
|
2700
|
+
const IframeInspector = {
|
|
2812
2701
|
__proto__: null,
|
|
2813
2702
|
focusFirst: focusFirst$5,
|
|
2814
2703
|
focusLast: focusLast$4,
|
|
@@ -2888,7 +2777,7 @@ const resetKeyBinding = () => {
|
|
|
2888
2777
|
return invoke$1('KeyBindings.resetKeyBinding');
|
|
2889
2778
|
};
|
|
2890
2779
|
|
|
2891
|
-
const
|
|
2780
|
+
const KeyBindingsEditor = {
|
|
2892
2781
|
__proto__: null,
|
|
2893
2782
|
addKeyBinding,
|
|
2894
2783
|
changeWhenExpression,
|
|
@@ -2965,7 +2854,7 @@ const press = async key => {
|
|
|
2965
2854
|
await invoke$1('TestFrameWork.performKeyBoardAction', 'press', options);
|
|
2966
2855
|
};
|
|
2967
2856
|
|
|
2968
|
-
const
|
|
2857
|
+
const KeyBoard = {
|
|
2969
2858
|
__proto__: null,
|
|
2970
2859
|
press
|
|
2971
2860
|
};
|
|
@@ -3007,7 +2896,7 @@ const focusLast$2 = async () => {
|
|
|
3007
2896
|
await invoke$1('Main.focusLast');
|
|
3008
2897
|
};
|
|
3009
2898
|
|
|
3010
|
-
const
|
|
2899
|
+
const Main = {
|
|
3011
2900
|
__proto__: null,
|
|
3012
2901
|
closeActiveEditor,
|
|
3013
2902
|
closeAllEditors,
|
|
@@ -3040,7 +2929,7 @@ const clear$2 = async () => {
|
|
|
3040
2929
|
await invoke$1('Output.clear');
|
|
3041
2930
|
};
|
|
3042
2931
|
|
|
3043
|
-
const
|
|
2932
|
+
const Output = {
|
|
3044
2933
|
__proto__: null,
|
|
3045
2934
|
clear: clear$2,
|
|
3046
2935
|
handleFilterInput: handleFilterInput$1,
|
|
@@ -3057,7 +2946,7 @@ const openProblems = async () => {
|
|
|
3057
2946
|
await invoke$1('Panel.selectIndex', 0);
|
|
3058
2947
|
};
|
|
3059
2948
|
|
|
3060
|
-
const
|
|
2949
|
+
const Panel = {
|
|
3061
2950
|
__proto__: null,
|
|
3062
2951
|
open: open$3,
|
|
3063
2952
|
openProblems
|
|
@@ -3088,7 +2977,7 @@ const isFirefox = () => {
|
|
|
3088
2977
|
return getIsFirefox();
|
|
3089
2978
|
};
|
|
3090
2979
|
|
|
3091
|
-
const
|
|
2980
|
+
const Platform = {
|
|
3092
2981
|
__proto__: null,
|
|
3093
2982
|
getNodePath,
|
|
3094
2983
|
isFirefox
|
|
@@ -3135,7 +3024,7 @@ const viewAsTable = async () => {
|
|
|
3135
3024
|
await invoke$1('Problems.viewAsTable');
|
|
3136
3025
|
};
|
|
3137
3026
|
|
|
3138
|
-
const
|
|
3027
|
+
const Problems = {
|
|
3139
3028
|
__proto__: null,
|
|
3140
3029
|
copyMessage,
|
|
3141
3030
|
focusIndex: focusIndex$3,
|
|
@@ -3149,11 +3038,11 @@ const TestFrameWorkComponentProblems = {
|
|
|
3149
3038
|
viewAsTable
|
|
3150
3039
|
};
|
|
3151
3040
|
|
|
3152
|
-
const QuickPick = 'QuickPick';
|
|
3041
|
+
const QuickPick$1 = 'QuickPick';
|
|
3153
3042
|
|
|
3154
3043
|
const open$2 = async () => {
|
|
3155
3044
|
// @ts-ignore
|
|
3156
|
-
await invoke$1('Viewlet.openWidget', QuickPick, 'everything');
|
|
3045
|
+
await invoke$1('Viewlet.openWidget', QuickPick$1, 'everything');
|
|
3157
3046
|
};
|
|
3158
3047
|
const handleInput$2 = async value => {
|
|
3159
3048
|
// @ts-ignore
|
|
@@ -3208,7 +3097,7 @@ const executeCommand = async label => {
|
|
|
3208
3097
|
await invoke$1('QuickPick.selectItem', label);
|
|
3209
3098
|
};
|
|
3210
3099
|
|
|
3211
|
-
const
|
|
3100
|
+
const QuickPick = {
|
|
3212
3101
|
__proto__: null,
|
|
3213
3102
|
executeCommand,
|
|
3214
3103
|
focusFirst: focusFirst$2,
|
|
@@ -3238,7 +3127,7 @@ const refresh = async () => {
|
|
|
3238
3127
|
return invoke$1('References.refresh');
|
|
3239
3128
|
};
|
|
3240
3129
|
|
|
3241
|
-
const
|
|
3130
|
+
const References = {
|
|
3242
3131
|
__proto__: null,
|
|
3243
3132
|
clear: clear$1,
|
|
3244
3133
|
collapseAll,
|
|
@@ -3278,7 +3167,7 @@ const handleSpace = async () => {
|
|
|
3278
3167
|
await invoke$1('Run And Debug.handleSpace');
|
|
3279
3168
|
};
|
|
3280
3169
|
|
|
3281
|
-
const
|
|
3170
|
+
const RunAndDebug = {
|
|
3282
3171
|
__proto__: null,
|
|
3283
3172
|
acceptWatchExpressionEdit,
|
|
3284
3173
|
addWatchExpression,
|
|
@@ -3372,7 +3261,7 @@ const setLimit = async limit => {
|
|
|
3372
3261
|
await invoke$1('Search.setLimit', limit);
|
|
3373
3262
|
};
|
|
3374
3263
|
|
|
3375
|
-
const
|
|
3264
|
+
const Search = {
|
|
3376
3265
|
__proto__: null,
|
|
3377
3266
|
clearSearchResults,
|
|
3378
3267
|
collapseDetails,
|
|
@@ -3406,7 +3295,7 @@ const update$1 = settings => {
|
|
|
3406
3295
|
return invoke$1('Preferences.update', settings);
|
|
3407
3296
|
};
|
|
3408
3297
|
|
|
3409
|
-
const
|
|
3298
|
+
const Settings = {
|
|
3410
3299
|
__proto__: null,
|
|
3411
3300
|
update: update$1
|
|
3412
3301
|
};
|
|
@@ -3448,7 +3337,7 @@ const handleScroll = async scrollTop => {
|
|
|
3448
3337
|
await invoke$1('Settings.handleScroll', scrollTop, Script);
|
|
3449
3338
|
};
|
|
3450
3339
|
|
|
3451
|
-
const
|
|
3340
|
+
const SettingsView = {
|
|
3452
3341
|
__proto__: null,
|
|
3453
3342
|
clear,
|
|
3454
3343
|
handleInput: handleInput$1,
|
|
@@ -3469,7 +3358,7 @@ const hide = async () => {
|
|
|
3469
3358
|
await invoke$1('Layout.hideSideBar');
|
|
3470
3359
|
};
|
|
3471
3360
|
|
|
3472
|
-
const
|
|
3361
|
+
const SideBar = {
|
|
3473
3362
|
__proto__: null,
|
|
3474
3363
|
hide,
|
|
3475
3364
|
open
|
|
@@ -3489,7 +3378,7 @@ const handleClickSourceControlButtons = async (index, name) => {
|
|
|
3489
3378
|
await invoke$1('Source Control.handleClickSourceControlButtons', index, name);
|
|
3490
3379
|
};
|
|
3491
3380
|
|
|
3492
|
-
const
|
|
3381
|
+
const SourceControl = {
|
|
3493
3382
|
__proto__: null,
|
|
3494
3383
|
acceptInput,
|
|
3495
3384
|
handleClickSourceControlButtons,
|
|
@@ -3501,7 +3390,7 @@ const update = async () => {
|
|
|
3501
3390
|
await invoke$1('StatusBar.updateStatusBarItems');
|
|
3502
3391
|
};
|
|
3503
3392
|
|
|
3504
|
-
const
|
|
3393
|
+
const StatusBar = {
|
|
3505
3394
|
__proto__: null,
|
|
3506
3395
|
update
|
|
3507
3396
|
};
|
|
@@ -3559,7 +3448,7 @@ const toggleMenu = async () => {
|
|
|
3559
3448
|
await invoke$1('TitleBarMenuBar.toggleMenu');
|
|
3560
3449
|
};
|
|
3561
3450
|
|
|
3562
|
-
const
|
|
3451
|
+
const TitleBarMenuBar = {
|
|
3563
3452
|
__proto__: null,
|
|
3564
3453
|
closeMenu,
|
|
3565
3454
|
focus,
|
|
@@ -3588,7 +3477,7 @@ const resolve = relativePath => {
|
|
|
3588
3477
|
return new URL(relativePath, url).toString();
|
|
3589
3478
|
};
|
|
3590
3479
|
|
|
3591
|
-
const
|
|
3480
|
+
const Url = {
|
|
3592
3481
|
__proto__: null,
|
|
3593
3482
|
resolve,
|
|
3594
3483
|
setUrl
|
|
@@ -3665,7 +3554,7 @@ const fromId = async webViewId => {
|
|
|
3665
3554
|
};
|
|
3666
3555
|
};
|
|
3667
3556
|
|
|
3668
|
-
const
|
|
3557
|
+
const WebView = {
|
|
3669
3558
|
__proto__: null,
|
|
3670
3559
|
fromId
|
|
3671
3560
|
};
|
|
@@ -3688,55 +3577,168 @@ const resolveFileUrl = url => {
|
|
|
3688
3577
|
return toFileUrl(url);
|
|
3689
3578
|
};
|
|
3690
3579
|
|
|
3691
|
-
const
|
|
3580
|
+
const Workspace = {
|
|
3692
3581
|
__proto__: null,
|
|
3693
3582
|
openTmpDir,
|
|
3694
3583
|
resolveFileUrl,
|
|
3695
3584
|
setPath
|
|
3696
3585
|
};
|
|
3697
3586
|
|
|
3698
|
-
const
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3587
|
+
const createApi = platform => {
|
|
3588
|
+
return {
|
|
3589
|
+
About,
|
|
3590
|
+
ActivityBar,
|
|
3591
|
+
BaseUrl,
|
|
3592
|
+
ClipBoard,
|
|
3593
|
+
Command,
|
|
3594
|
+
ContextMenu,
|
|
3595
|
+
Developer,
|
|
3596
|
+
Dialog,
|
|
3597
|
+
Editor,
|
|
3598
|
+
EditorCompletion,
|
|
3599
|
+
EditorHover,
|
|
3600
|
+
EditorRename,
|
|
3601
|
+
EditorSourceAction,
|
|
3602
|
+
Explorer,
|
|
3603
|
+
Extension,
|
|
3604
|
+
ExtensionDetail,
|
|
3605
|
+
FileSystem: {
|
|
3606
|
+
...FileSystem,
|
|
3607
|
+
loadFixture(url) {
|
|
3608
|
+
return loadFixture(platform, url);
|
|
3609
|
+
}
|
|
3610
|
+
},
|
|
3611
|
+
FindWidget,
|
|
3612
|
+
IconTheme,
|
|
3613
|
+
IframeInspector,
|
|
3614
|
+
KeyBindingsEditor,
|
|
3615
|
+
KeyBoard,
|
|
3616
|
+
Main,
|
|
3617
|
+
Output,
|
|
3618
|
+
Panel,
|
|
3619
|
+
Platform,
|
|
3620
|
+
Problems,
|
|
3621
|
+
QuickPick,
|
|
3622
|
+
References,
|
|
3623
|
+
RunAndDebug,
|
|
3624
|
+
Search,
|
|
3625
|
+
Settings,
|
|
3626
|
+
SettingsView,
|
|
3627
|
+
SideBar,
|
|
3628
|
+
SourceControl,
|
|
3629
|
+
StatusBar,
|
|
3630
|
+
TitleBarMenuBar,
|
|
3631
|
+
Url,
|
|
3632
|
+
WebView,
|
|
3633
|
+
Workspace,
|
|
3634
|
+
test,
|
|
3635
|
+
Locator: create,
|
|
3636
|
+
expect,
|
|
3637
|
+
getTmpDir: getTmpDir$1 // TODO maybe deprecate this or move to file system
|
|
3638
|
+
};
|
|
3639
|
+
};
|
|
3640
|
+
|
|
3641
|
+
const callFunction = async (fn, args) => {
|
|
3642
|
+
try {
|
|
3643
|
+
await fn(args);
|
|
3644
|
+
return undefined;
|
|
3645
|
+
} catch (error) {
|
|
3646
|
+
return error;
|
|
3647
|
+
}
|
|
3648
|
+
};
|
|
3649
|
+
|
|
3650
|
+
const formatDuration = duration => {
|
|
3651
|
+
return duration.toFixed(2) + 'ms';
|
|
3652
|
+
};
|
|
3653
|
+
|
|
3654
|
+
const Fail = 'fail';
|
|
3655
|
+
const Pass = 'pass';
|
|
3656
|
+
|
|
3657
|
+
const executeTest2 = async (name, fn, globals, timestampGenerator) => {
|
|
3658
|
+
const getTimestamp = timestampGenerator;
|
|
3659
|
+
const start = getTimestamp();
|
|
3660
|
+
const error = await callFunction(fn, globals);
|
|
3661
|
+
const end = getTimestamp();
|
|
3662
|
+
const duration = end - start;
|
|
3663
|
+
const formattedDuration = formatDuration(duration);
|
|
3664
|
+
if (error) {
|
|
3665
|
+
return {
|
|
3666
|
+
error,
|
|
3667
|
+
start,
|
|
3668
|
+
end,
|
|
3669
|
+
duration,
|
|
3670
|
+
formattedDuration,
|
|
3671
|
+
name,
|
|
3672
|
+
type: Fail,
|
|
3673
|
+
background: 'red',
|
|
3674
|
+
text: `test failed: ${error}`
|
|
3675
|
+
};
|
|
3676
|
+
}
|
|
3677
|
+
return {
|
|
3678
|
+
error: undefined,
|
|
3679
|
+
start,
|
|
3680
|
+
end,
|
|
3681
|
+
duration,
|
|
3682
|
+
formattedDuration,
|
|
3683
|
+
name,
|
|
3684
|
+
type: Pass,
|
|
3685
|
+
background: 'green',
|
|
3686
|
+
text: `test passed in ${formattedDuration}`
|
|
3687
|
+
};
|
|
3688
|
+
};
|
|
3689
|
+
|
|
3690
|
+
const printError = error => {
|
|
3691
|
+
if (error && error.constructor.name === 'AssertionError') {
|
|
3692
|
+
console.error(error.message);
|
|
3693
|
+
} else {
|
|
3694
|
+
console.error(error);
|
|
3695
|
+
}
|
|
3696
|
+
};
|
|
3697
|
+
|
|
3698
|
+
const printTestError = async error => {
|
|
3699
|
+
// TODO ask error worker to add codeframe
|
|
3700
|
+
printError(error);
|
|
3701
|
+
};
|
|
3702
|
+
|
|
3703
|
+
const now = () => {
|
|
3704
|
+
return performance.now();
|
|
3705
|
+
};
|
|
3706
|
+
|
|
3707
|
+
const executeTest = async (name, fn, globals = {}) => {
|
|
3708
|
+
const {
|
|
3709
|
+
error,
|
|
3710
|
+
formattedDuration,
|
|
3711
|
+
background,
|
|
3712
|
+
text,
|
|
3713
|
+
type
|
|
3714
|
+
} = await executeTest2(name, fn, globals, now);
|
|
3715
|
+
if (error) {
|
|
3716
|
+
await printTestError(error);
|
|
3717
|
+
} else {
|
|
3718
|
+
// eslint-disable-next-line no-console
|
|
3719
|
+
console.info(`PASS ${name} in ${formattedDuration}`);
|
|
3720
|
+
}
|
|
3721
|
+
// @ts-ignore
|
|
3722
|
+
await invoke$1('TestFrameWork.showOverlay', type, background, text);
|
|
3723
|
+
};
|
|
3724
|
+
|
|
3725
|
+
const importScript = async url => {
|
|
3726
|
+
try {
|
|
3727
|
+
return await import(url);
|
|
3728
|
+
} catch (error) {
|
|
3729
|
+
throw error;
|
|
3730
|
+
// TODO
|
|
3731
|
+
// const actualErrorMessage = await TryToGetactualImportErrorMessage.tryToGetActualImportErrorMessage(url, error)
|
|
3732
|
+
// throw new Error(actualErrorMessage)
|
|
3733
|
+
}
|
|
3734
|
+
};
|
|
3735
|
+
|
|
3736
|
+
const importTest = async url => {
|
|
3737
|
+
try {
|
|
3738
|
+
return await importScript(url);
|
|
3739
|
+
} catch (error) {
|
|
3740
|
+
throw new VError(error, 'Failed to import test');
|
|
3741
|
+
}
|
|
3740
3742
|
};
|
|
3741
3743
|
|
|
3742
3744
|
// TODO move this into three steps:
|
|
@@ -3744,21 +3746,12 @@ const TestFrameWorkComponent = {
|
|
|
3744
3746
|
// 2. execute test
|
|
3745
3747
|
// 3. print out results
|
|
3746
3748
|
const execute = async (href, platform) => {
|
|
3747
|
-
const globals =
|
|
3748
|
-
...TestFrameWorkComponent,
|
|
3749
|
-
FileSystem: {
|
|
3750
|
-
...TestFrameWorkComponentFileSystem,
|
|
3751
|
-
loadFixture(url) {
|
|
3752
|
-
return loadFixture(platform, url);
|
|
3753
|
-
}
|
|
3754
|
-
},
|
|
3755
|
-
...TestFrameWork
|
|
3756
|
-
};
|
|
3749
|
+
const globals = createApi(platform);
|
|
3757
3750
|
// TODO
|
|
3758
3751
|
// 0. wait for page to be ready
|
|
3759
3752
|
// 1. get script to import from renderer process (url or from html)
|
|
3760
3753
|
const scriptUrl = href;
|
|
3761
|
-
setUrl(scriptUrl);
|
|
3754
|
+
setUrl(scriptUrl); // TODO avoid side effect
|
|
3762
3755
|
// 2. import that script
|
|
3763
3756
|
const module = await importTest(scriptUrl);
|
|
3764
3757
|
if (module.mockRpc) {
|