@lvce-editor/test-with-playwright-worker 12.0.0 → 13.0.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/workerMain.js +163 -156
- package/package.json +2 -2
package/dist/workerMain.js
CHANGED
|
@@ -245,8 +245,8 @@ const getModuleNotFoundError = stderr => {
|
|
|
245
245
|
const messageIndex = lines.findIndex(isModuleNotFoundMessage);
|
|
246
246
|
const message = lines[messageIndex];
|
|
247
247
|
return {
|
|
248
|
-
|
|
249
|
-
|
|
248
|
+
code: ERR_MODULE_NOT_FOUND,
|
|
249
|
+
message
|
|
250
250
|
};
|
|
251
251
|
};
|
|
252
252
|
const isModuleNotFoundError = stderr => {
|
|
@@ -269,14 +269,14 @@ const isUnhelpfulNativeModuleError = stderr => {
|
|
|
269
269
|
const getNativeModuleErrorMessage = stderr => {
|
|
270
270
|
const message = getMessageCodeBlock(stderr);
|
|
271
271
|
return {
|
|
272
|
-
|
|
273
|
-
|
|
272
|
+
code: E_INCOMPATIBLE_NATIVE_MODULE,
|
|
273
|
+
message: `Incompatible native node module: ${message}`
|
|
274
274
|
};
|
|
275
275
|
};
|
|
276
276
|
const getModuleSyntaxError = () => {
|
|
277
277
|
return {
|
|
278
|
-
|
|
279
|
-
|
|
278
|
+
code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON,
|
|
279
|
+
message: `ES Modules are not supported in electron`
|
|
280
280
|
};
|
|
281
281
|
};
|
|
282
282
|
const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
@@ -295,8 +295,8 @@ const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
|
295
295
|
rest
|
|
296
296
|
} = getDetails(lines);
|
|
297
297
|
return {
|
|
298
|
-
message: actualMessage,
|
|
299
298
|
code: '',
|
|
299
|
+
message: actualMessage,
|
|
300
300
|
stack: rest
|
|
301
301
|
};
|
|
302
302
|
};
|
|
@@ -306,8 +306,8 @@ class IpcError extends VError {
|
|
|
306
306
|
if (stdout || stderr) {
|
|
307
307
|
// @ts-ignore
|
|
308
308
|
const {
|
|
309
|
-
message,
|
|
310
309
|
code,
|
|
310
|
+
message,
|
|
311
311
|
stack
|
|
312
312
|
} = getHelpfulChildProcessError(stdout, stderr);
|
|
313
313
|
const cause = new Error(message);
|
|
@@ -377,56 +377,14 @@ const IpcChildWithNodeWorker$1 = {
|
|
|
377
377
|
wrap: wrap$b
|
|
378
378
|
};
|
|
379
379
|
|
|
380
|
-
const Two = '2.0';
|
|
381
|
-
const create$4 = (method, params) => {
|
|
382
|
-
return {
|
|
383
|
-
jsonrpc: Two,
|
|
384
|
-
method,
|
|
385
|
-
params
|
|
386
|
-
};
|
|
387
|
-
};
|
|
380
|
+
const Two$1 = '2.0';
|
|
388
381
|
const callbacks = Object.create(null);
|
|
389
|
-
const set$1 = (id, fn) => {
|
|
390
|
-
callbacks[id] = fn;
|
|
391
|
-
};
|
|
392
382
|
const get$1 = id => {
|
|
393
383
|
return callbacks[id];
|
|
394
384
|
};
|
|
395
385
|
const remove = id => {
|
|
396
386
|
delete callbacks[id];
|
|
397
387
|
};
|
|
398
|
-
let id = 0;
|
|
399
|
-
const create$3 = () => {
|
|
400
|
-
return ++id;
|
|
401
|
-
};
|
|
402
|
-
const registerPromise = () => {
|
|
403
|
-
const id = create$3();
|
|
404
|
-
const {
|
|
405
|
-
resolve,
|
|
406
|
-
promise
|
|
407
|
-
} = Promise.withResolvers();
|
|
408
|
-
set$1(id, resolve);
|
|
409
|
-
return {
|
|
410
|
-
id,
|
|
411
|
-
promise
|
|
412
|
-
};
|
|
413
|
-
};
|
|
414
|
-
const create$2 = (method, params) => {
|
|
415
|
-
const {
|
|
416
|
-
id,
|
|
417
|
-
promise
|
|
418
|
-
} = registerPromise();
|
|
419
|
-
const message = {
|
|
420
|
-
jsonrpc: Two,
|
|
421
|
-
method,
|
|
422
|
-
params,
|
|
423
|
-
id
|
|
424
|
-
};
|
|
425
|
-
return {
|
|
426
|
-
message,
|
|
427
|
-
promise
|
|
428
|
-
};
|
|
429
|
-
};
|
|
430
388
|
class JsonRpcError extends Error {
|
|
431
389
|
constructor(message) {
|
|
432
390
|
super(message);
|
|
@@ -622,7 +580,7 @@ const getErrorProperty = (error, prettyError) => {
|
|
|
622
580
|
};
|
|
623
581
|
const create$1 = (id, error) => {
|
|
624
582
|
return {
|
|
625
|
-
jsonrpc: Two,
|
|
583
|
+
jsonrpc: Two$1,
|
|
626
584
|
id,
|
|
627
585
|
error
|
|
628
586
|
};
|
|
@@ -635,7 +593,7 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
|
635
593
|
};
|
|
636
594
|
const create = (message, result) => {
|
|
637
595
|
return {
|
|
638
|
-
jsonrpc: Two,
|
|
596
|
+
jsonrpc: Two$1,
|
|
639
597
|
id: message.id,
|
|
640
598
|
result: result ?? null
|
|
641
599
|
};
|
|
@@ -646,7 +604,7 @@ const getSuccessResponse = (message, result) => {
|
|
|
646
604
|
};
|
|
647
605
|
const getErrorResponseSimple = (id, error) => {
|
|
648
606
|
return {
|
|
649
|
-
jsonrpc: Two,
|
|
607
|
+
jsonrpc: Two$1,
|
|
650
608
|
id,
|
|
651
609
|
error: {
|
|
652
610
|
code: Custom,
|
|
@@ -733,29 +691,6 @@ const handleJsonRpcMessage = async (...args) => {
|
|
|
733
691
|
}
|
|
734
692
|
throw new JsonRpcError('unexpected message');
|
|
735
693
|
};
|
|
736
|
-
const invokeHelper = async (ipc, method, params, useSendAndTransfer) => {
|
|
737
|
-
const {
|
|
738
|
-
message,
|
|
739
|
-
promise
|
|
740
|
-
} = create$2(method, params);
|
|
741
|
-
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
742
|
-
ipc.sendAndTransfer(message);
|
|
743
|
-
} else {
|
|
744
|
-
ipc.send(message);
|
|
745
|
-
}
|
|
746
|
-
const responseMessage = await promise;
|
|
747
|
-
return unwrapJsonRpcResult(responseMessage);
|
|
748
|
-
};
|
|
749
|
-
const send = (transport, method, ...params) => {
|
|
750
|
-
const message = create$4(method, params);
|
|
751
|
-
transport.send(message);
|
|
752
|
-
};
|
|
753
|
-
const invoke = (ipc, method, ...params) => {
|
|
754
|
-
return invokeHelper(ipc, method, params, false);
|
|
755
|
-
};
|
|
756
|
-
const invokeAndTransfer = (ipc, method, ...params) => {
|
|
757
|
-
return invokeHelper(ipc, method, params, true);
|
|
758
|
-
};
|
|
759
694
|
|
|
760
695
|
class CommandNotFoundError extends Error {
|
|
761
696
|
constructor(command) {
|
|
@@ -778,24 +713,87 @@ const execute = (command, ...args) => {
|
|
|
778
713
|
return fn(...args);
|
|
779
714
|
};
|
|
780
715
|
|
|
716
|
+
const Two = '2.0';
|
|
717
|
+
const create$s = (method, params) => {
|
|
718
|
+
return {
|
|
719
|
+
jsonrpc: Two,
|
|
720
|
+
method,
|
|
721
|
+
params
|
|
722
|
+
};
|
|
723
|
+
};
|
|
724
|
+
const create$r = (id, method, params) => {
|
|
725
|
+
const message = {
|
|
726
|
+
id,
|
|
727
|
+
jsonrpc: Two,
|
|
728
|
+
method,
|
|
729
|
+
params
|
|
730
|
+
};
|
|
731
|
+
return message;
|
|
732
|
+
};
|
|
733
|
+
let id = 0;
|
|
734
|
+
const create$q = () => {
|
|
735
|
+
return ++id;
|
|
736
|
+
};
|
|
737
|
+
|
|
738
|
+
/* eslint-disable n/no-unsupported-features/es-syntax */
|
|
739
|
+
|
|
740
|
+
const registerPromise = map => {
|
|
741
|
+
const id = create$q();
|
|
742
|
+
const {
|
|
743
|
+
promise,
|
|
744
|
+
resolve
|
|
745
|
+
} = Promise.withResolvers();
|
|
746
|
+
map[id] = resolve;
|
|
747
|
+
return {
|
|
748
|
+
id,
|
|
749
|
+
promise
|
|
750
|
+
};
|
|
751
|
+
};
|
|
752
|
+
|
|
753
|
+
// @ts-ignore
|
|
754
|
+
const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer) => {
|
|
755
|
+
const {
|
|
756
|
+
id,
|
|
757
|
+
promise
|
|
758
|
+
} = registerPromise(callbacks);
|
|
759
|
+
const message = create$r(id, method, params);
|
|
760
|
+
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
761
|
+
ipc.sendAndTransfer(message);
|
|
762
|
+
} else {
|
|
763
|
+
ipc.send(message);
|
|
764
|
+
}
|
|
765
|
+
const responseMessage = await promise;
|
|
766
|
+
return unwrapJsonRpcResult(responseMessage);
|
|
767
|
+
};
|
|
781
768
|
const createRpc = ipc => {
|
|
769
|
+
const callbacks = Object.create(null);
|
|
770
|
+
ipc._resolve = (id, response) => {
|
|
771
|
+
const fn = callbacks[id];
|
|
772
|
+
if (!fn) {
|
|
773
|
+
console.warn(`callback ${id} may already be disposed`);
|
|
774
|
+
return;
|
|
775
|
+
}
|
|
776
|
+
fn(response);
|
|
777
|
+
delete callbacks[id];
|
|
778
|
+
};
|
|
782
779
|
const rpc = {
|
|
780
|
+
async dispose() {
|
|
781
|
+
await ipc?.dispose();
|
|
782
|
+
},
|
|
783
|
+
invoke(method, ...params) {
|
|
784
|
+
return invokeHelper(callbacks, ipc, method, params, false);
|
|
785
|
+
},
|
|
786
|
+
invokeAndTransfer(method, ...params) {
|
|
787
|
+
return invokeHelper(callbacks, ipc, method, params, true);
|
|
788
|
+
},
|
|
783
789
|
// @ts-ignore
|
|
784
790
|
ipc,
|
|
785
791
|
/**
|
|
786
792
|
* @deprecated
|
|
787
793
|
*/
|
|
788
794
|
send(method, ...params) {
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
invoke(method, ...params) {
|
|
792
|
-
return invoke(ipc, method, ...params);
|
|
793
|
-
},
|
|
794
|
-
invokeAndTransfer(method, ...params) {
|
|
795
|
-
return invokeAndTransfer(ipc, method, ...params);
|
|
796
|
-
},
|
|
797
|
-
async dispose() {
|
|
798
|
-
await ipc?.dispose();
|
|
795
|
+
const message = create$s(method, params);
|
|
796
|
+
ipc.send(message);
|
|
799
797
|
}
|
|
800
798
|
};
|
|
801
799
|
return rpc;
|
|
@@ -812,7 +810,7 @@ const logError = () => {
|
|
|
812
810
|
const handleMessage = event => {
|
|
813
811
|
const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket;
|
|
814
812
|
const actualExecute = event?.target?.execute || execute;
|
|
815
|
-
return handleJsonRpcMessage(event.target, event.data, actualExecute,
|
|
813
|
+
return handleJsonRpcMessage(event.target, event.data, actualExecute, event.target._resolve, preparePrettyError, logError, actualRequiresSocket);
|
|
816
814
|
};
|
|
817
815
|
const handleIpc = ipc => {
|
|
818
816
|
if ('addEventListener' in ipc) {
|
|
@@ -830,7 +828,7 @@ const listen = async (module, options) => {
|
|
|
830
828
|
const ipc = module.wrap(rawIpc);
|
|
831
829
|
return ipc;
|
|
832
830
|
};
|
|
833
|
-
const create$
|
|
831
|
+
const create$6 = async ({
|
|
834
832
|
commandMap
|
|
835
833
|
}) => {
|
|
836
834
|
// TODO create a commandMap per rpc instance
|
|
@@ -842,7 +840,7 @@ const create$7 = async ({
|
|
|
842
840
|
};
|
|
843
841
|
const NodeWorkerRpcClient = {
|
|
844
842
|
__proto__: null,
|
|
845
|
-
create: create$
|
|
843
|
+
create: create$6
|
|
846
844
|
};
|
|
847
845
|
|
|
848
846
|
const rpcs = Object.create(null);
|
|
@@ -918,23 +916,23 @@ const Fail = 3;
|
|
|
918
916
|
|
|
919
917
|
const getTestState = (testOverlayState, text) => {
|
|
920
918
|
switch (testOverlayState) {
|
|
921
|
-
case
|
|
919
|
+
case Fail$1:
|
|
922
920
|
// @ts-ignore
|
|
923
921
|
return {
|
|
924
|
-
|
|
925
|
-
|
|
922
|
+
error: `${text}`,
|
|
923
|
+
status: Fail
|
|
926
924
|
};
|
|
927
|
-
case
|
|
925
|
+
case Pass$1:
|
|
928
926
|
// @ts-ignore
|
|
929
927
|
return {
|
|
930
|
-
|
|
931
|
-
|
|
928
|
+
error: '',
|
|
929
|
+
status: Pass
|
|
932
930
|
};
|
|
933
|
-
case
|
|
931
|
+
case Skip$1:
|
|
934
932
|
// @ts-ignore
|
|
935
933
|
return {
|
|
936
|
-
|
|
937
|
-
|
|
934
|
+
error: '',
|
|
935
|
+
status: Skip
|
|
938
936
|
};
|
|
939
937
|
default:
|
|
940
938
|
throw new Error(`unexpected test state: ${testOverlayState}`);
|
|
@@ -944,21 +942,27 @@ const getTestState = (testOverlayState, text) => {
|
|
|
944
942
|
/**
|
|
945
943
|
* @param {string} absolutePath
|
|
946
944
|
* @param {number} port
|
|
945
|
+
* @param {boolean} traceFocus
|
|
947
946
|
*/
|
|
948
|
-
const getUrlFromTestFile = (absolutePath, port) => {
|
|
947
|
+
const getUrlFromTestFile = (absolutePath, port, traceFocus) => {
|
|
949
948
|
const baseName = basename(absolutePath);
|
|
950
949
|
const htmlFileName = baseName.slice(0, -'.js'.length) + '.html';
|
|
951
|
-
|
|
950
|
+
const baseUrl = `http://localhost:${port}/tests/${htmlFileName}`;
|
|
951
|
+
if (traceFocus) {
|
|
952
|
+
return `${baseUrl}?traceFocus=true`;
|
|
953
|
+
}
|
|
954
|
+
return baseUrl;
|
|
952
955
|
};
|
|
953
956
|
const runTest = async ({
|
|
954
|
-
test,
|
|
955
957
|
page,
|
|
956
|
-
testSrc,
|
|
957
958
|
port,
|
|
958
|
-
|
|
959
|
+
test,
|
|
960
|
+
testSrc,
|
|
961
|
+
timeout,
|
|
962
|
+
traceFocus
|
|
959
963
|
}) => {
|
|
960
964
|
const start = performance.now();
|
|
961
|
-
const url = getUrlFromTestFile(test, port);
|
|
965
|
+
const url = getUrlFromTestFile(test, port, traceFocus);
|
|
962
966
|
await page.goto(url, {
|
|
963
967
|
waitUntil: 'networkidle'
|
|
964
968
|
});
|
|
@@ -974,10 +978,10 @@ const runTest = async ({
|
|
|
974
978
|
return {
|
|
975
979
|
// @ts-ignore
|
|
976
980
|
...testState,
|
|
977
|
-
name: test,
|
|
978
|
-
start,
|
|
979
981
|
end,
|
|
980
|
-
error: text
|
|
982
|
+
error: text,
|
|
983
|
+
name: test,
|
|
984
|
+
start
|
|
981
985
|
};
|
|
982
986
|
};
|
|
983
987
|
|
|
@@ -986,14 +990,15 @@ const runTest = async ({
|
|
|
986
990
|
* @param {{testSrc:string, tests:string[], headless:boolean, page: import('@playwright/test').Page, port:number, timeout:number, onResult:any, onFinalResult:any}} param0
|
|
987
991
|
*/
|
|
988
992
|
const runTests = async ({
|
|
989
|
-
testSrc,
|
|
990
|
-
tests,
|
|
991
993
|
headless,
|
|
994
|
+
onFinalResult,
|
|
995
|
+
onResult,
|
|
992
996
|
page,
|
|
993
997
|
port,
|
|
998
|
+
tests,
|
|
999
|
+
testSrc,
|
|
994
1000
|
timeout,
|
|
995
|
-
|
|
996
|
-
onFinalResult
|
|
1001
|
+
traceFocus
|
|
997
1002
|
}) => {
|
|
998
1003
|
let failed = 0;
|
|
999
1004
|
let skipped = 0;
|
|
@@ -1001,11 +1006,12 @@ const runTests = async ({
|
|
|
1001
1006
|
const start = performance.now();
|
|
1002
1007
|
for (const test of tests) {
|
|
1003
1008
|
const result = await runTest({
|
|
1004
|
-
test,
|
|
1005
1009
|
page,
|
|
1006
|
-
testSrc,
|
|
1007
1010
|
port,
|
|
1008
|
-
|
|
1011
|
+
test,
|
|
1012
|
+
testSrc,
|
|
1013
|
+
timeout,
|
|
1014
|
+
traceFocus
|
|
1009
1015
|
});
|
|
1010
1016
|
await onResult(result);
|
|
1011
1017
|
// @ts-ignore
|
|
@@ -1013,21 +1019,21 @@ const runTests = async ({
|
|
|
1013
1019
|
case Fail:
|
|
1014
1020
|
failed++;
|
|
1015
1021
|
break;
|
|
1016
|
-
case Skip:
|
|
1017
|
-
skipped++;
|
|
1018
|
-
break;
|
|
1019
1022
|
case Pass:
|
|
1020
1023
|
passed++;
|
|
1021
1024
|
break;
|
|
1025
|
+
case Skip:
|
|
1026
|
+
skipped++;
|
|
1027
|
+
break;
|
|
1022
1028
|
}
|
|
1023
1029
|
}
|
|
1024
1030
|
const end = performance.now();
|
|
1025
1031
|
await onFinalResult({
|
|
1026
|
-
|
|
1032
|
+
end,
|
|
1027
1033
|
failed,
|
|
1034
|
+
passed,
|
|
1028
1035
|
skipped,
|
|
1029
|
-
start
|
|
1030
|
-
end
|
|
1036
|
+
start
|
|
1031
1037
|
});
|
|
1032
1038
|
};
|
|
1033
1039
|
|
|
@@ -1175,8 +1181,8 @@ const getServerPath = async serverPath => {
|
|
|
1175
1181
|
* @returns
|
|
1176
1182
|
*/
|
|
1177
1183
|
const startBrowser = async ({
|
|
1178
|
-
|
|
1179
|
-
|
|
1184
|
+
headless,
|
|
1185
|
+
signal
|
|
1180
1186
|
}) => {
|
|
1181
1187
|
const browser = await chromium.launch({
|
|
1182
1188
|
headless
|
|
@@ -1194,29 +1200,27 @@ const startBrowser = async ({
|
|
|
1194
1200
|
};
|
|
1195
1201
|
};
|
|
1196
1202
|
|
|
1197
|
-
/* eslint-disable n/no-unsupported-features/es-syntax */
|
|
1198
|
-
|
|
1199
1203
|
/**
|
|
1200
1204
|
*
|
|
1201
1205
|
* @param {{signal:AbortSignal, port:number, serverPath:string, onlyExtension:string, testPath:string}} param0
|
|
1202
1206
|
* @returns
|
|
1203
1207
|
*/
|
|
1204
1208
|
const startServer = async ({
|
|
1205
|
-
|
|
1209
|
+
onlyExtension,
|
|
1206
1210
|
port,
|
|
1207
1211
|
serverPath,
|
|
1208
|
-
|
|
1212
|
+
signal,
|
|
1209
1213
|
testPath
|
|
1210
1214
|
}) => {
|
|
1211
1215
|
const child = fork(serverPath, {
|
|
1212
|
-
stdio: 'inherit',
|
|
1213
1216
|
// signal,
|
|
1214
1217
|
env: {
|
|
1215
1218
|
...process.env,
|
|
1216
|
-
PORT: String(port),
|
|
1217
1219
|
ONLY_EXTENSION: onlyExtension,
|
|
1220
|
+
PORT: String(port),
|
|
1218
1221
|
TEST_PATH: testPath
|
|
1219
|
-
}
|
|
1222
|
+
},
|
|
1223
|
+
stdio: 'inherit'
|
|
1220
1224
|
});
|
|
1221
1225
|
child.on('error', x => {
|
|
1222
1226
|
if (x.name === 'AbortError') {
|
|
@@ -1225,8 +1229,8 @@ const startServer = async ({
|
|
|
1225
1229
|
console.log('child error', x);
|
|
1226
1230
|
});
|
|
1227
1231
|
const {
|
|
1228
|
-
|
|
1229
|
-
|
|
1232
|
+
promise,
|
|
1233
|
+
resolve
|
|
1230
1234
|
} = Promise.withResolvers();
|
|
1231
1235
|
child.on('message', resolve);
|
|
1232
1236
|
await promise;
|
|
@@ -1239,41 +1243,41 @@ const startServer = async ({
|
|
|
1239
1243
|
* @returns
|
|
1240
1244
|
*/
|
|
1241
1245
|
const setupTests = async ({
|
|
1242
|
-
signal,
|
|
1243
1246
|
headless,
|
|
1244
1247
|
onlyExtension,
|
|
1245
|
-
|
|
1246
|
-
|
|
1248
|
+
serverPath,
|
|
1249
|
+
signal,
|
|
1250
|
+
testPath
|
|
1247
1251
|
}) => {
|
|
1248
1252
|
const port = await getPort();
|
|
1249
1253
|
const {
|
|
1250
1254
|
browser,
|
|
1251
1255
|
page
|
|
1252
1256
|
} = await startBrowser({
|
|
1253
|
-
|
|
1254
|
-
|
|
1257
|
+
headless,
|
|
1258
|
+
signal
|
|
1255
1259
|
});
|
|
1256
1260
|
const resolvedServerPath = await getServerPath(serverPath);
|
|
1257
1261
|
const child = await startServer({
|
|
1258
|
-
|
|
1262
|
+
onlyExtension,
|
|
1259
1263
|
port,
|
|
1260
1264
|
serverPath: resolvedServerPath,
|
|
1261
|
-
|
|
1265
|
+
signal,
|
|
1262
1266
|
testPath
|
|
1263
1267
|
});
|
|
1264
1268
|
return {
|
|
1265
|
-
port,
|
|
1266
1269
|
browser,
|
|
1270
|
+
child,
|
|
1267
1271
|
page,
|
|
1268
|
-
|
|
1272
|
+
port
|
|
1269
1273
|
};
|
|
1270
1274
|
};
|
|
1271
1275
|
|
|
1272
1276
|
const SIGINT = 'SIGINT';
|
|
1273
1277
|
|
|
1274
1278
|
const tearDownTests = async ({
|
|
1275
|
-
|
|
1276
|
-
|
|
1279
|
+
child,
|
|
1280
|
+
controller
|
|
1277
1281
|
}) => {
|
|
1278
1282
|
controller.abort();
|
|
1279
1283
|
child.kill(SIGINT);
|
|
@@ -1284,9 +1288,11 @@ const tearDownTests = async ({
|
|
|
1284
1288
|
* @param {string} testPath
|
|
1285
1289
|
* @param {string} cwd
|
|
1286
1290
|
* @param {boolean} headless
|
|
1287
|
-
* @param {number}
|
|
1291
|
+
* @param {number} timeout
|
|
1292
|
+
* @param {string} serverPath
|
|
1293
|
+
* @param {boolean} traceFocus
|
|
1288
1294
|
*/
|
|
1289
|
-
const runAllTests = async (extensionPath, testPath, cwd, headless, timeout, serverPath) => {
|
|
1295
|
+
const runAllTests = async (extensionPath, testPath, cwd, headless, timeout, serverPath, traceFocus) => {
|
|
1290
1296
|
string(extensionPath);
|
|
1291
1297
|
string(testPath);
|
|
1292
1298
|
string(cwd);
|
|
@@ -1299,15 +1305,15 @@ const runAllTests = async (extensionPath, testPath, cwd, headless, timeout, serv
|
|
|
1299
1305
|
} = controller;
|
|
1300
1306
|
// @ts-ignore
|
|
1301
1307
|
const {
|
|
1302
|
-
page,
|
|
1303
1308
|
child,
|
|
1309
|
+
page,
|
|
1304
1310
|
port
|
|
1305
1311
|
} = await setupTests({
|
|
1306
|
-
signal,
|
|
1307
1312
|
headless,
|
|
1308
1313
|
onlyExtension: extensionPath,
|
|
1309
|
-
|
|
1310
|
-
|
|
1314
|
+
serverPath,
|
|
1315
|
+
signal,
|
|
1316
|
+
testPath
|
|
1311
1317
|
});
|
|
1312
1318
|
const testSrc = join(testPath, 'src');
|
|
1313
1319
|
const tests = await getTests(testSrc);
|
|
@@ -1318,18 +1324,19 @@ const runAllTests = async (extensionPath, testPath, cwd, headless, timeout, serv
|
|
|
1318
1324
|
await rpc.invoke(HandleFinalResult, finalResult);
|
|
1319
1325
|
};
|
|
1320
1326
|
await runTests({
|
|
1321
|
-
testSrc,
|
|
1322
|
-
tests,
|
|
1323
1327
|
headless,
|
|
1324
|
-
|
|
1328
|
+
onFinalResult,
|
|
1329
|
+
onResult,
|
|
1325
1330
|
page,
|
|
1331
|
+
port,
|
|
1332
|
+
tests,
|
|
1333
|
+
testSrc,
|
|
1326
1334
|
timeout,
|
|
1327
|
-
|
|
1328
|
-
onFinalResult
|
|
1335
|
+
traceFocus
|
|
1329
1336
|
});
|
|
1330
1337
|
await tearDownTests({
|
|
1331
|
-
|
|
1332
|
-
|
|
1338
|
+
child,
|
|
1339
|
+
controller
|
|
1333
1340
|
});
|
|
1334
1341
|
};
|
|
1335
1342
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/test-with-playwright-worker",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "13.0.0",
|
|
4
4
|
"description": "Worker package for test-with-playwright",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"type": "module",
|
|
13
13
|
"main": "dist/workerMain.js",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@playwright/test": "1.
|
|
15
|
+
"@playwright/test": "1.58.0"
|
|
16
16
|
},
|
|
17
17
|
"engines": {
|
|
18
18
|
"node": ">=22"
|