bitfab 0.36.10 → 0.36.12
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/{chunk-RSM2TLKG.js → chunk-OCJSHTJR.js} +24 -12
- package/dist/chunk-OCJSHTJR.js.map +1 -0
- package/dist/{chunk-AAMRJGZJ.js → chunk-VUYTATF5.js} +19 -9
- package/dist/chunk-VUYTATF5.js.map +1 -0
- package/dist/index.cjs +39 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/node.cjs +39 -17
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +2 -2
- package/dist/{replay-WKWBBIGE.js → replay-P35CUNGH.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-AAMRJGZJ.js.map +0 -1
- package/dist/chunk-RSM2TLKG.js.map +0 -1
- /package/dist/{replay-WKWBBIGE.js.map → replay-P35CUNGH.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -51,7 +51,7 @@ var __version__;
|
|
|
51
51
|
var init_version_generated = __esm({
|
|
52
52
|
"src/version.generated.ts"() {
|
|
53
53
|
"use strict";
|
|
54
|
-
__version__ = "0.36.
|
|
54
|
+
__version__ = "0.36.12";
|
|
55
55
|
}
|
|
56
56
|
});
|
|
57
57
|
|
|
@@ -2269,7 +2269,7 @@ async function captureCodeChangeFromGit(cwd, label) {
|
|
|
2269
2269
|
const tracked = await git(root, [
|
|
2270
2270
|
"diff",
|
|
2271
2271
|
"--name-status",
|
|
2272
|
-
"--
|
|
2272
|
+
"--find-renames",
|
|
2273
2273
|
"-z",
|
|
2274
2274
|
base,
|
|
2275
2275
|
"--",
|
|
@@ -2285,23 +2285,23 @@ async function captureCodeChangeFromGit(cwd, label) {
|
|
|
2285
2285
|
]);
|
|
2286
2286
|
const entries = [
|
|
2287
2287
|
...parseNameStatusZ(tracked ?? ""),
|
|
2288
|
-
...(untracked ?? "").split(NUL).filter((p) => p.length > 0).map((path) => ({ status: "A", path }))
|
|
2288
|
+
...(untracked ?? "").split(NUL).filter((p) => p.length > 0).map((path) => ({ status: "A", beforePath: path, path }))
|
|
2289
2289
|
];
|
|
2290
2290
|
if (entries.length === 0) {
|
|
2291
2291
|
return null;
|
|
2292
2292
|
}
|
|
2293
2293
|
const files = [];
|
|
2294
2294
|
let totalBytes = 0;
|
|
2295
|
-
for (const { status, path } of entries) {
|
|
2295
|
+
for (const { status, beforePath, path } of entries) {
|
|
2296
2296
|
if (files.length >= MAX_FILES) {
|
|
2297
2297
|
break;
|
|
2298
2298
|
}
|
|
2299
|
-
const beforeBytes = status === "A" ? 0 : await blobBytes(base,
|
|
2299
|
+
const beforeBytes = status === "A" ? 0 : await blobBytes(base, beforePath);
|
|
2300
2300
|
const afterBytes = status === "D" ? 0 : await workingBytes(path);
|
|
2301
2301
|
if (beforeBytes > MAX_FILE_BYTES || afterBytes > MAX_FILE_BYTES) {
|
|
2302
2302
|
continue;
|
|
2303
2303
|
}
|
|
2304
|
-
const before = (status === "A" ? "" : await git(root, ["show", `${base}:${
|
|
2304
|
+
const before = (status === "A" ? "" : await git(root, ["show", `${base}:${beforePath}`]) ?? "").replace(/\r\n/g, "\n");
|
|
2305
2305
|
const after = (status === "D" ? "" : await readWorkingFile(readFile, root, path)).replace(/\r\n/g, "\n");
|
|
2306
2306
|
if (before === after) {
|
|
2307
2307
|
continue;
|
|
@@ -2359,8 +2359,18 @@ async function readWorkingFile(readFile, root, path) {
|
|
|
2359
2359
|
function parseNameStatusZ(raw) {
|
|
2360
2360
|
const parts = raw.split(NUL).filter((p) => p.length > 0);
|
|
2361
2361
|
const out = [];
|
|
2362
|
-
|
|
2363
|
-
|
|
2362
|
+
let i = 0;
|
|
2363
|
+
while (i + 1 < parts.length) {
|
|
2364
|
+
const status = parts[i].charAt(0);
|
|
2365
|
+
i += 1;
|
|
2366
|
+
const beforePath = parts[i];
|
|
2367
|
+
i += 1;
|
|
2368
|
+
if ((status === "R" || status === "C") && i < parts.length) {
|
|
2369
|
+
out.push({ status, beforePath, path: parts[i] });
|
|
2370
|
+
i += 1;
|
|
2371
|
+
} else {
|
|
2372
|
+
out.push({ status, beforePath, path: beforePath });
|
|
2373
|
+
}
|
|
2364
2374
|
}
|
|
2365
2375
|
return out;
|
|
2366
2376
|
}
|
|
@@ -6100,14 +6110,19 @@ var Bitfab = class {
|
|
|
6100
6110
|
counters.set(counterKey, callIndex + 1);
|
|
6101
6111
|
const mockKey = `${counterKey}:${callIndex}`;
|
|
6102
6112
|
const mockSpan = replayCtxForMock.mockTree.spans.get(mockKey);
|
|
6103
|
-
const emitMock = (output) => {
|
|
6104
|
-
void sendSpan({
|
|
6113
|
+
const emitMock = (output, mockSource) => {
|
|
6114
|
+
void sendSpan({
|
|
6115
|
+
result: output,
|
|
6116
|
+
mocked: true,
|
|
6117
|
+
mockTarget: "output",
|
|
6118
|
+
mockSource
|
|
6119
|
+
});
|
|
6105
6120
|
if (fnReturnsPromise) {
|
|
6106
6121
|
return Promise.resolve(output);
|
|
6107
6122
|
}
|
|
6108
6123
|
return output;
|
|
6109
6124
|
};
|
|
6110
|
-
const emitMockAsync = (pending) => {
|
|
6125
|
+
const emitMockAsync = (pending, mockSource) => {
|
|
6111
6126
|
if (!fnReturnsPromise) {
|
|
6112
6127
|
throw new BitfabError(
|
|
6113
6128
|
`Cannot mock synchronous span "${traceFunctionKey}" with an asynchronously-resolved value (lazy recorded-output fetch or an async value function). Make the wrapped function async, or use mock: "all" so recorded outputs are fetched eagerly.`
|
|
@@ -6115,7 +6130,12 @@ var Bitfab = class {
|
|
|
6115
6130
|
}
|
|
6116
6131
|
return (async () => {
|
|
6117
6132
|
const output = await pending;
|
|
6118
|
-
void sendSpan({
|
|
6133
|
+
void sendSpan({
|
|
6134
|
+
result: output,
|
|
6135
|
+
mocked: true,
|
|
6136
|
+
mockTarget: "output",
|
|
6137
|
+
mockSource
|
|
6138
|
+
});
|
|
6119
6139
|
return output;
|
|
6120
6140
|
})();
|
|
6121
6141
|
};
|
|
@@ -6157,18 +6177,18 @@ var Bitfab = class {
|
|
|
6157
6177
|
getOriginalOutput: () => Promise.resolve(resolveRecordedOutput())
|
|
6158
6178
|
});
|
|
6159
6179
|
if (injected instanceof Promise) {
|
|
6160
|
-
return emitMockAsync(injected);
|
|
6180
|
+
return emitMockAsync(injected, "override");
|
|
6161
6181
|
}
|
|
6162
|
-
return emitMock(injected);
|
|
6182
|
+
return emitMock(injected, "override");
|
|
6163
6183
|
}
|
|
6164
6184
|
}
|
|
6165
6185
|
const shouldMock = replayCtxForMock.mockStrategy === "all" || replayCtxForMock.mockStrategy === "marked" && options.mockOnReplay === true;
|
|
6166
6186
|
if (shouldMock && mockSpan) {
|
|
6167
6187
|
const recorded = resolveRecordedOutput();
|
|
6168
6188
|
if (recorded instanceof Promise) {
|
|
6169
|
-
return emitMockAsync(recorded);
|
|
6189
|
+
return emitMockAsync(recorded, "recorded");
|
|
6170
6190
|
}
|
|
6171
|
-
return emitMock(recorded);
|
|
6191
|
+
return emitMock(recorded, "recorded");
|
|
6172
6192
|
}
|
|
6173
6193
|
}
|
|
6174
6194
|
const recordSpan = (result) => {
|
|
@@ -6468,7 +6488,9 @@ var Bitfab = class {
|
|
|
6468
6488
|
traceFunctionKey: params.traceFunctionKey,
|
|
6469
6489
|
rawSpan: externalSpan,
|
|
6470
6490
|
...params.testRunId && { testRunId: params.testRunId },
|
|
6471
|
-
...params.mocked && { mocked: true }
|
|
6491
|
+
...params.mocked && { mocked: true },
|
|
6492
|
+
...params.mockTarget && { mockTarget: params.mockTarget },
|
|
6493
|
+
...params.mockSource && { mockSource: params.mockSource }
|
|
6472
6494
|
});
|
|
6473
6495
|
}
|
|
6474
6496
|
registerMockOverride(overrideOrMatch, value) {
|