@stanterprise/playwright-reporter 0.0.0-debug-flag-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/LICENSE +15 -0
- package/README.md +472 -0
- package/dist/client/grpcClient.d.ts +10 -0
- package/dist/client/grpcClient.js +158 -0
- package/dist/handlers/index.d.ts +9 -0
- package/dist/handlers/index.js +19 -0
- package/dist/handlers/onBeginHandler.d.ts +5 -0
- package/dist/handlers/onBeginHandler.js +96 -0
- package/dist/handlers/onEndHandler.d.ts +4 -0
- package/dist/handlers/onEndHandler.js +51 -0
- package/dist/handlers/onErrorHandler.d.ts +4 -0
- package/dist/handlers/onErrorHandler.js +15 -0
- package/dist/handlers/onStepBeginHandler.d.ts +4 -0
- package/dist/handlers/onStepBeginHandler.js +38 -0
- package/dist/handlers/onStepEndHandler.d.ts +4 -0
- package/dist/handlers/onStepEndHandler.js +59 -0
- package/dist/handlers/onTestBeginHandler.d.ts +4 -0
- package/dist/handlers/onTestBeginHandler.js +32 -0
- package/dist/handlers/onTestEndHandler.d.ts +4 -0
- package/dist/handlers/onTestEndHandler.js +57 -0
- package/dist/handlers/onTestFailHandler.d.ts +4 -0
- package/dist/handlers/onTestFailHandler.js +24 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +10 -0
- package/dist/reporter.d.ts +22 -0
- package/dist/reporter.js +149 -0
- package/dist/types.d.ts +94 -0
- package/dist/types.js +5 -0
- package/dist/utils/attachmentProcessor.d.ts +21 -0
- package/dist/utils/attachmentProcessor.js +73 -0
- package/dist/utils/debugLogger.d.ts +13 -0
- package/dist/utils/debugLogger.js +75 -0
- package/dist/utils/envRetriever.d.ts +9 -0
- package/dist/utils/envRetriever.js +23 -0
- package/dist/utils/idGenerators.d.ts +20 -0
- package/dist/utils/idGenerators.js +40 -0
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/index.js +26 -0
- package/dist/utils/metadataHelpers.d.ts +42 -0
- package/dist/utils/metadataHelpers.js +91 -0
- package/dist/utils/optionsMapper.d.ts +7 -0
- package/dist/utils/optionsMapper.js +31 -0
- package/dist/utils/statusMapper.d.ts +12 -0
- package/dist/utils/statusMapper.js +29 -0
- package/dist/utils/timeHelpers.d.ts +26 -0
- package/dist/utils/timeHelpers.js +61 -0
- package/package.json +58 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createTimestamp = createTimestamp;
|
|
4
|
+
exports.createTimestampFromMs = createTimestampFromMs;
|
|
5
|
+
exports.createDuration = createDuration;
|
|
6
|
+
/**
|
|
7
|
+
* Utility functions for creating timestamps and durations
|
|
8
|
+
*/
|
|
9
|
+
const protobuf_1 = require("@stanterprise/protobuf");
|
|
10
|
+
const Timestamp = protobuf_1.google.google.protobuf.Timestamp;
|
|
11
|
+
/**
|
|
12
|
+
* Create a protobuf Timestamp from a JavaScript Date
|
|
13
|
+
*/
|
|
14
|
+
function createTimestamp(date) {
|
|
15
|
+
const ms = date.getTime();
|
|
16
|
+
// Validate to prevent NaN from causing protobuf serialization failures
|
|
17
|
+
if (isNaN(ms)) {
|
|
18
|
+
throw new Error(`Invalid date provided to createTimestamp: ${date.toString()}`);
|
|
19
|
+
}
|
|
20
|
+
return new Timestamp({
|
|
21
|
+
seconds: Math.floor(ms / 1000),
|
|
22
|
+
nanos: Math.floor((ms % 1000) * 1000000),
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Create a protobuf Timestamp from milliseconds since epoch
|
|
27
|
+
*/
|
|
28
|
+
function createTimestampFromMs(ms) {
|
|
29
|
+
// Validate to prevent NaN from causing protobuf serialization failures
|
|
30
|
+
if (typeof ms !== "number" || isNaN(ms)) {
|
|
31
|
+
throw new Error(`Invalid milliseconds provided to createTimestampFromMs: ${ms}`);
|
|
32
|
+
}
|
|
33
|
+
return new Timestamp({
|
|
34
|
+
seconds: Math.floor(ms / 1000),
|
|
35
|
+
nanos: Math.floor((ms % 1000) * 1000000),
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Create a duration object from milliseconds.
|
|
40
|
+
*
|
|
41
|
+
* NOTE: google.protobuf.Duration is defined in the @stanterprise/protobuf schema
|
|
42
|
+
* but not exported in the package's main barrel export. Since Duration and Timestamp
|
|
43
|
+
* have identical structure (seconds: number, nanos: number) and the protobuf serialization
|
|
44
|
+
* is wire-compatible, we use Timestamp as a Duration substitute. This works correctly at runtime.
|
|
45
|
+
*
|
|
46
|
+
* @param durationMs Duration in milliseconds
|
|
47
|
+
* @returns A Duration object (implemented as Timestamp due to export limitations)
|
|
48
|
+
*/
|
|
49
|
+
function createDuration(durationMs) {
|
|
50
|
+
// Validate to prevent NaN from causing protobuf serialization failures
|
|
51
|
+
if (typeof durationMs !== "number" || isNaN(durationMs)) {
|
|
52
|
+
throw new Error(`Invalid duration provided to createDuration: ${durationMs}`);
|
|
53
|
+
}
|
|
54
|
+
if (durationMs < 0) {
|
|
55
|
+
throw new Error(`Negative duration provided to createDuration: ${durationMs}`);
|
|
56
|
+
}
|
|
57
|
+
return new Timestamp({
|
|
58
|
+
seconds: Math.floor(durationMs / 1000),
|
|
59
|
+
nanos: Math.floor((durationMs % 1000) * 1000000),
|
|
60
|
+
});
|
|
61
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@stanterprise/playwright-reporter",
|
|
3
|
+
"version": "0.0.0-debug-flag-2",
|
|
4
|
+
"description": "Custom Playwright test reporter that sends test results to Stanterprise via gRPC",
|
|
5
|
+
"homepage": "https://github.com/stanterprise/stanterprise-playwright-reporter#readme",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/stanterprise/stanterprise-playwright-reporter/issues"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/stanterprise/stanterprise-playwright-reporter.git"
|
|
12
|
+
},
|
|
13
|
+
"license": "ISC",
|
|
14
|
+
"author": "Stanterprise Team",
|
|
15
|
+
"type": "commonjs",
|
|
16
|
+
"main": "dist/index.js",
|
|
17
|
+
"types": "dist/index.d.ts",
|
|
18
|
+
"files": [
|
|
19
|
+
"dist/**/*"
|
|
20
|
+
],
|
|
21
|
+
"keywords": [
|
|
22
|
+
"playwright",
|
|
23
|
+
"reporter",
|
|
24
|
+
"test",
|
|
25
|
+
"testing",
|
|
26
|
+
"stanterprise",
|
|
27
|
+
"grpc",
|
|
28
|
+
"playwright-reporter"
|
|
29
|
+
],
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=18.0.0"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"@playwright/test": ">=1.20.0"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsc",
|
|
38
|
+
"clean": "rm -rf dist",
|
|
39
|
+
"prepublishOnly": "npm run clean && npm run build",
|
|
40
|
+
"test": "jest",
|
|
41
|
+
"test:watch": "jest --watch",
|
|
42
|
+
"test:coverage": "jest --coverage"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@playwright/test": "^1.52.0",
|
|
46
|
+
"@types/jest": "^29.5.14",
|
|
47
|
+
"@types/node": "^22.19.7",
|
|
48
|
+
"jest": "^29.7.0",
|
|
49
|
+
"ts-jest": "^29.4.5",
|
|
50
|
+
"typescript": "^5.9.3"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"@grpc/grpc-js": "^1.14.1",
|
|
54
|
+
"@protobuf-ts/grpc-transport": "^2.11.1",
|
|
55
|
+
"@protobuf-ts/grpcweb-transport": "^2.11.1",
|
|
56
|
+
"@stanterprise/protobuf": "^0.0.21"
|
|
57
|
+
}
|
|
58
|
+
}
|