@decaf-ts/utils 0.11.17 → 0.11.18
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/esm/index.d.ts +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/tests/TestReporter.d.ts +49 -0
- package/lib/esm/tests/TestReporter.js +136 -10
- package/lib/esm/tests/TestReporter.js.map +1 -1
- package/lib/index.cjs +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/tests/TestReporter.cjs +137 -11
- package/lib/tests/TestReporter.d.ts +49 -0
- package/lib/tests/TestReporter.js.map +1 -1
- package/package.json +4 -9
package/lib/esm/index.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export * from "./writers";
|
|
|
26
26
|
* @const VERSION
|
|
27
27
|
* @memberOf module:utils
|
|
28
28
|
*/
|
|
29
|
-
export declare const VERSION = "0.11.
|
|
29
|
+
export declare const VERSION = "0.11.17";
|
|
30
30
|
/**
|
|
31
31
|
* @description Represents the current version of the module.
|
|
32
32
|
* @summary Stores the version for the @decaf-ts/utils package. The build replaces
|
package/lib/esm/index.js
CHANGED
|
@@ -26,7 +26,7 @@ export * from "./writers/index.js";
|
|
|
26
26
|
* @const VERSION
|
|
27
27
|
* @memberOf module:utils
|
|
28
28
|
*/
|
|
29
|
-
export const VERSION = "0.11.
|
|
29
|
+
export const VERSION = "0.11.17";
|
|
30
30
|
/**
|
|
31
31
|
* @description Represents the current version of the module.
|
|
32
32
|
* @summary Stores the version for the @decaf-ts/utils package. The build replaces
|
|
@@ -28,6 +28,11 @@ export interface AddMsgParams {
|
|
|
28
28
|
* @memberOf module:utils
|
|
29
29
|
*/
|
|
30
30
|
export type PayloadType = "json" | "image" | "text" | "md";
|
|
31
|
+
export type EvidenceData = {
|
|
32
|
+
name: string;
|
|
33
|
+
content: string | Buffer;
|
|
34
|
+
path: string;
|
|
35
|
+
};
|
|
31
36
|
/**
|
|
32
37
|
* @description Environment variable key for Jest HTML reporters temporary directory path
|
|
33
38
|
* @summary Constant defining the environment variable key for Jest HTML reporters
|
|
@@ -35,6 +40,20 @@ export type PayloadType = "json" | "image" | "text" | "md";
|
|
|
35
40
|
* @memberOf module:utils
|
|
36
41
|
*/
|
|
37
42
|
export declare const JestReportersTempPathEnvKey = "JEST_HTML_REPORTERS_TEMP_DIR_PATH";
|
|
43
|
+
/**
|
|
44
|
+
* @description Environment variable key to enable file-based evidence storage
|
|
45
|
+
* @summary Constant defining the environment variable key for storage enablement
|
|
46
|
+
* @const TestReporterStorageEnabledEnvKey
|
|
47
|
+
* @memberOf module:utils
|
|
48
|
+
*/
|
|
49
|
+
export declare const TestReporterStorageEnabledEnvKey = "TEST_REPORTER_STORAGE_ENABLED";
|
|
50
|
+
/**
|
|
51
|
+
* @description Environment variable key for the base path of evidence storage
|
|
52
|
+
* @summary Constant defining the environment variable key for storage path
|
|
53
|
+
* @const TestReporterStoragePathEnvKey
|
|
54
|
+
* @memberOf module:utils
|
|
55
|
+
*/
|
|
56
|
+
export declare const TestReporterStoragePathEnvKey = "TEST_REPORTER_STORAGE_PATH";
|
|
38
57
|
/**
|
|
39
58
|
* @description Test reporting utility class for managing test results and evidence
|
|
40
59
|
* @summary A comprehensive test reporter that handles various types of test artifacts including messages,
|
|
@@ -114,7 +133,27 @@ export declare class TestReporter {
|
|
|
114
133
|
* @type {SimpleDependencyMap}
|
|
115
134
|
*/
|
|
116
135
|
private deps?;
|
|
136
|
+
/**
|
|
137
|
+
* @description Checks if storage is enabled via environment variables
|
|
138
|
+
* @summary Static getter for storage enablement status
|
|
139
|
+
* @type {boolean}
|
|
140
|
+
*/
|
|
141
|
+
static get storageEnabled(): boolean;
|
|
142
|
+
/**
|
|
143
|
+
* @description Gets the base path for evidence storage from environment variables or default
|
|
144
|
+
* @summary Static getter for evidence storage base path
|
|
145
|
+
* @type {string}
|
|
146
|
+
*/
|
|
147
|
+
static get storagePath(): string;
|
|
117
148
|
constructor(testCase?: string, basePath?: string);
|
|
149
|
+
/**
|
|
150
|
+
* @description Retrieves all evidences for a given describe and it name
|
|
151
|
+
* @summary Searches the storage directory for matching evidences using string inclusion
|
|
152
|
+
* @param {string} describeName - Name of the describe block to match
|
|
153
|
+
* @param {string} itName - Name of the it block to match
|
|
154
|
+
* @return {EvidenceData[]} Array of matching evidences
|
|
155
|
+
*/
|
|
156
|
+
static getEvidencesOf(describeName: string, itName: string): EvidenceData[];
|
|
118
157
|
/**
|
|
119
158
|
* @description Imports required helper functions
|
|
120
159
|
* @summary Ensures all necessary dependencies are available and imports helper functions
|
|
@@ -150,6 +189,16 @@ export declare class TestReporter {
|
|
|
150
189
|
* @return {Promise<void>} Promise that resolves when data is reported
|
|
151
190
|
*/
|
|
152
191
|
protected report(reference: string, data: string | number | object | Buffer, type: PayloadType, trim?: boolean): Promise<void>;
|
|
192
|
+
/**
|
|
193
|
+
* @description Stores evidence to a file in the specified directory structure
|
|
194
|
+
* @summary Internal method to handle file-based storage of test artifacts
|
|
195
|
+
* @param {string} reference - Reference identifier for the data
|
|
196
|
+
* @param {any} data - Data to be stored
|
|
197
|
+
* @param {PayloadType} type - Type of the payload
|
|
198
|
+
* @param {string} extension - File extension to use
|
|
199
|
+
* @return {Promise<void>}
|
|
200
|
+
*/
|
|
201
|
+
private storeEvidence;
|
|
153
202
|
/**
|
|
154
203
|
* @description Reports data with a specified type
|
|
155
204
|
* @summary Wrapper method for reporting various types of data
|
|
@@ -8,6 +8,20 @@ import { installIfNotAvailable } from "./../utils/fs.js";
|
|
|
8
8
|
* @memberOf module:utils
|
|
9
9
|
*/
|
|
10
10
|
export const JestReportersTempPathEnvKey = "JEST_HTML_REPORTERS_TEMP_DIR_PATH";
|
|
11
|
+
/**
|
|
12
|
+
* @description Environment variable key to enable file-based evidence storage
|
|
13
|
+
* @summary Constant defining the environment variable key for storage enablement
|
|
14
|
+
* @const TestReporterStorageEnabledEnvKey
|
|
15
|
+
* @memberOf module:utils
|
|
16
|
+
*/
|
|
17
|
+
export const TestReporterStorageEnabledEnvKey = "TEST_REPORTER_STORAGE_ENABLED";
|
|
18
|
+
/**
|
|
19
|
+
* @description Environment variable key for the base path of evidence storage
|
|
20
|
+
* @summary Constant defining the environment variable key for storage path
|
|
21
|
+
* @const TestReporterStoragePathEnvKey
|
|
22
|
+
* @memberOf module:utils
|
|
23
|
+
*/
|
|
24
|
+
export const TestReporterStoragePathEnvKey = "TEST_REPORTER_STORAGE_PATH";
|
|
11
25
|
/**
|
|
12
26
|
* @description Array of dependencies required by the test reporter
|
|
13
27
|
* @summary List of npm packages needed for reporting functionality
|
|
@@ -87,13 +101,78 @@ async function normalizeImport(importPromise) {
|
|
|
87
101
|
* end
|
|
88
102
|
*/
|
|
89
103
|
export class TestReporter {
|
|
90
|
-
|
|
104
|
+
/**
|
|
105
|
+
* @description Checks if storage is enabled via environment variables
|
|
106
|
+
* @summary Static getter for storage enablement status
|
|
107
|
+
* @type {boolean}
|
|
108
|
+
*/
|
|
109
|
+
static get storageEnabled() {
|
|
110
|
+
return (process.env[TestReporterStorageEnabledEnvKey] === "true" ||
|
|
111
|
+
process.env["TEST_REPORTER_STORE_EVIDENCE"] === "true");
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* @description Gets the base path for evidence storage from environment variables or default
|
|
115
|
+
* @summary Static getter for evidence storage base path
|
|
116
|
+
* @type {string}
|
|
117
|
+
*/
|
|
118
|
+
static get storagePath() {
|
|
119
|
+
return (process.env[TestReporterStoragePathEnvKey] ||
|
|
120
|
+
path.join(process.cwd(), "workdocs", "reports", "evidences"));
|
|
121
|
+
}
|
|
122
|
+
constructor(testCase = "tests", basePath = TestReporter.storagePath) {
|
|
91
123
|
this.testCase = testCase;
|
|
92
124
|
this.basePath = basePath;
|
|
125
|
+
const parentPath = basePath;
|
|
93
126
|
this.basePath = path.join(basePath, this.testCase);
|
|
94
127
|
if (!fs.existsSync(this.basePath)) {
|
|
95
|
-
fs.mkdirSync(
|
|
128
|
+
fs.mkdirSync(parentPath, { recursive: true });
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* @description Retrieves all evidences for a given describe and it name
|
|
133
|
+
* @summary Searches the storage directory for matching evidences using string inclusion
|
|
134
|
+
* @param {string} describeName - Name of the describe block to match
|
|
135
|
+
* @param {string} itName - Name of the it block to match
|
|
136
|
+
* @return {EvidenceData[]} Array of matching evidences
|
|
137
|
+
*/
|
|
138
|
+
static getEvidencesOf(describeName, itName) {
|
|
139
|
+
const root = TestReporter.storagePath;
|
|
140
|
+
if (!fs.existsSync(root))
|
|
141
|
+
return [];
|
|
142
|
+
const evidences = [];
|
|
143
|
+
const normalize = (s) => s.toLowerCase().replace(/[- ]/g, "");
|
|
144
|
+
const nDescribe = normalize(describeName);
|
|
145
|
+
const nIt = normalize(itName);
|
|
146
|
+
const describeDirs = fs
|
|
147
|
+
.readdirSync(root)
|
|
148
|
+
.filter((d) => normalize(d).includes(nDescribe));
|
|
149
|
+
for (const dDir of describeDirs) {
|
|
150
|
+
const dPath = path.join(root, dDir);
|
|
151
|
+
if (!fs.statSync(dPath).isDirectory())
|
|
152
|
+
continue;
|
|
153
|
+
const itDirs = fs
|
|
154
|
+
.readdirSync(dPath)
|
|
155
|
+
.filter((i) => normalize(i).includes(nIt));
|
|
156
|
+
for (const iDir of itDirs) {
|
|
157
|
+
const iPath = path.join(dPath, iDir);
|
|
158
|
+
if (!fs.statSync(iPath).isDirectory())
|
|
159
|
+
continue;
|
|
160
|
+
const files = fs.readdirSync(iPath);
|
|
161
|
+
for (const file of files) {
|
|
162
|
+
const filePath = path.join(iPath, file);
|
|
163
|
+
if (fs.statSync(filePath).isFile()) {
|
|
164
|
+
const content = fs.readFileSync(filePath);
|
|
165
|
+
const isText = [".json", ".txt", ".md"].some((ext) => file.endsWith(ext));
|
|
166
|
+
evidences.push({
|
|
167
|
+
name: file,
|
|
168
|
+
path: filePath,
|
|
169
|
+
content: isText ? content.toString("utf-8") : content,
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
96
174
|
}
|
|
175
|
+
return evidences;
|
|
97
176
|
}
|
|
98
177
|
/**
|
|
99
178
|
* @description Imports required helper functions
|
|
@@ -167,20 +246,24 @@ export class TestReporter {
|
|
|
167
246
|
try {
|
|
168
247
|
let attachFunction = this.reportMessage.bind(this);
|
|
169
248
|
let extension = ".txt";
|
|
249
|
+
let finalData = data;
|
|
170
250
|
switch (type) {
|
|
171
251
|
case "image":
|
|
172
|
-
|
|
252
|
+
finalData = Buffer.from(data);
|
|
173
253
|
extension = ".png";
|
|
174
254
|
attachFunction = this.reportAttachment.bind(this);
|
|
175
255
|
break;
|
|
176
256
|
case "json":
|
|
177
257
|
if (trim) {
|
|
178
|
-
if
|
|
179
|
-
|
|
180
|
-
if (
|
|
181
|
-
delete
|
|
258
|
+
// we clone to avoid modifying the original if it was an object passed by reference
|
|
259
|
+
const dataToTrim = JSON.parse(JSON.stringify(data));
|
|
260
|
+
if (dataToTrim.request)
|
|
261
|
+
delete dataToTrim.request;
|
|
262
|
+
if (dataToTrim.config)
|
|
263
|
+
delete dataToTrim.config;
|
|
264
|
+
finalData = dataToTrim;
|
|
182
265
|
}
|
|
183
|
-
|
|
266
|
+
finalData = JSON.stringify(finalData, null, 2);
|
|
184
267
|
extension = ".json";
|
|
185
268
|
break;
|
|
186
269
|
case "md":
|
|
@@ -192,15 +275,58 @@ export class TestReporter {
|
|
|
192
275
|
default:
|
|
193
276
|
console.log(`Unsupported type ${type}. assuming text`);
|
|
194
277
|
}
|
|
195
|
-
|
|
278
|
+
const refWithExt = reference.includes("\n") || reference.includes(extension)
|
|
196
279
|
? reference
|
|
197
280
|
: `${reference}${extension}`;
|
|
198
|
-
await attachFunction(
|
|
281
|
+
await attachFunction(refWithExt, finalData);
|
|
282
|
+
if (TestReporter.storageEnabled) {
|
|
283
|
+
await this.storeEvidence(reference, finalData, type, extension);
|
|
284
|
+
}
|
|
199
285
|
}
|
|
200
286
|
catch (e) {
|
|
201
287
|
throw new Error(`Could not store attach artifact ${reference} under to test report ${this.testCase} - ${e}`);
|
|
202
288
|
}
|
|
203
289
|
}
|
|
290
|
+
/**
|
|
291
|
+
* @description Stores evidence to a file in the specified directory structure
|
|
292
|
+
* @summary Internal method to handle file-based storage of test artifacts
|
|
293
|
+
* @param {string} reference - Reference identifier for the data
|
|
294
|
+
* @param {any} data - Data to be stored
|
|
295
|
+
* @param {PayloadType} type - Type of the payload
|
|
296
|
+
* @param {string} extension - File extension to use
|
|
297
|
+
* @return {Promise<void>}
|
|
298
|
+
*/
|
|
299
|
+
async storeEvidence(reference, data, type, extension) {
|
|
300
|
+
let itName = "unknown-it";
|
|
301
|
+
try {
|
|
302
|
+
const state = global.expect?.getState();
|
|
303
|
+
if (state?.currentTestName) {
|
|
304
|
+
itName = state.currentTestName;
|
|
305
|
+
if (itName.startsWith(this.testCase)) {
|
|
306
|
+
itName = itName.substring(this.testCase.length).trim();
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
310
|
+
}
|
|
311
|
+
catch (e) {
|
|
312
|
+
// Ignore
|
|
313
|
+
}
|
|
314
|
+
const sanitizedItName = itName.replace(/[/\\?%*:|"<>]/g, "-") || "unknown-it";
|
|
315
|
+
const evidenceDir = path.join(this.basePath, sanitizedItName);
|
|
316
|
+
if (!fs.existsSync(evidenceDir)) {
|
|
317
|
+
fs.mkdirSync(evidenceDir, { recursive: true });
|
|
318
|
+
}
|
|
319
|
+
const fileName = reference.includes(extension)
|
|
320
|
+
? reference
|
|
321
|
+
: `${reference}${extension}`;
|
|
322
|
+
const filePath = path.join(evidenceDir, fileName);
|
|
323
|
+
if (type === "image" || Buffer.isBuffer(data)) {
|
|
324
|
+
fs.writeFileSync(filePath, data);
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
fs.writeFileSync(filePath, typeof data === "string" ? data : JSON.stringify(data, null, 2));
|
|
328
|
+
}
|
|
329
|
+
}
|
|
204
330
|
/**
|
|
205
331
|
* @description Reports data with a specified type
|
|
206
332
|
* @summary Wrapper method for reporting various types of data
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TestReporter.js","sourceRoot":"","sources":["../../../src/tests/TestReporter.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,qBAAqB,EAAE,yBAAoB;
|
|
1
|
+
{"version":3,"file":"TestReporter.js","sourceRoot":"","sources":["../../../src/tests/TestReporter.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,qBAAqB,EAAE,yBAAoB;AA0CpD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,mCAAmC,CAAC;AAE/E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,+BAA+B,CAAC;AAEhF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,4BAA4B,CAAC;AAE1E;;;;;GAKG;AACH,MAAM,YAAY,GAAG,CAAC,qBAAqB,EAAE,SAAS,EAAE,qBAAqB,CAAC,CAAC;AAE/E;;;;;;;;GAQG;AACH,KAAK,UAAU,eAAe,CAAI,aAAyB;IACzD,mEAAmE;IACnE,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAM,CAAC,CAAC;AAC/D,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,MAAM,OAAO,YAAY;IAwBvB;;;;OAIG;IACI,MAAM,KAAK,cAAc;QAC9B,OAAO,CACL,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,KAAK,MAAM;YACxD,OAAO,CAAC,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AAE,OAAO,CAAC,CAAC;IACjD,CAAC;CACF"}
|
package/lib/index.cjs
CHANGED
|
@@ -43,7 +43,7 @@ __exportStar(require("./writers/index.cjs"), exports);
|
|
|
43
43
|
* @const VERSION
|
|
44
44
|
* @memberOf module:utils
|
|
45
45
|
*/
|
|
46
|
-
exports.VERSION = "0.11.
|
|
46
|
+
exports.VERSION = "0.11.17";
|
|
47
47
|
/**
|
|
48
48
|
* @description Represents the current version of the module.
|
|
49
49
|
* @summary Stores the version for the @decaf-ts/utils package. The build replaces
|
package/lib/index.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export * from "./writers";
|
|
|
26
26
|
* @const VERSION
|
|
27
27
|
* @memberOf module:utils
|
|
28
28
|
*/
|
|
29
|
-
export declare const VERSION = "0.11.
|
|
29
|
+
export declare const VERSION = "0.11.17";
|
|
30
30
|
/**
|
|
31
31
|
* @description Represents the current version of the module.
|
|
32
32
|
* @summary Stores the version for the @decaf-ts/utils package. The build replaces
|
|
@@ -36,7 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.TestReporter = exports.JestReportersTempPathEnvKey = void 0;
|
|
39
|
+
exports.TestReporter = exports.TestReporterStoragePathEnvKey = exports.TestReporterStorageEnabledEnvKey = exports.JestReportersTempPathEnvKey = void 0;
|
|
40
40
|
const path_1 = __importDefault(require("path"));
|
|
41
41
|
const fs_1 = __importDefault(require("fs"));
|
|
42
42
|
const fs_2 = require("./../utils/fs.cjs");
|
|
@@ -47,6 +47,20 @@ const fs_2 = require("./../utils/fs.cjs");
|
|
|
47
47
|
* @memberOf module:utils
|
|
48
48
|
*/
|
|
49
49
|
exports.JestReportersTempPathEnvKey = "JEST_HTML_REPORTERS_TEMP_DIR_PATH";
|
|
50
|
+
/**
|
|
51
|
+
* @description Environment variable key to enable file-based evidence storage
|
|
52
|
+
* @summary Constant defining the environment variable key for storage enablement
|
|
53
|
+
* @const TestReporterStorageEnabledEnvKey
|
|
54
|
+
* @memberOf module:utils
|
|
55
|
+
*/
|
|
56
|
+
exports.TestReporterStorageEnabledEnvKey = "TEST_REPORTER_STORAGE_ENABLED";
|
|
57
|
+
/**
|
|
58
|
+
* @description Environment variable key for the base path of evidence storage
|
|
59
|
+
* @summary Constant defining the environment variable key for storage path
|
|
60
|
+
* @const TestReporterStoragePathEnvKey
|
|
61
|
+
* @memberOf module:utils
|
|
62
|
+
*/
|
|
63
|
+
exports.TestReporterStoragePathEnvKey = "TEST_REPORTER_STORAGE_PATH";
|
|
50
64
|
/**
|
|
51
65
|
* @description Array of dependencies required by the test reporter
|
|
52
66
|
* @summary List of npm packages needed for reporting functionality
|
|
@@ -126,13 +140,78 @@ async function normalizeImport(importPromise) {
|
|
|
126
140
|
* end
|
|
127
141
|
*/
|
|
128
142
|
class TestReporter {
|
|
129
|
-
|
|
143
|
+
/**
|
|
144
|
+
* @description Checks if storage is enabled via environment variables
|
|
145
|
+
* @summary Static getter for storage enablement status
|
|
146
|
+
* @type {boolean}
|
|
147
|
+
*/
|
|
148
|
+
static get storageEnabled() {
|
|
149
|
+
return (process.env[exports.TestReporterStorageEnabledEnvKey] === "true" ||
|
|
150
|
+
process.env["TEST_REPORTER_STORE_EVIDENCE"] === "true");
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* @description Gets the base path for evidence storage from environment variables or default
|
|
154
|
+
* @summary Static getter for evidence storage base path
|
|
155
|
+
* @type {string}
|
|
156
|
+
*/
|
|
157
|
+
static get storagePath() {
|
|
158
|
+
return (process.env[exports.TestReporterStoragePathEnvKey] ||
|
|
159
|
+
path_1.default.join(process.cwd(), "workdocs", "reports", "evidences"));
|
|
160
|
+
}
|
|
161
|
+
constructor(testCase = "tests", basePath = TestReporter.storagePath) {
|
|
130
162
|
this.testCase = testCase;
|
|
131
163
|
this.basePath = basePath;
|
|
164
|
+
const parentPath = basePath;
|
|
132
165
|
this.basePath = path_1.default.join(basePath, this.testCase);
|
|
133
166
|
if (!fs_1.default.existsSync(this.basePath)) {
|
|
134
|
-
fs_1.default.mkdirSync(
|
|
167
|
+
fs_1.default.mkdirSync(parentPath, { recursive: true });
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* @description Retrieves all evidences for a given describe and it name
|
|
172
|
+
* @summary Searches the storage directory for matching evidences using string inclusion
|
|
173
|
+
* @param {string} describeName - Name of the describe block to match
|
|
174
|
+
* @param {string} itName - Name of the it block to match
|
|
175
|
+
* @return {EvidenceData[]} Array of matching evidences
|
|
176
|
+
*/
|
|
177
|
+
static getEvidencesOf(describeName, itName) {
|
|
178
|
+
const root = TestReporter.storagePath;
|
|
179
|
+
if (!fs_1.default.existsSync(root))
|
|
180
|
+
return [];
|
|
181
|
+
const evidences = [];
|
|
182
|
+
const normalize = (s) => s.toLowerCase().replace(/[- ]/g, "");
|
|
183
|
+
const nDescribe = normalize(describeName);
|
|
184
|
+
const nIt = normalize(itName);
|
|
185
|
+
const describeDirs = fs_1.default
|
|
186
|
+
.readdirSync(root)
|
|
187
|
+
.filter((d) => normalize(d).includes(nDescribe));
|
|
188
|
+
for (const dDir of describeDirs) {
|
|
189
|
+
const dPath = path_1.default.join(root, dDir);
|
|
190
|
+
if (!fs_1.default.statSync(dPath).isDirectory())
|
|
191
|
+
continue;
|
|
192
|
+
const itDirs = fs_1.default
|
|
193
|
+
.readdirSync(dPath)
|
|
194
|
+
.filter((i) => normalize(i).includes(nIt));
|
|
195
|
+
for (const iDir of itDirs) {
|
|
196
|
+
const iPath = path_1.default.join(dPath, iDir);
|
|
197
|
+
if (!fs_1.default.statSync(iPath).isDirectory())
|
|
198
|
+
continue;
|
|
199
|
+
const files = fs_1.default.readdirSync(iPath);
|
|
200
|
+
for (const file of files) {
|
|
201
|
+
const filePath = path_1.default.join(iPath, file);
|
|
202
|
+
if (fs_1.default.statSync(filePath).isFile()) {
|
|
203
|
+
const content = fs_1.default.readFileSync(filePath);
|
|
204
|
+
const isText = [".json", ".txt", ".md"].some((ext) => file.endsWith(ext));
|
|
205
|
+
evidences.push({
|
|
206
|
+
name: file,
|
|
207
|
+
path: filePath,
|
|
208
|
+
content: isText ? content.toString("utf-8") : content,
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
135
213
|
}
|
|
214
|
+
return evidences;
|
|
136
215
|
}
|
|
137
216
|
/**
|
|
138
217
|
* @description Imports required helper functions
|
|
@@ -206,20 +285,24 @@ class TestReporter {
|
|
|
206
285
|
try {
|
|
207
286
|
let attachFunction = this.reportMessage.bind(this);
|
|
208
287
|
let extension = ".txt";
|
|
288
|
+
let finalData = data;
|
|
209
289
|
switch (type) {
|
|
210
290
|
case "image":
|
|
211
|
-
|
|
291
|
+
finalData = Buffer.from(data);
|
|
212
292
|
extension = ".png";
|
|
213
293
|
attachFunction = this.reportAttachment.bind(this);
|
|
214
294
|
break;
|
|
215
295
|
case "json":
|
|
216
296
|
if (trim) {
|
|
217
|
-
if
|
|
218
|
-
|
|
219
|
-
if (
|
|
220
|
-
delete
|
|
297
|
+
// we clone to avoid modifying the original if it was an object passed by reference
|
|
298
|
+
const dataToTrim = JSON.parse(JSON.stringify(data));
|
|
299
|
+
if (dataToTrim.request)
|
|
300
|
+
delete dataToTrim.request;
|
|
301
|
+
if (dataToTrim.config)
|
|
302
|
+
delete dataToTrim.config;
|
|
303
|
+
finalData = dataToTrim;
|
|
221
304
|
}
|
|
222
|
-
|
|
305
|
+
finalData = JSON.stringify(finalData, null, 2);
|
|
223
306
|
extension = ".json";
|
|
224
307
|
break;
|
|
225
308
|
case "md":
|
|
@@ -231,15 +314,58 @@ class TestReporter {
|
|
|
231
314
|
default:
|
|
232
315
|
console.log(`Unsupported type ${type}. assuming text`);
|
|
233
316
|
}
|
|
234
|
-
|
|
317
|
+
const refWithExt = reference.includes("\n") || reference.includes(extension)
|
|
235
318
|
? reference
|
|
236
319
|
: `${reference}${extension}`;
|
|
237
|
-
await attachFunction(
|
|
320
|
+
await attachFunction(refWithExt, finalData);
|
|
321
|
+
if (TestReporter.storageEnabled) {
|
|
322
|
+
await this.storeEvidence(reference, finalData, type, extension);
|
|
323
|
+
}
|
|
238
324
|
}
|
|
239
325
|
catch (e) {
|
|
240
326
|
throw new Error(`Could not store attach artifact ${reference} under to test report ${this.testCase} - ${e}`);
|
|
241
327
|
}
|
|
242
328
|
}
|
|
329
|
+
/**
|
|
330
|
+
* @description Stores evidence to a file in the specified directory structure
|
|
331
|
+
* @summary Internal method to handle file-based storage of test artifacts
|
|
332
|
+
* @param {string} reference - Reference identifier for the data
|
|
333
|
+
* @param {any} data - Data to be stored
|
|
334
|
+
* @param {PayloadType} type - Type of the payload
|
|
335
|
+
* @param {string} extension - File extension to use
|
|
336
|
+
* @return {Promise<void>}
|
|
337
|
+
*/
|
|
338
|
+
async storeEvidence(reference, data, type, extension) {
|
|
339
|
+
let itName = "unknown-it";
|
|
340
|
+
try {
|
|
341
|
+
const state = global.expect?.getState();
|
|
342
|
+
if (state?.currentTestName) {
|
|
343
|
+
itName = state.currentTestName;
|
|
344
|
+
if (itName.startsWith(this.testCase)) {
|
|
345
|
+
itName = itName.substring(this.testCase.length).trim();
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
349
|
+
}
|
|
350
|
+
catch (e) {
|
|
351
|
+
// Ignore
|
|
352
|
+
}
|
|
353
|
+
const sanitizedItName = itName.replace(/[/\\?%*:|"<>]/g, "-") || "unknown-it";
|
|
354
|
+
const evidenceDir = path_1.default.join(this.basePath, sanitizedItName);
|
|
355
|
+
if (!fs_1.default.existsSync(evidenceDir)) {
|
|
356
|
+
fs_1.default.mkdirSync(evidenceDir, { recursive: true });
|
|
357
|
+
}
|
|
358
|
+
const fileName = reference.includes(extension)
|
|
359
|
+
? reference
|
|
360
|
+
: `${reference}${extension}`;
|
|
361
|
+
const filePath = path_1.default.join(evidenceDir, fileName);
|
|
362
|
+
if (type === "image" || Buffer.isBuffer(data)) {
|
|
363
|
+
fs_1.default.writeFileSync(filePath, data);
|
|
364
|
+
}
|
|
365
|
+
else {
|
|
366
|
+
fs_1.default.writeFileSync(filePath, typeof data === "string" ? data : JSON.stringify(data, null, 2));
|
|
367
|
+
}
|
|
368
|
+
}
|
|
243
369
|
/**
|
|
244
370
|
* @description Reports data with a specified type
|
|
245
371
|
* @summary Wrapper method for reporting various types of data
|
|
@@ -28,6 +28,11 @@ export interface AddMsgParams {
|
|
|
28
28
|
* @memberOf module:utils
|
|
29
29
|
*/
|
|
30
30
|
export type PayloadType = "json" | "image" | "text" | "md";
|
|
31
|
+
export type EvidenceData = {
|
|
32
|
+
name: string;
|
|
33
|
+
content: string | Buffer;
|
|
34
|
+
path: string;
|
|
35
|
+
};
|
|
31
36
|
/**
|
|
32
37
|
* @description Environment variable key for Jest HTML reporters temporary directory path
|
|
33
38
|
* @summary Constant defining the environment variable key for Jest HTML reporters
|
|
@@ -35,6 +40,20 @@ export type PayloadType = "json" | "image" | "text" | "md";
|
|
|
35
40
|
* @memberOf module:utils
|
|
36
41
|
*/
|
|
37
42
|
export declare const JestReportersTempPathEnvKey = "JEST_HTML_REPORTERS_TEMP_DIR_PATH";
|
|
43
|
+
/**
|
|
44
|
+
* @description Environment variable key to enable file-based evidence storage
|
|
45
|
+
* @summary Constant defining the environment variable key for storage enablement
|
|
46
|
+
* @const TestReporterStorageEnabledEnvKey
|
|
47
|
+
* @memberOf module:utils
|
|
48
|
+
*/
|
|
49
|
+
export declare const TestReporterStorageEnabledEnvKey = "TEST_REPORTER_STORAGE_ENABLED";
|
|
50
|
+
/**
|
|
51
|
+
* @description Environment variable key for the base path of evidence storage
|
|
52
|
+
* @summary Constant defining the environment variable key for storage path
|
|
53
|
+
* @const TestReporterStoragePathEnvKey
|
|
54
|
+
* @memberOf module:utils
|
|
55
|
+
*/
|
|
56
|
+
export declare const TestReporterStoragePathEnvKey = "TEST_REPORTER_STORAGE_PATH";
|
|
38
57
|
/**
|
|
39
58
|
* @description Test reporting utility class for managing test results and evidence
|
|
40
59
|
* @summary A comprehensive test reporter that handles various types of test artifacts including messages,
|
|
@@ -114,7 +133,27 @@ export declare class TestReporter {
|
|
|
114
133
|
* @type {SimpleDependencyMap}
|
|
115
134
|
*/
|
|
116
135
|
private deps?;
|
|
136
|
+
/**
|
|
137
|
+
* @description Checks if storage is enabled via environment variables
|
|
138
|
+
* @summary Static getter for storage enablement status
|
|
139
|
+
* @type {boolean}
|
|
140
|
+
*/
|
|
141
|
+
static get storageEnabled(): boolean;
|
|
142
|
+
/**
|
|
143
|
+
* @description Gets the base path for evidence storage from environment variables or default
|
|
144
|
+
* @summary Static getter for evidence storage base path
|
|
145
|
+
* @type {string}
|
|
146
|
+
*/
|
|
147
|
+
static get storagePath(): string;
|
|
117
148
|
constructor(testCase?: string, basePath?: string);
|
|
149
|
+
/**
|
|
150
|
+
* @description Retrieves all evidences for a given describe and it name
|
|
151
|
+
* @summary Searches the storage directory for matching evidences using string inclusion
|
|
152
|
+
* @param {string} describeName - Name of the describe block to match
|
|
153
|
+
* @param {string} itName - Name of the it block to match
|
|
154
|
+
* @return {EvidenceData[]} Array of matching evidences
|
|
155
|
+
*/
|
|
156
|
+
static getEvidencesOf(describeName: string, itName: string): EvidenceData[];
|
|
118
157
|
/**
|
|
119
158
|
* @description Imports required helper functions
|
|
120
159
|
* @summary Ensures all necessary dependencies are available and imports helper functions
|
|
@@ -150,6 +189,16 @@ export declare class TestReporter {
|
|
|
150
189
|
* @return {Promise<void>} Promise that resolves when data is reported
|
|
151
190
|
*/
|
|
152
191
|
protected report(reference: string, data: string | number | object | Buffer, type: PayloadType, trim?: boolean): Promise<void>;
|
|
192
|
+
/**
|
|
193
|
+
* @description Stores evidence to a file in the specified directory structure
|
|
194
|
+
* @summary Internal method to handle file-based storage of test artifacts
|
|
195
|
+
* @param {string} reference - Reference identifier for the data
|
|
196
|
+
* @param {any} data - Data to be stored
|
|
197
|
+
* @param {PayloadType} type - Type of the payload
|
|
198
|
+
* @param {string} extension - File extension to use
|
|
199
|
+
* @return {Promise<void>}
|
|
200
|
+
*/
|
|
201
|
+
private storeEvidence;
|
|
153
202
|
/**
|
|
154
203
|
* @description Reports data with a specified type
|
|
155
204
|
* @summary Wrapper method for reporting various types of data
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TestReporter.js","sourceRoot":"","sources":["../../src/tests/TestReporter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAwB;AACxB,4CAAoB;AACpB,0CAAoD;
|
|
1
|
+
{"version":3,"file":"TestReporter.js","sourceRoot":"","sources":["../../src/tests/TestReporter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAwB;AACxB,4CAAoB;AACpB,0CAAoD;AA0CpD;;;;;GAKG;AACU,QAAA,2BAA2B,GAAG,mCAAmC,CAAC;AAE/E;;;;;GAKG;AACU,QAAA,gCAAgC,GAAG,+BAA+B,CAAC;AAEhF;;;;;GAKG;AACU,QAAA,6BAA6B,GAAG,4BAA4B,CAAC;AAE1E;;;;;GAKG;AACH,MAAM,YAAY,GAAG,CAAC,qBAAqB,EAAE,SAAS,EAAE,qBAAqB,CAAC,CAAC;AAE/E;;;;;;;;GAQG;AACH,KAAK,UAAU,eAAe,CAAI,aAAyB;IACzD,mEAAmE;IACnE,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAM,CAAC,CAAC;AAC/D,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,MAAa,YAAY;IAwBvB;;;;OAIG;IACI,MAAM,KAAK,cAAc;QA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Ac;QACjD,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;CACF;AAhZD,oCAgZC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decaf-ts/utils",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.18",
|
|
4
4
|
"description": "module management utils for decaf-ts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -99,10 +99,10 @@
|
|
|
99
99
|
"dependencies": {
|
|
100
100
|
"@decaf-ts/logging": "latest",
|
|
101
101
|
"@eslint/js": "^9.25.1",
|
|
102
|
-
"@rollup/plugin-commonjs": "^
|
|
102
|
+
"@rollup/plugin-commonjs": "^29.0.2",
|
|
103
103
|
"@rollup/plugin-json": "^6.1.0",
|
|
104
104
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
105
|
-
"@rollup/plugin-terser": "^0.
|
|
105
|
+
"@rollup/plugin-terser": "^1.0.0",
|
|
106
106
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
107
107
|
"@stylistic/eslint-plugin": "^4.2.0",
|
|
108
108
|
"@types/jest": "^30.0.0",
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
"prettier": "3.5.3",
|
|
127
127
|
"prompts": "^2.4.2",
|
|
128
128
|
"rimraf": "^6.0.1",
|
|
129
|
-
"rollup": "^4.
|
|
129
|
+
"rollup": "^4.59.0",
|
|
130
130
|
"shell-quote": "^1.8.3",
|
|
131
131
|
"styled-string-builder": "latest",
|
|
132
132
|
"ts-jest": "^29.4.6",
|
|
@@ -136,10 +136,5 @@
|
|
|
136
136
|
"typed-object-accumulator": "latest",
|
|
137
137
|
"typescript": "^5.8.3",
|
|
138
138
|
"typescript-eslint": "^8.31.0"
|
|
139
|
-
},
|
|
140
|
-
"overrides": {
|
|
141
|
-
"minimatch": "^10.2.2",
|
|
142
|
-
"test-exclude": "7.0.1",
|
|
143
|
-
"serialize-javascript": "^7.0.3"
|
|
144
139
|
}
|
|
145
140
|
}
|