bitfab 0.36.12 → 0.36.13

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/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.12";
54
+ __version__ = "0.36.13";
55
55
  }
56
56
  });
57
57
 
@@ -2595,20 +2595,17 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
2595
2595
  includeOutputs,
2596
2596
  includeRootOutput: false
2597
2597
  });
2598
- if (treeResponse.root) {
2599
- mockTree = buildMockTree(treeResponse.root);
2600
- } else if (mockStrategy === "all" || hasOverrides) {
2598
+ if (!treeResponse.root) {
2601
2599
  throw new BitfabError(
2602
2600
  `Replay mock strategy "${mockStrategy}"${hasOverrides ? " with overrides" : ""} requires a span tree root for original span ${originalSpanId}.`
2603
2601
  );
2604
- } else {
2605
- mockTree = void 0;
2606
2602
  }
2607
- } catch (e) {
2608
- if (mockStrategy === "all" || hasOverrides) {
2609
- throw e;
2603
+ mockTree = buildMockTree(treeResponse.root);
2604
+ } catch (error2) {
2605
+ if (mockStrategy !== "marked" || hasOverrides) {
2606
+ throw error2;
2610
2607
  }
2611
- mockTree = void 0;
2608
+ mockTree = { spans: /* @__PURE__ */ new Map() };
2612
2609
  }
2613
2610
  }
2614
2611
  const outputCache = /* @__PURE__ */ new Map();
@@ -6183,7 +6180,12 @@ var Bitfab = class {
6183
6180
  }
6184
6181
  }
6185
6182
  const shouldMock = replayCtxForMock.mockStrategy === "all" || replayCtxForMock.mockStrategy === "marked" && options.mockOnReplay === true;
6186
- if (shouldMock && mockSpan) {
6183
+ if (shouldMock && !mockSpan) {
6184
+ throw new BitfabError(
6185
+ `Replay selected span "${traceFunctionKey}:${baseSpanParams.spanName}" for mocking, but recorded occurrence ${callIndex + 1} is unavailable. The real span was not executed.`
6186
+ );
6187
+ }
6188
+ if (shouldMock) {
6187
6189
  const recorded = resolveRecordedOutput();
6188
6190
  if (recorded instanceof Promise) {
6189
6191
  return emitMockAsync(recorded, "recorded");