@checkly/playwright-reporter 1.0.1 → 1.0.2

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/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ All notable changes to `@checkly/playwright-reporter` will be documented in this
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
6
 
7
+ ## 1.0.2 (2026-01-19)
8
+
9
+ ### Fixed
10
+
11
+ - Test session creation is now properly awaited before uploading results, fixing intermittent upload failures in CI environments.
12
+
7
13
  ## 1.0.1 (2026-01-19)
8
14
 
9
15
  ### Fixed
package/dist/index.js CHANGED
@@ -1598,6 +1598,7 @@ function checklyUpload(options = {}) {
1598
1598
  }
1599
1599
  let api;
1600
1600
  let testSession;
1601
+ let sessionCreationPromise;
1601
1602
  let startTime;
1602
1603
  let resolvedOutputDir;
1603
1604
  let assetCollector;
@@ -1616,6 +1617,26 @@ function checklyUpload(options = {}) {
1616
1617
  if (typeof sessionName === "string") return sessionName;
1617
1618
  return `Playwright Test Session: ${ctx.directoryName}`;
1618
1619
  }
1620
+ async function createSession(config, suite, log) {
1621
+ if (!api) return;
1622
+ try {
1623
+ const directoryName = getDirectoryName();
1624
+ const sessionName = resolveSessionName({ directoryName, config, suite });
1625
+ const repoInfo = getGitHubRepoInfo();
1626
+ log("\u{1F517} Creating test session", { name: sessionName, environment });
1627
+ testSession = await api.testSessions.create({
1628
+ name: sessionName,
1629
+ environment: process.env.NODE_ENV || "test",
1630
+ repoInfo,
1631
+ startedAt: startTime.getTime(),
1632
+ testResults: [{ name: directoryName }],
1633
+ provider: "PW_REPORTER"
1634
+ });
1635
+ log("\u2705 Session created", { id: testSession.testSessionId });
1636
+ } catch (err2) {
1637
+ console.error("[Checkly] Failed to create test session:", err2);
1638
+ }
1639
+ }
1619
1640
  function checkTraceAttachment(test, result) {
1620
1641
  const key = `${test.id}:${result.retry}`;
1621
1642
  const traceAttachment = result.attachments?.find((a) => a.name === "trace" || a.contentType === "application/zip");
@@ -1740,7 +1761,7 @@ function checklyUpload(options = {}) {
1740
1761
  }
1741
1762
  return {
1742
1763
  name: "checkly-upload",
1743
- onBegin: async ({ config, suite, log }) => {
1764
+ onBegin: ({ config, suite, log }) => {
1744
1765
  startTime = /* @__PURE__ */ new Date();
1745
1766
  resolvedOutputDir = options.outputDir ?? options.testResultsDir ?? config.projects[0]?.outputDir ?? "test-results";
1746
1767
  const zipPath = options.outputPath ?? path3.join(resolvedOutputDir, "checkly-report.zip");
@@ -1752,23 +1773,7 @@ function checklyUpload(options = {}) {
1752
1773
  }
1753
1774
  return;
1754
1775
  }
1755
- try {
1756
- const directoryName = getDirectoryName();
1757
- const sessionName = resolveSessionName({ directoryName, config, suite });
1758
- const repoInfo = getGitHubRepoInfo();
1759
- log("\u{1F517} Creating test session", { name: sessionName, environment });
1760
- testSession = await api.testSessions.create({
1761
- name: sessionName,
1762
- environment: process.env.NODE_ENV || "test",
1763
- repoInfo,
1764
- startedAt: startTime.getTime(),
1765
- testResults: [{ name: directoryName }],
1766
- provider: "PW_REPORTER"
1767
- });
1768
- log("\u2705 Session created", { id: testSession.testSessionId });
1769
- } catch (err2) {
1770
- console.error("[Checkly] Failed to create test session:", err2);
1771
- }
1776
+ sessionCreationPromise = createSession(config, suite, log);
1772
1777
  },
1773
1778
  onTestEnd: ({ test, result }) => {
1774
1779
  checkTraceAttachment(test, result);
@@ -1786,6 +1791,9 @@ function checklyUpload(options = {}) {
1786
1791
  },
1787
1792
  onEnd: async ({ report, log, addSummaryLine }) => {
1788
1793
  try {
1794
+ if (sessionCreationPromise) {
1795
+ await sessionCreationPromise;
1796
+ }
1789
1797
  await extractDataFromTraces(log);
1790
1798
  injectDataIntoReport(report);
1791
1799
  fs4.mkdirSync(resolvedOutputDir, { recursive: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkly/playwright-reporter",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Standalone Playwright reporter for Checkly - compatible with Playwright 1.40-1.57+",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -36,7 +36,7 @@
36
36
  "tsup": "8.5.1",
37
37
  "tsx": "4.19.0",
38
38
  "typescript": "5.9.3",
39
- "@checkly/reporter-utils": "1.0.1"
39
+ "@checkly/reporter-utils": "1.0.2"
40
40
  },
41
41
  "scripts": {
42
42
  "build": "tsup",