bitfab 0.28.5 → 0.28.6

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
@@ -624,11 +624,35 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
624
624
  }
625
625
  }
626
626
  }
627
- return {
627
+ const replayResult = {
628
628
  items: resultItems,
629
629
  testRunId,
630
630
  testRunUrl: `${serviceUrl}${testRunUrl}`
631
631
  };
632
+ await writeReplayResultFile(replayResult);
633
+ return replayResult;
634
+ }
635
+ async function writeReplayResultFile(result) {
636
+ const resultPath = typeof process !== "undefined" ? process.env?.BITFAB_REPLAY_RESULT_PATH : void 0;
637
+ if (!resultPath) {
638
+ return;
639
+ }
640
+ try {
641
+ const [{ dirname }, { mkdir, writeFile }] = await Promise.all([
642
+ import("path"),
643
+ import("fs/promises")
644
+ ]);
645
+ await mkdir(dirname(resultPath), { recursive: true });
646
+ await writeFile(resultPath, `${JSON.stringify(result, null, 2)}
647
+ `);
648
+ } catch (err) {
649
+ try {
650
+ console.warn(
651
+ `Bitfab: failed to write replay result to BITFAB_REPLAY_RESULT_PATH (${resultPath}): ${err instanceof Error ? err.message : String(err)}`
652
+ );
653
+ } catch {
654
+ }
655
+ }
632
656
  }
633
657
  var BITFAB_PROGRESS_PREFIX;
634
658
  var init_replay = __esm({
@@ -668,7 +692,7 @@ __export(index_exports, {
668
692
  module.exports = __toCommonJS(index_exports);
669
693
 
670
694
  // src/version.generated.ts
671
- var __version__ = "0.28.5";
695
+ var __version__ = "0.28.6";
672
696
 
673
697
  // src/constants.ts
674
698
  var DEFAULT_SERVICE_URL = "https://bitfab.ai";