@justinmiehle/shared 0.0.5

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.
@@ -0,0 +1 @@
1
+ export * from "./types";
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from "./types";
@@ -0,0 +1,214 @@
1
+ import { z } from "zod";
2
+ export declare const TestFrameworkSchema: z.ZodEnum<["vitest", "playwright", "jest", "other"]>;
3
+ export declare const TestTypeSchema: z.ZodEnum<["unit", "integration", "e2e", "visual"]>;
4
+ export declare const TestStatusSchema: z.ZodEnum<["passed", "failed", "skipped", "running"]>;
5
+ export declare const TestResultSchema: z.ZodObject<{
6
+ name: z.ZodString;
7
+ file: z.ZodString;
8
+ line: z.ZodOptional<z.ZodNumber>;
9
+ column: z.ZodOptional<z.ZodNumber>;
10
+ status: z.ZodEnum<["passed", "failed", "skipped", "running"]>;
11
+ duration: z.ZodNumber;
12
+ error: z.ZodOptional<z.ZodString>;
13
+ errorDetails: z.ZodOptional<z.ZodString>;
14
+ retries: z.ZodOptional<z.ZodNumber>;
15
+ suite: z.ZodOptional<z.ZodString>;
16
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
17
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
18
+ }, "strip", z.ZodTypeAny, {
19
+ name: string;
20
+ file: string;
21
+ status: "passed" | "failed" | "skipped" | "running";
22
+ duration: number;
23
+ line?: number | undefined;
24
+ column?: number | undefined;
25
+ error?: string | undefined;
26
+ errorDetails?: string | undefined;
27
+ retries?: number | undefined;
28
+ suite?: string | undefined;
29
+ tags?: string[] | undefined;
30
+ metadata?: Record<string, any> | undefined;
31
+ }, {
32
+ name: string;
33
+ file: string;
34
+ status: "passed" | "failed" | "skipped" | "running";
35
+ duration: number;
36
+ line?: number | undefined;
37
+ column?: number | undefined;
38
+ error?: string | undefined;
39
+ errorDetails?: string | undefined;
40
+ retries?: number | undefined;
41
+ suite?: string | undefined;
42
+ tags?: string[] | undefined;
43
+ metadata?: Record<string, any> | undefined;
44
+ }>;
45
+ export declare const TestRunIngestSchema: z.ZodObject<{
46
+ projectId: z.ZodOptional<z.ZodString>;
47
+ projectName: z.ZodString;
48
+ framework: z.ZodEnum<["vitest", "playwright", "jest", "other"]>;
49
+ testType: z.ZodEnum<["unit", "integration", "e2e", "visual"]>;
50
+ startedAt: z.ZodNumber;
51
+ completedAt: z.ZodOptional<z.ZodNumber>;
52
+ duration: z.ZodOptional<z.ZodNumber>;
53
+ totalTests: z.ZodNumber;
54
+ passedTests: z.ZodNumber;
55
+ failedTests: z.ZodNumber;
56
+ skippedTests: z.ZodNumber;
57
+ environment: z.ZodOptional<z.ZodString>;
58
+ ci: z.ZodOptional<z.ZodBoolean>;
59
+ commitSha: z.ZodOptional<z.ZodString>;
60
+ tests: z.ZodArray<z.ZodObject<{
61
+ name: z.ZodString;
62
+ file: z.ZodString;
63
+ line: z.ZodOptional<z.ZodNumber>;
64
+ column: z.ZodOptional<z.ZodNumber>;
65
+ status: z.ZodEnum<["passed", "failed", "skipped", "running"]>;
66
+ duration: z.ZodNumber;
67
+ error: z.ZodOptional<z.ZodString>;
68
+ errorDetails: z.ZodOptional<z.ZodString>;
69
+ retries: z.ZodOptional<z.ZodNumber>;
70
+ suite: z.ZodOptional<z.ZodString>;
71
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
72
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
73
+ }, "strip", z.ZodTypeAny, {
74
+ name: string;
75
+ file: string;
76
+ status: "passed" | "failed" | "skipped" | "running";
77
+ duration: number;
78
+ line?: number | undefined;
79
+ column?: number | undefined;
80
+ error?: string | undefined;
81
+ errorDetails?: string | undefined;
82
+ retries?: number | undefined;
83
+ suite?: string | undefined;
84
+ tags?: string[] | undefined;
85
+ metadata?: Record<string, any> | undefined;
86
+ }, {
87
+ name: string;
88
+ file: string;
89
+ status: "passed" | "failed" | "skipped" | "running";
90
+ duration: number;
91
+ line?: number | undefined;
92
+ column?: number | undefined;
93
+ error?: string | undefined;
94
+ errorDetails?: string | undefined;
95
+ retries?: number | undefined;
96
+ suite?: string | undefined;
97
+ tags?: string[] | undefined;
98
+ metadata?: Record<string, any> | undefined;
99
+ }>, "many">;
100
+ suites: z.ZodOptional<z.ZodArray<z.ZodObject<{
101
+ name: z.ZodString;
102
+ file: z.ZodString;
103
+ status: z.ZodEnum<["passed", "failed", "skipped", "running"]>;
104
+ duration: z.ZodNumber;
105
+ totalTests: z.ZodNumber;
106
+ passedTests: z.ZodNumber;
107
+ failedTests: z.ZodNumber;
108
+ skippedTests: z.ZodNumber;
109
+ }, "strip", z.ZodTypeAny, {
110
+ name: string;
111
+ file: string;
112
+ status: "passed" | "failed" | "skipped" | "running";
113
+ duration: number;
114
+ totalTests: number;
115
+ passedTests: number;
116
+ failedTests: number;
117
+ skippedTests: number;
118
+ }, {
119
+ name: string;
120
+ file: string;
121
+ status: "passed" | "failed" | "skipped" | "running";
122
+ duration: number;
123
+ totalTests: number;
124
+ passedTests: number;
125
+ failedTests: number;
126
+ skippedTests: number;
127
+ }>, "many">>;
128
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
129
+ }, "strip", z.ZodTypeAny, {
130
+ projectName: string;
131
+ framework: "vitest" | "playwright" | "jest" | "other";
132
+ testType: "unit" | "integration" | "e2e" | "visual";
133
+ startedAt: number;
134
+ totalTests: number;
135
+ passedTests: number;
136
+ failedTests: number;
137
+ skippedTests: number;
138
+ tests: {
139
+ name: string;
140
+ file: string;
141
+ status: "passed" | "failed" | "skipped" | "running";
142
+ duration: number;
143
+ line?: number | undefined;
144
+ column?: number | undefined;
145
+ error?: string | undefined;
146
+ errorDetails?: string | undefined;
147
+ retries?: number | undefined;
148
+ suite?: string | undefined;
149
+ tags?: string[] | undefined;
150
+ metadata?: Record<string, any> | undefined;
151
+ }[];
152
+ duration?: number | undefined;
153
+ metadata?: Record<string, any> | undefined;
154
+ projectId?: string | undefined;
155
+ completedAt?: number | undefined;
156
+ environment?: string | undefined;
157
+ ci?: boolean | undefined;
158
+ commitSha?: string | undefined;
159
+ suites?: {
160
+ name: string;
161
+ file: string;
162
+ status: "passed" | "failed" | "skipped" | "running";
163
+ duration: number;
164
+ totalTests: number;
165
+ passedTests: number;
166
+ failedTests: number;
167
+ skippedTests: number;
168
+ }[] | undefined;
169
+ }, {
170
+ projectName: string;
171
+ framework: "vitest" | "playwright" | "jest" | "other";
172
+ testType: "unit" | "integration" | "e2e" | "visual";
173
+ startedAt: number;
174
+ totalTests: number;
175
+ passedTests: number;
176
+ failedTests: number;
177
+ skippedTests: number;
178
+ tests: {
179
+ name: string;
180
+ file: string;
181
+ status: "passed" | "failed" | "skipped" | "running";
182
+ duration: number;
183
+ line?: number | undefined;
184
+ column?: number | undefined;
185
+ error?: string | undefined;
186
+ errorDetails?: string | undefined;
187
+ retries?: number | undefined;
188
+ suite?: string | undefined;
189
+ tags?: string[] | undefined;
190
+ metadata?: Record<string, any> | undefined;
191
+ }[];
192
+ duration?: number | undefined;
193
+ metadata?: Record<string, any> | undefined;
194
+ projectId?: string | undefined;
195
+ completedAt?: number | undefined;
196
+ environment?: string | undefined;
197
+ ci?: boolean | undefined;
198
+ commitSha?: string | undefined;
199
+ suites?: {
200
+ name: string;
201
+ file: string;
202
+ status: "passed" | "failed" | "skipped" | "running";
203
+ duration: number;
204
+ totalTests: number;
205
+ passedTests: number;
206
+ failedTests: number;
207
+ skippedTests: number;
208
+ }[] | undefined;
209
+ }>;
210
+ export type TestRunIngest = z.infer<typeof TestRunIngestSchema>;
211
+ export type TestResult = z.infer<typeof TestResultSchema>;
212
+ export type TestFramework = z.infer<typeof TestFrameworkSchema>;
213
+ export type TestType = z.infer<typeof TestTypeSchema>;
214
+ export type TestStatus = z.infer<typeof TestStatusSchema>;
package/dist/types.js ADDED
@@ -0,0 +1,48 @@
1
+ import { z } from "zod";
2
+ export const TestFrameworkSchema = z.enum(["vitest", "playwright", "jest", "other"]);
3
+ export const TestTypeSchema = z.enum(["unit", "integration", "e2e", "visual"]);
4
+ export const TestStatusSchema = z.enum(["passed", "failed", "skipped", "running"]);
5
+ export const TestResultSchema = z.object({
6
+ name: z.string(),
7
+ file: z.string(),
8
+ line: z.number().optional(),
9
+ column: z.number().optional(),
10
+ status: TestStatusSchema,
11
+ duration: z.number(),
12
+ error: z.string().optional(),
13
+ errorDetails: z.string().optional(),
14
+ retries: z.number().optional(),
15
+ suite: z.string().optional(),
16
+ tags: z.array(z.string()).optional(),
17
+ metadata: z.record(z.any()).optional(),
18
+ });
19
+ export const TestRunIngestSchema = z.object({
20
+ projectId: z.string().optional(),
21
+ projectName: z.string(),
22
+ framework: TestFrameworkSchema,
23
+ testType: TestTypeSchema,
24
+ startedAt: z.number(),
25
+ completedAt: z.number().optional(),
26
+ duration: z.number().optional(),
27
+ totalTests: z.number(),
28
+ passedTests: z.number(),
29
+ failedTests: z.number(),
30
+ skippedTests: z.number(),
31
+ environment: z.string().optional(),
32
+ ci: z.boolean().optional(),
33
+ commitSha: z.string().optional(),
34
+ tests: z.array(TestResultSchema),
35
+ suites: z
36
+ .array(z.object({
37
+ name: z.string(),
38
+ file: z.string(),
39
+ status: TestStatusSchema,
40
+ duration: z.number(),
41
+ totalTests: z.number(),
42
+ passedTests: z.number(),
43
+ failedTests: z.number(),
44
+ skippedTests: z.number(),
45
+ }))
46
+ .optional(),
47
+ metadata: z.record(z.any()).optional(),
48
+ });
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@justinmiehle/shared",
3
+ "version": "0.0.5",
4
+ "description": "Shared types and schemas for Panoptes test reporters",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js",
12
+ "require": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": ["dist", "src"],
16
+ "scripts": {
17
+ "build": "tsc"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/JustinMiehle/panoptes.git",
22
+ "directory": "packages/shared"
23
+ },
24
+ "publishConfig": {
25
+ "registry": "https://npm.pkg.github.com",
26
+ "access": "public"
27
+ },
28
+ "dependencies": {
29
+ "zod": "^3.22.4"
30
+ },
31
+ "devDependencies": {
32
+ "@types/node": "^20.10.0",
33
+ "typescript": "^5.3.3"
34
+ }
35
+ }
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./types";
package/src/types.ts ADDED
@@ -0,0 +1,59 @@
1
+ import { z } from "zod";
2
+
3
+ export const TestFrameworkSchema = z.enum(["vitest", "playwright", "jest", "other"]);
4
+ export const TestTypeSchema = z.enum(["unit", "integration", "e2e", "visual"]);
5
+ export const TestStatusSchema = z.enum(["passed", "failed", "skipped", "running"]);
6
+
7
+ export const TestResultSchema = z.object({
8
+ name: z.string(),
9
+ file: z.string(),
10
+ line: z.number().optional(),
11
+ column: z.number().optional(),
12
+ status: TestStatusSchema,
13
+ duration: z.number(),
14
+ error: z.string().optional(),
15
+ errorDetails: z.string().optional(),
16
+ retries: z.number().optional(),
17
+ suite: z.string().optional(),
18
+ tags: z.array(z.string()).optional(),
19
+ metadata: z.record(z.any()).optional(),
20
+ });
21
+
22
+ export const TestRunIngestSchema = z.object({
23
+ projectId: z.string().optional(),
24
+ projectName: z.string(),
25
+ framework: TestFrameworkSchema,
26
+ testType: TestTypeSchema,
27
+ startedAt: z.number(),
28
+ completedAt: z.number().optional(),
29
+ duration: z.number().optional(),
30
+ totalTests: z.number(),
31
+ passedTests: z.number(),
32
+ failedTests: z.number(),
33
+ skippedTests: z.number(),
34
+ environment: z.string().optional(),
35
+ ci: z.boolean().optional(),
36
+ commitSha: z.string().optional(),
37
+ tests: z.array(TestResultSchema),
38
+ suites: z
39
+ .array(
40
+ z.object({
41
+ name: z.string(),
42
+ file: z.string(),
43
+ status: TestStatusSchema,
44
+ duration: z.number(),
45
+ totalTests: z.number(),
46
+ passedTests: z.number(),
47
+ failedTests: z.number(),
48
+ skippedTests: z.number(),
49
+ })
50
+ )
51
+ .optional(),
52
+ metadata: z.record(z.any()).optional(),
53
+ });
54
+
55
+ export type TestRunIngest = z.infer<typeof TestRunIngestSchema>;
56
+ export type TestResult = z.infer<typeof TestResultSchema>;
57
+ export type TestFramework = z.infer<typeof TestFrameworkSchema>;
58
+ export type TestType = z.infer<typeof TestTypeSchema>;
59
+ export type TestStatus = z.infer<typeof TestStatusSchema>;