@flakiness/sdk 3.1.0 → 3.2.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/README.md
CHANGED
|
@@ -91,6 +91,7 @@ Use this entry point when you need to process or manipulate reports in browser-b
|
|
|
91
91
|
- **`GitWorktree`** - Git repository utilities for path conversion and commit information
|
|
92
92
|
- **`ReportUtils`** - Namespace with utilities for report creation and manipulation:
|
|
93
93
|
- `createEnvironment()` - Create environment objects with system information
|
|
94
|
+
- `detectRuntime()` - Detect the JS runtime (`node` / `bun` / `deno`) and its version; suitable for `Report.runtime`
|
|
94
95
|
- `normalizeReport()` - Deduplicate environments, suites, and tests
|
|
95
96
|
- `collectSources()` - Extract source code snippets for locations in the report
|
|
96
97
|
- `stripAnsi()` - Remove ANSI escape codes from strings
|
package/lib/index.js
CHANGED
|
@@ -531,6 +531,7 @@ __export(reportUtils_exports, {
|
|
|
531
531
|
createDataAttachment: () => createDataAttachment,
|
|
532
532
|
createEnvironment: () => createEnvironment,
|
|
533
533
|
createFileAttachment: () => createFileAttachment,
|
|
534
|
+
detectRuntime: () => detectRuntime,
|
|
534
535
|
normalizeReport: () => normalizeReport,
|
|
535
536
|
stripAnsi: () => stripAnsi,
|
|
536
537
|
validateReport: () => validateReport,
|
|
@@ -680,6 +681,18 @@ function createEnvironment(options) {
|
|
|
680
681
|
};
|
|
681
682
|
}
|
|
682
683
|
|
|
684
|
+
// src/detectRuntime.ts
|
|
685
|
+
function detectRuntime() {
|
|
686
|
+
const g = globalThis;
|
|
687
|
+
if (g.Bun?.version)
|
|
688
|
+
return { name: "bun", version: g.Bun.version };
|
|
689
|
+
if (g.Deno?.version?.deno)
|
|
690
|
+
return { name: "deno", version: g.Deno.version.deno };
|
|
691
|
+
if (g.process?.versions?.node)
|
|
692
|
+
return { name: "node", version: g.process.versions.node };
|
|
693
|
+
return void 0;
|
|
694
|
+
}
|
|
695
|
+
|
|
683
696
|
// src/normalizeReport.ts
|
|
684
697
|
import { FlakinessReport } from "@flakiness/flakiness-report";
|
|
685
698
|
import stableObjectHash from "stable-hash";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flakiness/sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"node": "^20.17.0 || >=22.9.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@flakiness/flakiness-report": "^0.
|
|
31
|
+
"@flakiness/flakiness-report": "^0.34.0",
|
|
32
32
|
"@flakiness/playwright": "^1.3.3",
|
|
33
33
|
"@playwright/test": "^1.58.2",
|
|
34
34
|
"@types/debug": "^4.1.12",
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FlakinessReport } from '@flakiness/flakiness-report';
|
|
2
|
+
/**
|
|
3
|
+
* Detects the JavaScript runtime executing the current process.
|
|
4
|
+
*
|
|
5
|
+
* Returns the runtime name (`bun`, `deno`, `node`) and its version, suitable for
|
|
6
|
+
* use as `FlakinessReport.Report.runtime`. Bun and Deno expose Node-compat
|
|
7
|
+
* versions on `process.versions.node`, so this probes their globals first to
|
|
8
|
+
* avoid mis-identifying them as Node.
|
|
9
|
+
*
|
|
10
|
+
* @returns {FlakinessReport.Report['runtime']} The detected runtime, or `undefined` if no
|
|
11
|
+
* supported runtime is recognized (e.g., browser environments).
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const report = ReportUtils.normalizeReport({
|
|
16
|
+
* // ...
|
|
17
|
+
* runtime: ReportUtils.detectRuntime(),
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare function detectRuntime(): FlakinessReport.Report['runtime'];
|
|
22
|
+
//# sourceMappingURL=detectRuntime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detectRuntime.d.ts","sourceRoot":"","sources":["../../src/detectRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,aAAa,IAAI,eAAe,CAAC,MAAM,CAAC,SAAS,CAAC,CAgBjE"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { collectSources } from './collectSources.js';
|
|
2
2
|
export { createEnvironment } from './createEnvironment.js';
|
|
3
|
+
export { detectRuntime } from './detectRuntime.js';
|
|
3
4
|
export { normalizeReport } from './normalizeReport.js';
|
|
4
5
|
export { validateReport } from './validateReport.js';
|
|
5
6
|
export { stripAnsi } from './stripAnsi.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reportUtils.d.ts","sourceRoot":"","sources":["../../src/reportUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,UAAU,EAAE,cAAc,EAC1B,cAAc,EACf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"reportUtils.d.ts","sourceRoot":"","sources":["../../src/reportUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,UAAU,EAAE,cAAc,EAC1B,cAAc,EACf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
|