@lvce-editor/test-with-playwright 14.2.0 → 14.4.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.
Files changed (2) hide show
  1. package/dist/main.js +41 -41
  2. package/package.json +3 -3
package/dist/main.js CHANGED
@@ -782,7 +782,7 @@ const getFirstNodeWorkerEvent = worker => {
782
782
  message: Message$1
783
783
  });
784
784
  };
785
- const create$1$1 = async ({
785
+ const create$1$2 = async ({
786
786
  argv = [],
787
787
  env = process.env,
788
788
  execArgv = [],
@@ -852,10 +852,31 @@ const wrap$1 = worker => {
852
852
  };
853
853
  const IpcParentWithNodeWorker$1 = {
854
854
  __proto__: null,
855
- create: create$1$1,
855
+ create: create$1$2,
856
856
  wrap: wrap$1
857
857
  };
858
858
 
859
+ class CommandNotFoundError extends Error {
860
+ constructor(command) {
861
+ super(`Command not found ${command}`);
862
+ this.name = 'CommandNotFoundError';
863
+ }
864
+ }
865
+ const commands = Object.create(null);
866
+ const register = commandMap => {
867
+ Object.assign(commands, commandMap);
868
+ };
869
+ const getCommand = key => {
870
+ return commands[key];
871
+ };
872
+ const execute = (command, ...args) => {
873
+ const fn = getCommand(command);
874
+ if (!fn) {
875
+ throw new CommandNotFoundError(command);
876
+ }
877
+ return fn(...args);
878
+ };
879
+
859
880
  const Two$1 = '2.0';
860
881
  const callbacks = Object.create(null);
861
882
  const get = id => {
@@ -1057,7 +1078,7 @@ const getErrorProperty = (error, prettyError) => {
1057
1078
  }
1058
1079
  };
1059
1080
  };
1060
- const create$1 = (id, error) => {
1081
+ const create$1$1 = (id, error) => {
1061
1082
  return {
1062
1083
  jsonrpc: Two$1,
1063
1084
  id,
@@ -1068,9 +1089,9 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
1068
1089
  const prettyError = preparePrettyError(error);
1069
1090
  logError(error, prettyError);
1070
1091
  const errorProperty = getErrorProperty(error, prettyError);
1071
- return create$1(id, errorProperty);
1092
+ return create$1$1(id, errorProperty);
1072
1093
  };
1073
- const create = (message, result) => {
1094
+ const create$4 = (message, result) => {
1074
1095
  return {
1075
1096
  jsonrpc: Two$1,
1076
1097
  id: message.id,
@@ -1079,7 +1100,7 @@ const create = (message, result) => {
1079
1100
  };
1080
1101
  const getSuccessResponse = (message, result) => {
1081
1102
  const resultProperty = result ?? null;
1082
- return create(message, resultProperty);
1103
+ return create$4(message, resultProperty);
1083
1104
  };
1084
1105
  const getErrorResponseSimple = (id, error) => {
1085
1106
  return {
@@ -1171,36 +1192,17 @@ const handleJsonRpcMessage = async (...args) => {
1171
1192
  throw new JsonRpcError('unexpected message');
1172
1193
  };
1173
1194
 
1174
- class CommandNotFoundError extends Error {
1175
- constructor(command) {
1176
- super(`Command not found ${command}`);
1177
- this.name = 'CommandNotFoundError';
1178
- }
1179
- }
1180
- const commands = Object.create(null);
1181
- const register = commandMap => {
1182
- Object.assign(commands, commandMap);
1183
- };
1184
- const getCommand = key => {
1185
- return commands[key];
1186
- };
1187
- const execute = (command, ...args) => {
1188
- const fn = getCommand(command);
1189
- if (!fn) {
1190
- throw new CommandNotFoundError(command);
1191
- }
1192
- return fn(...args);
1193
- };
1194
-
1195
1195
  const Two = '2.0';
1196
- const create$t = (method, params) => {
1196
+
1197
+ const create$3 = (method, params) => {
1197
1198
  return {
1198
1199
  jsonrpc: Two,
1199
1200
  method,
1200
1201
  params
1201
1202
  };
1202
1203
  };
1203
- const create$s = (id, method, params) => {
1204
+
1205
+ const create$2 = (id, method, params) => {
1204
1206
  const message = {
1205
1207
  id,
1206
1208
  jsonrpc: Two,
@@ -1209,15 +1211,14 @@ const create$s = (id, method, params) => {
1209
1211
  };
1210
1212
  return message;
1211
1213
  };
1214
+
1212
1215
  let id = 0;
1213
- const create$r = () => {
1216
+ const create$1 = () => {
1214
1217
  return ++id;
1215
1218
  };
1216
1219
 
1217
- /* eslint-disable n/no-unsupported-features/es-syntax */
1218
-
1219
1220
  const registerPromise = map => {
1220
- const id = create$r();
1221
+ const id = create$1();
1221
1222
  const {
1222
1223
  promise,
1223
1224
  resolve
@@ -1235,7 +1236,7 @@ const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer)
1235
1236
  id,
1236
1237
  promise
1237
1238
  } = registerPromise(callbacks);
1238
- const message = create$s(id, method, params);
1239
+ const message = create$2(id, method, params);
1239
1240
  if (useSendAndTransfer && ipc.sendAndTransfer) {
1240
1241
  ipc.sendAndTransfer(message);
1241
1242
  } else {
@@ -1271,12 +1272,13 @@ const createRpc = ipc => {
1271
1272
  * @deprecated
1272
1273
  */
1273
1274
  send(method, ...params) {
1274
- const message = create$t(method, params);
1275
+ const message = create$3(method, params);
1275
1276
  ipc.send(message);
1276
1277
  }
1277
1278
  };
1278
1279
  return rpc;
1279
1280
  };
1281
+
1280
1282
  const requiresSocket = () => {
1281
1283
  return false;
1282
1284
  };
@@ -1291,6 +1293,7 @@ const handleMessage = event => {
1291
1293
  const actualExecute = event?.target?.execute || execute;
1292
1294
  return handleJsonRpcMessage(event.target, event.data, actualExecute, event.target._resolve, preparePrettyError, logError, actualRequiresSocket);
1293
1295
  };
1296
+
1294
1297
  const handleIpc = ipc => {
1295
1298
  if ('addEventListener' in ipc) {
1296
1299
  ipc.addEventListener('message', handleMessage);
@@ -1299,7 +1302,8 @@ const handleIpc = ipc => {
1299
1302
  ipc.on('message', handleMessage);
1300
1303
  }
1301
1304
  };
1302
- const create$6 = async ({
1305
+
1306
+ const create = async ({
1303
1307
  argv,
1304
1308
  commandMap,
1305
1309
  env,
@@ -1326,10 +1330,6 @@ const create$6 = async ({
1326
1330
  // @ts-ignore
1327
1331
  return rpc;
1328
1332
  };
1329
- const NodeWorkerRpcParent = {
1330
- __proto__: null,
1331
- create: create$6
1332
- };
1333
1333
 
1334
1334
  const RunAllTests = 'RunAllTests';
1335
1335
 
@@ -1347,7 +1347,7 @@ const runAllTests = async ({
1347
1347
  }) => {
1348
1348
  // TODO use `using` once supported
1349
1349
  const path = fileURLToPath(testWorkerUri);
1350
- const rpc = await NodeWorkerRpcParent.create({
1350
+ const rpc = await create({
1351
1351
  argv: [],
1352
1352
  commandMap,
1353
1353
  path,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/test-with-playwright",
3
- "version": "14.2.0",
3
+ "version": "14.4.0",
4
4
  "description": "CLI tool for running Playwright tests",
5
5
  "repository": {
6
6
  "type": "git",
@@ -12,8 +12,8 @@
12
12
  "main": "dist/main.js",
13
13
  "bin": "bin/test-with-playwright.js",
14
14
  "dependencies": {
15
- "@lvce-editor/test-with-playwright-worker": "14.2.0",
16
- "@lvce-editor/test-worker": "^11.15.0"
15
+ "@lvce-editor/test-with-playwright-worker": "14.4.0",
16
+ "@lvce-editor/test-worker": "^13.0.0"
17
17
  },
18
18
  "engines": {
19
19
  "node": ">=24"