flakiness 0.219.0 → 0.220.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/lib/cli/cli.js CHANGED
@@ -1028,7 +1028,7 @@ import path7 from "path";
1028
1028
  // ../package.json
1029
1029
  var package_default = {
1030
1030
  name: "@flakiness/monorepo",
1031
- version: "0.219.0",
1031
+ version: "0.220.0",
1032
1032
  type: "module",
1033
1033
  private: true,
1034
1034
  scripts: {
@@ -1519,6 +1519,35 @@ import assert from "assert";
1519
1519
  import fs2 from "fs";
1520
1520
  import mime from "mime";
1521
1521
  import path2 from "path";
1522
+ import { Temporal } from "temporal-polyfill";
1523
+ var gTZAbbreviationToIANATimezone;
1524
+ function tzAbbreviationToIANA(tz) {
1525
+ if (!gTZAbbreviationToIANATimezone) {
1526
+ gTZAbbreviationToIANATimezone = /* @__PURE__ */ new Map();
1527
+ const probes = [/* @__PURE__ */ new Date("2026-06-15T12:00:00Z"), /* @__PURE__ */ new Date("2026-01-15T12:00:00Z")];
1528
+ for (const tz2 of Intl.supportedValuesOf("timeZone")) {
1529
+ for (const date of probes) {
1530
+ const parts = new Intl.DateTimeFormat("en-US", { timeZone: tz2, timeZoneName: "short" }).formatToParts(date);
1531
+ const abbr = parts.find((p) => p.type === "timeZoneName")?.value;
1532
+ if (abbr)
1533
+ gTZAbbreviationToIANATimezone.set(abbr, tz2);
1534
+ }
1535
+ }
1536
+ }
1537
+ return gTZAbbreviationToIANATimezone.get(tz);
1538
+ }
1539
+ function parseTimestamp(timestamp) {
1540
+ const native = new Date(timestamp).getTime();
1541
+ if (!isNaN(native))
1542
+ return native;
1543
+ const parts = timestamp.split(/\s+/);
1544
+ const iana = parts.length === 2 ? tzAbbreviationToIANA(parts[1]) : void 0;
1545
+ if (iana) {
1546
+ const d = Temporal.PlainDateTime.from(parts[0]);
1547
+ return d.toZonedDateTime(iana).epochMilliseconds;
1548
+ }
1549
+ throw new Error(`failed to parse timestamp: ${timestamp}`);
1550
+ }
1522
1551
  function getProperties(element) {
1523
1552
  const propertiesNodes = element.children.filter((node) => node instanceof XmlElement).filter((node) => node.name === "properties");
1524
1553
  if (!propertiesNodes.length)
@@ -1583,7 +1612,7 @@ async function traverseJUnitReport(context, node) {
1583
1612
  return;
1584
1613
  let { currentEnv, currentEnvIndex, currentSuite, report, currentTimeMs } = context;
1585
1614
  if (element.attributes["timestamp"])
1586
- currentTimeMs = new Date(element.attributes["timestamp"]).getTime();
1615
+ currentTimeMs = parseTimestamp(element.attributes["timestamp"]);
1587
1616
  if (element.name === "testsuite") {
1588
1617
  const file = element.attributes["file"];
1589
1618
  const line = parseInt(element.attributes["line"], 10);
@@ -1607,12 +1636,12 @@ async function traverseJUnitReport(context, node) {
1607
1636
  report.suites.push(newSuite);
1608
1637
  }
1609
1638
  currentSuite = newSuite;
1610
- const userSuppliedData = getProperties(element);
1611
- if (userSuppliedData.length) {
1639
+ const metadata = getProperties(element);
1640
+ if (metadata.length) {
1612
1641
  currentEnv = structuredClone(currentEnv);
1613
- currentEnv.userSuppliedData ??= {};
1614
- for (const [key, value] of userSuppliedData)
1615
- currentEnv.userSuppliedData[key] = value;
1642
+ currentEnv.metadata ??= {};
1643
+ for (const [key, value] of metadata)
1644
+ currentEnv.metadata[key] = value;
1616
1645
  currentEnvIndex = report.environments.push(currentEnv) - 1;
1617
1646
  }
1618
1647
  } else if (element.name === "testcase") {
package/lib/junit.js CHANGED
@@ -6,6 +6,35 @@ import assert from "assert";
6
6
  import fs from "fs";
7
7
  import mime from "mime";
8
8
  import path from "path";
9
+ import { Temporal } from "temporal-polyfill";
10
+ var gTZAbbreviationToIANATimezone;
11
+ function tzAbbreviationToIANA(tz) {
12
+ if (!gTZAbbreviationToIANATimezone) {
13
+ gTZAbbreviationToIANATimezone = /* @__PURE__ */ new Map();
14
+ const probes = [/* @__PURE__ */ new Date("2026-06-15T12:00:00Z"), /* @__PURE__ */ new Date("2026-01-15T12:00:00Z")];
15
+ for (const tz2 of Intl.supportedValuesOf("timeZone")) {
16
+ for (const date of probes) {
17
+ const parts = new Intl.DateTimeFormat("en-US", { timeZone: tz2, timeZoneName: "short" }).formatToParts(date);
18
+ const abbr = parts.find((p) => p.type === "timeZoneName")?.value;
19
+ if (abbr)
20
+ gTZAbbreviationToIANATimezone.set(abbr, tz2);
21
+ }
22
+ }
23
+ }
24
+ return gTZAbbreviationToIANATimezone.get(tz);
25
+ }
26
+ function parseTimestamp(timestamp) {
27
+ const native = new Date(timestamp).getTime();
28
+ if (!isNaN(native))
29
+ return native;
30
+ const parts = timestamp.split(/\s+/);
31
+ const iana = parts.length === 2 ? tzAbbreviationToIANA(parts[1]) : void 0;
32
+ if (iana) {
33
+ const d = Temporal.PlainDateTime.from(parts[0]);
34
+ return d.toZonedDateTime(iana).epochMilliseconds;
35
+ }
36
+ throw new Error(`failed to parse timestamp: ${timestamp}`);
37
+ }
9
38
  function getProperties(element) {
10
39
  const propertiesNodes = element.children.filter((node) => node instanceof XmlElement).filter((node) => node.name === "properties");
11
40
  if (!propertiesNodes.length)
@@ -70,7 +99,7 @@ async function traverseJUnitReport(context, node) {
70
99
  return;
71
100
  let { currentEnv, currentEnvIndex, currentSuite, report, currentTimeMs } = context;
72
101
  if (element.attributes["timestamp"])
73
- currentTimeMs = new Date(element.attributes["timestamp"]).getTime();
102
+ currentTimeMs = parseTimestamp(element.attributes["timestamp"]);
74
103
  if (element.name === "testsuite") {
75
104
  const file = element.attributes["file"];
76
105
  const line = parseInt(element.attributes["line"], 10);
@@ -94,12 +123,12 @@ async function traverseJUnitReport(context, node) {
94
123
  report.suites.push(newSuite);
95
124
  }
96
125
  currentSuite = newSuite;
97
- const userSuppliedData = getProperties(element);
98
- if (userSuppliedData.length) {
126
+ const metadata = getProperties(element);
127
+ if (metadata.length) {
99
128
  currentEnv = structuredClone(currentEnv);
100
- currentEnv.userSuppliedData ??= {};
101
- for (const [key, value] of userSuppliedData)
102
- currentEnv.userSuppliedData[key] = value;
129
+ currentEnv.metadata ??= {};
130
+ for (const [key, value] of metadata)
131
+ currentEnv.metadata[key] = value;
103
132
  currentEnvIndex = report.environments.push(currentEnv) - 1;
104
133
  }
105
134
  } else if (element.name === "testcase") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flakiness",
3
- "version": "0.219.0",
3
+ "version": "0.220.0",
4
4
  "private": false,
5
5
  "bin": {
6
6
  "flakiness": "./lib/cli/cli.js"
@@ -23,8 +23,8 @@
23
23
  "@types/debug": "^4.1.12",
24
24
  "@types/express": "^4.17.20",
25
25
  "gray-matter": "^4.0.3",
26
- "@flakiness/shared": "0.219.0",
27
- "@flakiness/server": "0.219.0"
26
+ "@flakiness/shared": "0.220.0",
27
+ "@flakiness/server": "0.220.0"
28
28
  },
29
29
  "dependencies": {
30
30
  "@flakiness/flakiness-report": "^0.28.0",
@@ -35,9 +35,11 @@
35
35
  "debug": "^4.4.3",
36
36
  "mime": "^4.1.0",
37
37
  "open": "^10.2.0",
38
- "ora": "^8.2.0"
38
+ "ora": "^8.2.0",
39
+ "temporal-polyfill": "^0.3.0"
39
40
  },
40
41
  "scripts": {
42
+ "test": "pnpm playwright test",
41
43
  "build:all": "pnpm build:win && pnpm build:linux && pnpm build:mac && pnpm build:alpine && pnpm build:mac_intel",
42
44
  "build:win": "bun build ./lib/cli/cli.js --compile --minify --target=bun-windows-x64 --outfile dist/flakiness-win-x64.exe",
43
45
  "build:linux": "bun build ./lib/cli/cli.js --compile --minify --target=bun-linux-x64 --outfile dist/flakiness-linux-x64",