@lvce-editor/test-worker 14.16.0 → 14.18.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 +2 -1
- package/dist/testWorkerMain.js +305 -34
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -329,7 +329,8 @@ interface ChatDebug {
|
|
|
329
329
|
readonly setShowInputEvents: (enabled: boolean) => Promise<void>;
|
|
330
330
|
readonly setShowResponsePartEvents: (enabled: boolean) => Promise<void>;
|
|
331
331
|
readonly setTimelineRangePreset: (value: string) => Promise<void>;
|
|
332
|
-
readonly shouldHavePayload: (expectedPayload:
|
|
332
|
+
readonly shouldHavePayload: (expectedPayload: unknown) => Promise<void>;
|
|
333
|
+
readonly shouldHavePayload2: (expectedPayload: unknown) => Promise<void>;
|
|
333
334
|
readonly toggleHeadersSection: (sectionId: string) => Promise<void>;
|
|
334
335
|
readonly useDevtoolsLayout: () => Promise<void>;
|
|
335
336
|
}
|
package/dist/testWorkerMain.js
CHANGED
|
@@ -2147,6 +2147,51 @@ const Chat = {
|
|
|
2147
2147
|
useMockApi
|
|
2148
2148
|
};
|
|
2149
2149
|
|
|
2150
|
+
const isObject$3 = value => {
|
|
2151
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
2152
|
+
};
|
|
2153
|
+
const formatValue = value => {
|
|
2154
|
+
return JSON.stringify(value);
|
|
2155
|
+
};
|
|
2156
|
+
const assertArrayMatches = (actual, expected, path) => {
|
|
2157
|
+
if (!Array.isArray(actual)) {
|
|
2158
|
+
throw new TypeError(`Expected ${path} to be an array but got ${formatValue(actual)}`);
|
|
2159
|
+
}
|
|
2160
|
+
if (actual.length < expected.length) {
|
|
2161
|
+
throw new Error(`Expected ${path} to have at least ${expected.length} items but got ${actual.length}`);
|
|
2162
|
+
}
|
|
2163
|
+
for (let index = 0; index < expected.length; index++) {
|
|
2164
|
+
assertPayloadMatches(actual[index], expected[index], `${path}[${index}]`);
|
|
2165
|
+
}
|
|
2166
|
+
};
|
|
2167
|
+
const assertObjectMatches = (actual, expected, path) => {
|
|
2168
|
+
if (!isObject$3(actual)) {
|
|
2169
|
+
throw new TypeError(`Expected ${path} to be an object but got ${formatValue(actual)}`);
|
|
2170
|
+
}
|
|
2171
|
+
for (const key of Object.keys(expected)) {
|
|
2172
|
+
if (!Object.hasOwn(actual, key)) {
|
|
2173
|
+
throw new Error(`Expected ${path}.${key} to exist`);
|
|
2174
|
+
}
|
|
2175
|
+
assertPayloadMatches(actual[key], expected[key], `${path}.${key}`);
|
|
2176
|
+
}
|
|
2177
|
+
};
|
|
2178
|
+
const assertPrimitiveMatches = (actual, expected, path) => {
|
|
2179
|
+
if (!Object.is(actual, expected)) {
|
|
2180
|
+
throw new Error(`Expected ${path} to equal ${formatValue(expected)} but got ${formatValue(actual)}`);
|
|
2181
|
+
}
|
|
2182
|
+
};
|
|
2183
|
+
const assertPayloadMatches = (actual, expected, path) => {
|
|
2184
|
+
if (Array.isArray(expected)) {
|
|
2185
|
+
assertArrayMatches(actual, expected, path);
|
|
2186
|
+
return;
|
|
2187
|
+
}
|
|
2188
|
+
if (isObject$3(expected)) {
|
|
2189
|
+
assertObjectMatches(actual, expected, path);
|
|
2190
|
+
return;
|
|
2191
|
+
}
|
|
2192
|
+
assertPrimitiveMatches(actual, expected, path);
|
|
2193
|
+
};
|
|
2194
|
+
|
|
2150
2195
|
const defaultMessage = 'ChatDebug.shouldHavePayload assertion failed';
|
|
2151
2196
|
const getMessage = cause => {
|
|
2152
2197
|
if (!cause || typeof cause !== 'object') {
|
|
@@ -2224,6 +2269,14 @@ const shouldHavePayload = async expectedPayload => {
|
|
|
2224
2269
|
throw new ChatDebugShouldHavePayloadError(expectedPayload, actualPayload, error);
|
|
2225
2270
|
}
|
|
2226
2271
|
};
|
|
2272
|
+
const shouldHavePayload2 = async expectedPayload => {
|
|
2273
|
+
const actualPayload = await invoke('ChatDebug.getPayload');
|
|
2274
|
+
try {
|
|
2275
|
+
assertPayloadMatches(actualPayload, expectedPayload, 'payload');
|
|
2276
|
+
} catch (error) {
|
|
2277
|
+
throw new ChatDebugShouldHavePayloadError(expectedPayload, actualPayload, error);
|
|
2278
|
+
}
|
|
2279
|
+
};
|
|
2227
2280
|
const handleInput$7 = async (name, value, checked) => {
|
|
2228
2281
|
await invoke('ChatDebug.handleInput', name, value, checked);
|
|
2229
2282
|
};
|
|
@@ -2338,6 +2391,7 @@ const ChatDebug = {
|
|
|
2338
2391
|
setShowResponsePartEvents,
|
|
2339
2392
|
setTimelineRangePreset,
|
|
2340
2393
|
shouldHavePayload,
|
|
2394
|
+
shouldHavePayload2,
|
|
2341
2395
|
toggleHeadersSection,
|
|
2342
2396
|
useDevtoolsLayout
|
|
2343
2397
|
};
|
|
@@ -2473,7 +2527,7 @@ const directionMap = {
|
|
|
2473
2527
|
horizontal: 1,
|
|
2474
2528
|
vertical: 2
|
|
2475
2529
|
};
|
|
2476
|
-
const isObject$
|
|
2530
|
+
const isObject$2 = value => {
|
|
2477
2531
|
return typeof value === 'object' && value !== null && !Array.isArray(value) && !(value instanceof RegExp);
|
|
2478
2532
|
};
|
|
2479
2533
|
const matchesExpectedArray = (actual, expected) => {
|
|
@@ -2488,7 +2542,7 @@ const matchesExpectedArray = (actual, expected) => {
|
|
|
2488
2542
|
return true;
|
|
2489
2543
|
};
|
|
2490
2544
|
const matchesExpectedObject = (actual, expected) => {
|
|
2491
|
-
if (!isObject$
|
|
2545
|
+
if (!isObject$2(actual)) {
|
|
2492
2546
|
return false;
|
|
2493
2547
|
}
|
|
2494
2548
|
for (const [childKey, childExpectedValue] of Object.entries(expected)) {
|
|
@@ -2511,7 +2565,7 @@ const matchesExpected = (actual, expected, key = '') => {
|
|
|
2511
2565
|
if (Array.isArray(expected)) {
|
|
2512
2566
|
return matchesExpectedArray(actual, expected);
|
|
2513
2567
|
}
|
|
2514
|
-
if (isObject$
|
|
2568
|
+
if (isObject$2(expected)) {
|
|
2515
2569
|
return matchesExpectedObject(actual, expected);
|
|
2516
2570
|
}
|
|
2517
2571
|
return Object.is(actual, expected);
|
|
@@ -3576,11 +3630,11 @@ const getFileMapNode = async url => {
|
|
|
3576
3630
|
return fileMap;
|
|
3577
3631
|
};
|
|
3578
3632
|
|
|
3579
|
-
const isObject = value => {
|
|
3633
|
+
const isObject$1 = value => {
|
|
3580
3634
|
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
3581
3635
|
};
|
|
3582
3636
|
const isValidFileMap = value => {
|
|
3583
|
-
if (!isObject(value)) {
|
|
3637
|
+
if (!isObject$1(value)) {
|
|
3584
3638
|
return false;
|
|
3585
3639
|
}
|
|
3586
3640
|
for (const key in value) {
|
|
@@ -4890,6 +4944,22 @@ const formatDuration = duration => {
|
|
|
4890
4944
|
const Fail = 'fail';
|
|
4891
4945
|
const Pass = 'pass';
|
|
4892
4946
|
|
|
4947
|
+
const getAutoFixProperties = error => {
|
|
4948
|
+
const isChatDebugPayloadError = error instanceof ChatDebugShouldHavePayloadError && error.actualPayload !== undefined;
|
|
4949
|
+
const autoFixProperties = isChatDebugPayloadError ? {
|
|
4950
|
+
autoFixError: {
|
|
4951
|
+
actualPayload: error.actualPayload,
|
|
4952
|
+
code: error.code,
|
|
4953
|
+
expectedPayload: error.expectedPayload
|
|
4954
|
+
},
|
|
4955
|
+
overlayActions: [{
|
|
4956
|
+
command: 'Test.tryAutoFix',
|
|
4957
|
+
id: 'chat-debug-should-have-payload-autofix',
|
|
4958
|
+
label: 'Autofix'
|
|
4959
|
+
}]
|
|
4960
|
+
} : {};
|
|
4961
|
+
return autoFixProperties;
|
|
4962
|
+
};
|
|
4893
4963
|
const executeTest2 = async (name, fn, globals, timestampGenerator) => {
|
|
4894
4964
|
const getTimestamp = timestampGenerator;
|
|
4895
4965
|
const start = getTimestamp();
|
|
@@ -4898,19 +4968,7 @@ const executeTest2 = async (name, fn, globals, timestampGenerator) => {
|
|
|
4898
4968
|
const duration = end - start;
|
|
4899
4969
|
const formattedDuration = formatDuration(duration);
|
|
4900
4970
|
if (error) {
|
|
4901
|
-
const
|
|
4902
|
-
const autoFixProperties = isChatDebugPayloadError ? {
|
|
4903
|
-
autoFixError: {
|
|
4904
|
-
actualPayload: error.actualPayload,
|
|
4905
|
-
code: error.code,
|
|
4906
|
-
expectedPayload: error.expectedPayload
|
|
4907
|
-
},
|
|
4908
|
-
overlayActions: [{
|
|
4909
|
-
command: 'Test.tryAutoFix',
|
|
4910
|
-
id: 'chat-debug-should-have-payload-autofix',
|
|
4911
|
-
label: 'Autofix'
|
|
4912
|
-
}]
|
|
4913
|
-
} : {};
|
|
4971
|
+
const autoFixProperties = getAutoFixProperties(error);
|
|
4914
4972
|
return {
|
|
4915
4973
|
background: 'red',
|
|
4916
4974
|
duration,
|
|
@@ -5152,13 +5210,83 @@ const handleFileWatcherEvent = async event => {
|
|
|
5152
5210
|
};
|
|
5153
5211
|
|
|
5154
5212
|
const whitespaceRegex = /\s+/g;
|
|
5155
|
-
const
|
|
5213
|
+
const shouldHavePayloadSearch = 'shouldHavePayload(';
|
|
5214
|
+
const validIdentifierRegex = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
5156
5215
|
const normalizeWhitespace = value => {
|
|
5157
5216
|
return value.replaceAll(whitespaceRegex, '');
|
|
5158
5217
|
};
|
|
5159
|
-
const
|
|
5218
|
+
const isObject = value => {
|
|
5219
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
5220
|
+
};
|
|
5221
|
+
const projectActualOntoExpected = (actualValue, expectedValue) => {
|
|
5222
|
+
if (Array.isArray(expectedValue)) {
|
|
5223
|
+
if (!Array.isArray(actualValue)) {
|
|
5224
|
+
return actualValue;
|
|
5225
|
+
}
|
|
5226
|
+
const length = Math.min(expectedValue.length, actualValue.length);
|
|
5227
|
+
return actualValue.slice(0, length).map((item, index) => projectActualOntoExpected(item, expectedValue[index]));
|
|
5228
|
+
}
|
|
5229
|
+
if (isObject(expectedValue)) {
|
|
5230
|
+
if (!isObject(actualValue)) {
|
|
5231
|
+
return actualValue;
|
|
5232
|
+
}
|
|
5233
|
+
const result = {};
|
|
5234
|
+
for (const key of Object.keys(expectedValue)) {
|
|
5235
|
+
if (!Object.hasOwn(actualValue, key)) {
|
|
5236
|
+
continue;
|
|
5237
|
+
}
|
|
5238
|
+
result[key] = projectActualOntoExpected(actualValue[key], expectedValue[key]);
|
|
5239
|
+
}
|
|
5240
|
+
return result;
|
|
5241
|
+
}
|
|
5242
|
+
return actualValue;
|
|
5243
|
+
};
|
|
5244
|
+
const quoteString = value => {
|
|
5245
|
+
return `'${value.replaceAll('\\', '\\\\').replaceAll("'", "\\'").replaceAll('\n', '\\n').replaceAll('\r', '\\r').replaceAll('\t', '\\t')}'`;
|
|
5246
|
+
};
|
|
5247
|
+
const formatObjectKey = key => {
|
|
5248
|
+
if (validIdentifierRegex.test(key)) {
|
|
5249
|
+
return key;
|
|
5250
|
+
}
|
|
5251
|
+
return quoteString(key);
|
|
5252
|
+
};
|
|
5253
|
+
const trySerialize = (value, indent = 0) => {
|
|
5160
5254
|
try {
|
|
5161
|
-
|
|
5255
|
+
if (value === null) {
|
|
5256
|
+
return 'null';
|
|
5257
|
+
}
|
|
5258
|
+
if (typeof value === 'string') {
|
|
5259
|
+
return quoteString(value);
|
|
5260
|
+
}
|
|
5261
|
+
if (typeof value === 'number' || typeof value === 'boolean') {
|
|
5262
|
+
return JSON.stringify(value);
|
|
5263
|
+
}
|
|
5264
|
+
if (Array.isArray(value)) {
|
|
5265
|
+
if (value.length === 0) {
|
|
5266
|
+
return '[]';
|
|
5267
|
+
}
|
|
5268
|
+
const nextIndent = indent + 2;
|
|
5269
|
+
const serializedItems = value.map(item => `${' '.repeat(nextIndent)}${trySerialize(item, nextIndent)}`);
|
|
5270
|
+
return `[
|
|
5271
|
+
${serializedItems.join(',\n')}
|
|
5272
|
+
${' '.repeat(indent)}]`;
|
|
5273
|
+
}
|
|
5274
|
+
if (isObject(value)) {
|
|
5275
|
+
const entries = Object.entries(value);
|
|
5276
|
+
if (entries.length === 0) {
|
|
5277
|
+
return '{}';
|
|
5278
|
+
}
|
|
5279
|
+
const nextIndent = indent + 2;
|
|
5280
|
+
const serializedEntries = [];
|
|
5281
|
+
for (const entry of entries) {
|
|
5282
|
+
const [key, item] = entry;
|
|
5283
|
+
serializedEntries.push(`${' '.repeat(nextIndent)}${formatObjectKey(key)}: ${trySerialize(item, nextIndent)}`);
|
|
5284
|
+
}
|
|
5285
|
+
return `{
|
|
5286
|
+
${serializedEntries.join(',\n')}
|
|
5287
|
+
${' '.repeat(indent)}}`;
|
|
5288
|
+
}
|
|
5289
|
+
return undefined;
|
|
5162
5290
|
} catch {
|
|
5163
5291
|
return undefined;
|
|
5164
5292
|
}
|
|
@@ -5168,21 +5296,168 @@ const replaceMatch = (fileContent, index, length, replacement) => {
|
|
|
5168
5296
|
const after = fileContent.slice(index + length);
|
|
5169
5297
|
return `${before}${replacement}${after}`;
|
|
5170
5298
|
};
|
|
5299
|
+
const isStringDelimiter = character => {
|
|
5300
|
+
return character === "'" || character === '"' || character === '`';
|
|
5301
|
+
};
|
|
5302
|
+
const consumeComment = (inBlockComment, inLineComment, character, nextCharacter) => {
|
|
5303
|
+
if (inLineComment) {
|
|
5304
|
+
if (character === '\n') {
|
|
5305
|
+
return {
|
|
5306
|
+
consumed: 1,
|
|
5307
|
+
inBlockComment,
|
|
5308
|
+
inLineComment: false
|
|
5309
|
+
};
|
|
5310
|
+
}
|
|
5311
|
+
return {
|
|
5312
|
+
consumed: 1,
|
|
5313
|
+
inBlockComment,
|
|
5314
|
+
inLineComment
|
|
5315
|
+
};
|
|
5316
|
+
}
|
|
5317
|
+
if (inBlockComment) {
|
|
5318
|
+
if (character === '*' && nextCharacter === '/') {
|
|
5319
|
+
return {
|
|
5320
|
+
consumed: 2,
|
|
5321
|
+
inBlockComment: false,
|
|
5322
|
+
inLineComment
|
|
5323
|
+
};
|
|
5324
|
+
}
|
|
5325
|
+
return {
|
|
5326
|
+
consumed: 1,
|
|
5327
|
+
inBlockComment,
|
|
5328
|
+
inLineComment
|
|
5329
|
+
};
|
|
5330
|
+
}
|
|
5331
|
+
if (character === '/' && nextCharacter === '/') {
|
|
5332
|
+
return {
|
|
5333
|
+
consumed: 2,
|
|
5334
|
+
inBlockComment,
|
|
5335
|
+
inLineComment: true
|
|
5336
|
+
};
|
|
5337
|
+
}
|
|
5338
|
+
if (character === '/' && nextCharacter === '*') {
|
|
5339
|
+
return {
|
|
5340
|
+
consumed: 2,
|
|
5341
|
+
inBlockComment: true,
|
|
5342
|
+
inLineComment
|
|
5343
|
+
};
|
|
5344
|
+
}
|
|
5345
|
+
return {
|
|
5346
|
+
consumed: 0,
|
|
5347
|
+
inBlockComment,
|
|
5348
|
+
inLineComment
|
|
5349
|
+
};
|
|
5350
|
+
};
|
|
5351
|
+
const consumeString = (stringDelimiter, character) => {
|
|
5352
|
+
if (!stringDelimiter) {
|
|
5353
|
+
if (isStringDelimiter(character)) {
|
|
5354
|
+
return {
|
|
5355
|
+
consumed: 1,
|
|
5356
|
+
stringDelimiter: character
|
|
5357
|
+
};
|
|
5358
|
+
}
|
|
5359
|
+
return {
|
|
5360
|
+
consumed: 0,
|
|
5361
|
+
stringDelimiter
|
|
5362
|
+
};
|
|
5363
|
+
}
|
|
5364
|
+
if (character === '\\') {
|
|
5365
|
+
return {
|
|
5366
|
+
consumed: 2,
|
|
5367
|
+
stringDelimiter
|
|
5368
|
+
};
|
|
5369
|
+
}
|
|
5370
|
+
if (character === stringDelimiter) {
|
|
5371
|
+
return {
|
|
5372
|
+
consumed: 1,
|
|
5373
|
+
stringDelimiter: ''
|
|
5374
|
+
};
|
|
5375
|
+
}
|
|
5376
|
+
return {
|
|
5377
|
+
consumed: 1,
|
|
5378
|
+
stringDelimiter
|
|
5379
|
+
};
|
|
5380
|
+
};
|
|
5381
|
+
const findClosingParenthesis = (fileContent, startIndex) => {
|
|
5382
|
+
let depth = 1;
|
|
5383
|
+
let inBlockComment = false;
|
|
5384
|
+
let inLineComment = false;
|
|
5385
|
+
let stringDelimiter = '';
|
|
5386
|
+
for (let index = startIndex; index < fileContent.length;) {
|
|
5387
|
+
const character = fileContent[index];
|
|
5388
|
+
const nextCharacter = fileContent[index + 1];
|
|
5389
|
+
const stringState = consumeString(stringDelimiter, character);
|
|
5390
|
+
const {
|
|
5391
|
+
consumed: consumedString,
|
|
5392
|
+
stringDelimiter: nextStringDelimiter
|
|
5393
|
+
} = stringState;
|
|
5394
|
+
stringDelimiter = nextStringDelimiter;
|
|
5395
|
+
if (consumedString > 0) {
|
|
5396
|
+
index += consumedString;
|
|
5397
|
+
continue;
|
|
5398
|
+
}
|
|
5399
|
+
const commentState = consumeComment(inBlockComment, inLineComment, character, nextCharacter);
|
|
5400
|
+
const {
|
|
5401
|
+
consumed: consumedComment,
|
|
5402
|
+
inBlockComment: nextInBlockComment,
|
|
5403
|
+
inLineComment: nextInLineComment
|
|
5404
|
+
} = commentState;
|
|
5405
|
+
inBlockComment = nextInBlockComment;
|
|
5406
|
+
inLineComment = nextInLineComment;
|
|
5407
|
+
if (consumedComment > 0) {
|
|
5408
|
+
index += consumedComment;
|
|
5409
|
+
continue;
|
|
5410
|
+
}
|
|
5411
|
+
if (character === '(') {
|
|
5412
|
+
depth++;
|
|
5413
|
+
index++;
|
|
5414
|
+
continue;
|
|
5415
|
+
}
|
|
5416
|
+
if (character === ')') {
|
|
5417
|
+
depth--;
|
|
5418
|
+
if (depth === 0) {
|
|
5419
|
+
return index;
|
|
5420
|
+
}
|
|
5421
|
+
}
|
|
5422
|
+
index++;
|
|
5423
|
+
}
|
|
5424
|
+
return -1;
|
|
5425
|
+
};
|
|
5426
|
+
const findShouldHavePayloadMatches = fileContent => {
|
|
5427
|
+
const matches = [];
|
|
5428
|
+
let searchIndex = 0;
|
|
5429
|
+
while (searchIndex < fileContent.length) {
|
|
5430
|
+
const matchIndex = fileContent.indexOf(shouldHavePayloadSearch, searchIndex);
|
|
5431
|
+
if (matchIndex === -1) {
|
|
5432
|
+
break;
|
|
5433
|
+
}
|
|
5434
|
+
const argumentStart = matchIndex + shouldHavePayloadSearch.length;
|
|
5435
|
+
const closingParenthesisIndex = findClosingParenthesis(fileContent, argumentStart);
|
|
5436
|
+
if (closingParenthesisIndex === -1) {
|
|
5437
|
+
break;
|
|
5438
|
+
}
|
|
5439
|
+
matches.push({
|
|
5440
|
+
argument: fileContent.slice(argumentStart, closingParenthesisIndex),
|
|
5441
|
+
index: matchIndex,
|
|
5442
|
+
length: closingParenthesisIndex - matchIndex + 1
|
|
5443
|
+
});
|
|
5444
|
+
searchIndex = closingParenthesisIndex + 1;
|
|
5445
|
+
}
|
|
5446
|
+
return matches;
|
|
5447
|
+
};
|
|
5171
5448
|
const replaceShouldHavePayload = (fileContent, expectedPayload, actualPayload) => {
|
|
5172
|
-
const
|
|
5173
|
-
|
|
5449
|
+
const minimalPayload = projectActualOntoExpected(actualPayload, expectedPayload);
|
|
5450
|
+
const serializedMinimalPayload = trySerialize(minimalPayload);
|
|
5451
|
+
if (!serializedMinimalPayload) {
|
|
5174
5452
|
return undefined;
|
|
5175
5453
|
}
|
|
5176
|
-
const matches =
|
|
5454
|
+
const matches = findShouldHavePayloadMatches(fileContent);
|
|
5177
5455
|
if (matches.length === 0) {
|
|
5178
5456
|
return undefined;
|
|
5179
5457
|
}
|
|
5180
5458
|
if (matches.length === 1) {
|
|
5181
5459
|
const [match] = matches;
|
|
5182
|
-
|
|
5183
|
-
return undefined;
|
|
5184
|
-
}
|
|
5185
|
-
return replaceMatch(fileContent, match.index, match[0].length, `shouldHavePayload(${serializedActual})`);
|
|
5460
|
+
return replaceMatch(fileContent, match.index, match.length, `shouldHavePayload(${serializedMinimalPayload})`);
|
|
5186
5461
|
}
|
|
5187
5462
|
const serializedExpected = trySerialize(expectedPayload);
|
|
5188
5463
|
if (!serializedExpected) {
|
|
@@ -5191,8 +5466,7 @@ const replaceShouldHavePayload = (fileContent, expectedPayload, actualPayload) =
|
|
|
5191
5466
|
const normalizedExpected = normalizeWhitespace(serializedExpected);
|
|
5192
5467
|
const matchingCandidates = [];
|
|
5193
5468
|
for (const match of matches) {
|
|
5194
|
-
|
|
5195
|
-
if (normalizeWhitespace(currentArgument) === normalizedExpected) {
|
|
5469
|
+
if (normalizeWhitespace(match.argument) === normalizedExpected) {
|
|
5196
5470
|
matchingCandidates.push(match);
|
|
5197
5471
|
}
|
|
5198
5472
|
}
|
|
@@ -5200,10 +5474,7 @@ const replaceShouldHavePayload = (fileContent, expectedPayload, actualPayload) =
|
|
|
5200
5474
|
return undefined;
|
|
5201
5475
|
}
|
|
5202
5476
|
const [candidate] = matchingCandidates;
|
|
5203
|
-
|
|
5204
|
-
return undefined;
|
|
5205
|
-
}
|
|
5206
|
-
return replaceMatch(fileContent, candidate.index, candidate[0].length, `shouldHavePayload(${serializedActual})`);
|
|
5477
|
+
return replaceMatch(fileContent, candidate.index, candidate.length, `shouldHavePayload(${serializedMinimalPayload})`);
|
|
5207
5478
|
};
|
|
5208
5479
|
const getFileUrlFromRemotePath = rawPathName => {
|
|
5209
5480
|
if (!rawPathName.startsWith('/remote')) {
|