@testomatio/reporter 2.0.1-beta.3 → 2.0.1-beta.5-timestamp
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/adapter/codecept.js +335 -293
- package/lib/adapter/cucumber/current.js +203 -195
- package/lib/adapter/cucumber/legacy.js +155 -130
- package/lib/adapter/cucumber.js +16 -5
- package/lib/adapter/cypress-plugin/index.js +105 -91
- package/lib/adapter/jasmine.js +53 -54
- package/lib/adapter/jest.js +99 -97
- package/lib/adapter/mocha.js +141 -112
- package/lib/adapter/playwright.js +231 -199
- package/lib/adapter/vitest.js +149 -150
- package/lib/adapter/webdriver.js +121 -144
- package/lib/bin/cli.js +211 -229
- package/lib/bin/reportXml.js +52 -51
- package/lib/bin/startTest.js +95 -83
- package/lib/bin/uploadArtifacts.js +61 -56
- package/lib/client.js +465 -424
- package/lib/config.js +23 -18
- package/lib/constants.js +44 -50
- package/lib/data-storage.js +188 -216
- package/lib/junit-adapter/adapter.js +20 -17
- package/lib/junit-adapter/csharp.js +14 -28
- package/lib/junit-adapter/index.js +25 -27
- package/lib/junit-adapter/java.js +53 -41
- package/lib/junit-adapter/javascript.js +27 -30
- package/lib/junit-adapter/python.js +37 -38
- package/lib/junit-adapter/ruby.js +8 -11
- package/lib/output.js +52 -44
- package/lib/pipe/bitbucket.js +230 -223
- package/lib/pipe/csv.js +126 -113
- package/lib/pipe/debug.js +99 -118
- package/lib/pipe/github.js +213 -218
- package/lib/pipe/gitlab.js +206 -183
- package/lib/pipe/html.js +321 -258
- package/lib/pipe/index.js +66 -94
- package/lib/pipe/testomatio.js +474 -429
- package/lib/reporter-functions.js +26 -28
- package/lib/reporter.js +29 -34
- package/lib/services/artifacts.js +51 -55
- package/lib/services/index.js +12 -14
- package/lib/services/key-values.js +53 -56
- package/lib/services/logger.js +245 -226
- package/lib/template/testomatio.hbs +1366 -1026
- package/lib/uploader.js +364 -295
- package/lib/utils/pipe_utils.js +85 -89
- package/lib/utils/utils.js +307 -398
- package/lib/xmlReader.js +532 -525
- package/package.json +21 -64
- package/lib/adapter/codecept.d.ts +0 -2
- package/lib/adapter/cucumber/current.d.ts +0 -14
- package/lib/adapter/cucumber/legacy.d.ts +0 -0
- package/lib/adapter/cucumber.d.ts +0 -2
- package/lib/adapter/cypress-plugin/index.d.ts +0 -2
- package/lib/adapter/jasmine.d.ts +0 -11
- package/lib/adapter/jest.d.ts +0 -13
- package/lib/adapter/mocha.d.ts +0 -2
- package/lib/adapter/nightwatch.d.ts +0 -4
- package/lib/adapter/nightwatch.js +0 -80
- package/lib/adapter/playwright.d.ts +0 -14
- package/lib/adapter/vitest.d.ts +0 -35
- package/lib/adapter/webdriver.d.ts +0 -24
- package/lib/bin/cli.d.ts +0 -2
- package/lib/bin/reportXml.d.ts +0 -2
- package/lib/bin/startTest.d.ts +0 -2
- package/lib/bin/uploadArtifacts.d.ts +0 -2
- package/lib/client.d.ts +0 -76
- package/lib/config.d.ts +0 -1
- package/lib/constants.d.ts +0 -25
- package/lib/data-storage.d.ts +0 -34
- package/lib/junit-adapter/adapter.d.ts +0 -9
- package/lib/junit-adapter/csharp.d.ts +0 -5
- package/lib/junit-adapter/index.d.ts +0 -3
- package/lib/junit-adapter/java.d.ts +0 -5
- package/lib/junit-adapter/javascript.d.ts +0 -4
- package/lib/junit-adapter/python.d.ts +0 -5
- package/lib/junit-adapter/ruby.d.ts +0 -4
- package/lib/output.d.ts +0 -11
- package/lib/package.json +0 -3
- package/lib/pipe/bitbucket.d.ts +0 -25
- package/lib/pipe/csv.d.ts +0 -47
- package/lib/pipe/debug.d.ts +0 -29
- package/lib/pipe/github.d.ts +0 -30
- package/lib/pipe/gitlab.d.ts +0 -25
- package/lib/pipe/html.d.ts +0 -35
- package/lib/pipe/index.d.ts +0 -1
- package/lib/pipe/testomatio.d.ts +0 -71
- package/lib/replay.d.ts +0 -31
- package/lib/replay.js +0 -237
- package/lib/reporter-functions.d.ts +0 -34
- package/lib/reporter.d.ts +0 -232
- package/lib/services/artifacts.d.ts +0 -33
- package/lib/services/index.d.ts +0 -9
- package/lib/services/key-values.d.ts +0 -27
- package/lib/services/logger.d.ts +0 -64
- package/lib/uploader.d.ts +0 -60
- package/lib/utils/pipe_utils.d.ts +0 -41
- package/lib/utils/utils.d.ts +0 -54
- package/lib/xmlReader.d.ts +0 -92
- package/src/adapter/codecept.js +0 -373
- package/src/adapter/cucumber/current.js +0 -228
- package/src/adapter/cucumber/legacy.js +0 -158
- package/src/adapter/cucumber.js +0 -4
- package/src/adapter/cypress-plugin/index.js +0 -110
- package/src/adapter/jasmine.js +0 -60
- package/src/adapter/jest.js +0 -107
- package/src/adapter/mocha.cjs +0 -2
- package/src/adapter/mocha.js +0 -156
- package/src/adapter/nightwatch.js +0 -88
- package/src/adapter/playwright.js +0 -254
- package/src/adapter/vitest.js +0 -183
- package/src/adapter/webdriver.js +0 -142
- package/src/bin/cli.js +0 -348
- package/src/bin/reportXml.js +0 -77
- package/src/bin/startTest.js +0 -124
- package/src/bin/uploadArtifacts.js +0 -91
- package/src/client.js +0 -508
- package/src/config.js +0 -30
- package/src/constants.js +0 -53
- package/src/data-storage.js +0 -204
- package/src/junit-adapter/adapter.js +0 -23
- package/src/junit-adapter/csharp.js +0 -28
- package/src/junit-adapter/index.js +0 -28
- package/src/junit-adapter/java.js +0 -58
- package/src/junit-adapter/javascript.js +0 -31
- package/src/junit-adapter/python.js +0 -42
- package/src/junit-adapter/ruby.js +0 -10
- package/src/output.js +0 -57
- package/src/pipe/bitbucket.js +0 -252
- package/src/pipe/csv.js +0 -140
- package/src/pipe/debug.js +0 -119
- package/src/pipe/github.js +0 -232
- package/src/pipe/gitlab.js +0 -247
- package/src/pipe/html.js +0 -373
- package/src/pipe/index.js +0 -71
- package/src/pipe/testomatio.js +0 -504
- package/src/replay.js +0 -245
- package/src/reporter-functions.js +0 -55
- package/src/reporter.cjs_decprecated +0 -21
- package/src/reporter.js +0 -33
- package/src/services/artifacts.js +0 -59
- package/src/services/index.js +0 -13
- package/src/services/key-values.js +0 -59
- package/src/services/logger.js +0 -315
- package/src/template/emptyData.svg +0 -23
- package/src/template/testomatio.hbs +0 -1081
- package/src/uploader.js +0 -376
- package/src/utils/pipe_utils.js +0 -119
- package/src/utils/utils.js +0 -416
- package/src/xmlReader.js +0 -614
package/lib/client.js
CHANGED
|
@@ -1,456 +1,497 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.Client = void 0;
|
|
40
|
-
const debug_1 = __importDefault(require("debug"));
|
|
41
|
-
const callsite_record_1 = __importDefault(require("callsite-record"));
|
|
42
|
-
const minimatch_1 = require("minimatch");
|
|
43
|
-
const fs_1 = __importDefault(require("fs"));
|
|
44
|
-
const picocolors_1 = __importDefault(require("picocolors"));
|
|
45
|
-
const crypto_1 = require("crypto");
|
|
46
|
-
const constants_js_1 = require("./constants.js");
|
|
47
|
-
const index_js_1 = require("./pipe/index.js");
|
|
48
|
-
const glob_1 = require("glob");
|
|
49
|
-
const path_1 = __importStar(require("path"));
|
|
50
|
-
const node_url_1 = require("node:url");
|
|
51
|
-
const uploader_js_1 = require("./uploader.js");
|
|
52
|
-
const utils_js_1 = require("./utils/utils.js");
|
|
53
|
-
const filesize_1 = require("filesize");
|
|
54
|
-
const debug = (0, debug_1.default)('@testomatio/reporter:client');
|
|
55
|
-
// removed __dirname usage, because:
|
|
56
|
-
// 1. replaced with ESM syntax (import.meta.url), but it throws an error on tsc compilation;
|
|
57
|
-
// 2. got error "__dirname already defined" in compiles js code (cjs dir)
|
|
1
|
+
const debug = require('debug')('@testomatio/reporter:client');
|
|
2
|
+
const createCallsiteRecord = require('callsite-record');
|
|
3
|
+
const { sep, join } = require('path');
|
|
4
|
+
const { minimatch } = require('minimatch');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const chalk = require('chalk');
|
|
7
|
+
const { randomUUID } = require('crypto');
|
|
8
|
+
const S3Uploader = require('./uploader');
|
|
9
|
+
const { APP_PREFIX, STATUS } = require('./constants');
|
|
10
|
+
const pipesFactory = require('./pipe');
|
|
11
|
+
const { glob } = require('glob');
|
|
12
|
+
const path = require('path');
|
|
13
|
+
const { storeRunId, formatStep } = require('./utils/utils');
|
|
14
|
+
const { filesize: prettyBytes } = require('filesize');
|
|
15
|
+
|
|
58
16
|
let listOfTestFilesToExcludeFromReport = null;
|
|
17
|
+
|
|
59
18
|
/**
|
|
60
|
-
* @typedef {import('../types
|
|
61
|
-
* @typedef {import('../types
|
|
19
|
+
* @typedef {import('../types').TestData} TestData
|
|
20
|
+
* @typedef {import('../types').RunStatus} RunStatus
|
|
21
|
+
* @typedef {import('../types').PipeResult} PipeResult
|
|
62
22
|
*/
|
|
23
|
+
|
|
63
24
|
class Client {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Create a Testomat client instance
|
|
27
|
+
*
|
|
28
|
+
* @param {*} params
|
|
29
|
+
*/
|
|
30
|
+
constructor(params = {}) {
|
|
31
|
+
this.pipeStore = {};
|
|
32
|
+
this.runId = randomUUID(); // will be replaced by real run id
|
|
33
|
+
this.pipes = pipesFactory(params, this.pipeStore);
|
|
34
|
+
this.queue = Promise.resolve();
|
|
35
|
+
this.version = JSON.parse(fs.readFileSync(join(__dirname, '..', 'package.json')).toString()).version;
|
|
36
|
+
this.executionList = Promise.resolve();
|
|
37
|
+
this.uploader = new S3Uploader();
|
|
38
|
+
|
|
39
|
+
console.log(APP_PREFIX, `Testomatio Reporter v${this.version}`);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Asynchronously prepares the execution list for running tests through various pipes.
|
|
44
|
+
* Each pipe in the client is checked for enablement,
|
|
45
|
+
* and if all pipes are disabled, the function returns a resolved Promise.
|
|
46
|
+
* Otherwise, it executes the `prepareRun` method for each enabled pipe and collects the results.
|
|
47
|
+
* The results are then filtered to remove any undefined values.
|
|
48
|
+
* If no valid results are found, the function returns undefined.
|
|
49
|
+
* Otherwise, it returns the first non-empty array from the filtered results.
|
|
50
|
+
*
|
|
51
|
+
* @param {Object} params - The options for preparing the test execution list.
|
|
52
|
+
* @param {string} params.pipe - Name of the executed pipe.
|
|
53
|
+
* @param {string} params.pipeOptions - Filter option.
|
|
54
|
+
* @returns {Promise<any>} - A Promise that resolves to an
|
|
55
|
+
* array containing the prepared execution list,
|
|
56
|
+
* or resolves to undefined if no valid results are found or if all pipes are disabled.
|
|
57
|
+
*/
|
|
58
|
+
async prepareRun(params) {
|
|
59
|
+
const { pipe, pipeOptions } = params;
|
|
60
|
+
// all pipes disabled, skipping
|
|
61
|
+
if (!this.pipes.some(p => p.isEnabled)) {
|
|
62
|
+
return Promise.resolve();
|
|
84
63
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
const results = await Promise.all(this.pipes.map(async (p) => ({ pipe: p.toString(), result: await p.prepareRun(pipeOptions) })));
|
|
116
|
-
const result = results.filter(p => p.pipe.includes('Testomatio'))[0]?.result;
|
|
117
|
-
if (!result || result.length === 0) {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
debug('Execution tests list', result);
|
|
121
|
-
return result;
|
|
122
|
-
}
|
|
123
|
-
catch (err) {
|
|
124
|
-
console.error(constants_js_1.APP_PREFIX, err);
|
|
125
|
-
}
|
|
64
|
+
|
|
65
|
+
try {
|
|
66
|
+
const filterPipe = this.pipes.find(p => p.constructor.name.toLowerCase() === `${pipe.toLowerCase()}pipe`);
|
|
67
|
+
|
|
68
|
+
if (!filterPipe?.isEnabled) {
|
|
69
|
+
// TODO:for the future for the another pipes
|
|
70
|
+
console.warn(
|
|
71
|
+
APP_PREFIX,
|
|
72
|
+
`At the moment processing is available only for the "testomatio" key. Example: "testomatio:tag-name=xxx"`,
|
|
73
|
+
);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const results = await Promise.all(
|
|
78
|
+
this.pipes.map(async p => ({ pipe: p.toString(), result: await p.prepareRun(pipeOptions) })),
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
const result = results.filter(p => p.pipe.includes('Testomatio'))[0]?.result;
|
|
82
|
+
|
|
83
|
+
if (!result || result.length === 0) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
debug('Execution tests list', result);
|
|
88
|
+
|
|
89
|
+
return result;
|
|
90
|
+
} catch (err) {
|
|
91
|
+
console.error(APP_PREFIX, err);
|
|
126
92
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Used to create a new Test run
|
|
97
|
+
*
|
|
98
|
+
* @returns {Promise<any>} - resolves to Run id which should be used to update / add test
|
|
99
|
+
*/
|
|
100
|
+
createRun() {
|
|
101
|
+
debug('Creating run...');
|
|
102
|
+
// all pipes disabled, skipping
|
|
103
|
+
if (!this.pipes?.filter(p => p.isEnabled).length) return Promise.resolve();
|
|
104
|
+
|
|
105
|
+
this.queue = this.queue
|
|
106
|
+
.then(() => Promise.all(this.pipes.map(p => p.createRun())))
|
|
107
|
+
.catch(err => console.log(APP_PREFIX, err))
|
|
108
|
+
.then(() => {
|
|
109
|
+
const runId = this.pipeStore?.runId;
|
|
110
|
+
if (runId) this.runId = runId;
|
|
111
|
+
storeRunId(this.runId);
|
|
112
|
+
})
|
|
113
|
+
.then(() => {
|
|
114
|
+
this.uploader.checkEnabled();
|
|
115
|
+
})
|
|
116
|
+
.then(() => undefined); // fixes return type
|
|
117
|
+
|
|
118
|
+
// debug('Run', this.queue);
|
|
119
|
+
return this.queue;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Updates test status and its data
|
|
124
|
+
*
|
|
125
|
+
* @param {string|undefined} status
|
|
126
|
+
* @param {TestData} [testData]
|
|
127
|
+
* @returns {Promise<PipeResult[]>}
|
|
128
|
+
*/
|
|
129
|
+
async addTestRun(status, testData) {
|
|
130
|
+
// all pipes disabled, skipping
|
|
131
|
+
if (!this.pipes?.filter(p => p.isEnabled).length) return [];
|
|
132
|
+
|
|
133
|
+
if (isTestShouldBeExculedFromReport(testData)) return [];
|
|
134
|
+
|
|
135
|
+
if (status === STATUS.SKIPPED && process.env.TESTOMATIO_EXCLUDE_SKIPPED) {
|
|
136
|
+
debug('Skipping test from report', testData?.title);
|
|
137
|
+
return []; // do not log skipped tests
|
|
152
138
|
}
|
|
139
|
+
|
|
140
|
+
if (!testData)
|
|
141
|
+
testData = {
|
|
142
|
+
title: 'Unknown test',
|
|
143
|
+
suite_title: 'Unknown suite',
|
|
144
|
+
};
|
|
145
|
+
|
|
153
146
|
/**
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
* @param {string|undefined} status
|
|
157
|
-
* @param {TestData} [testData]
|
|
158
|
-
* @returns {Promise<PipeResult[]>}
|
|
147
|
+
* @type {TestData}
|
|
159
148
|
*/
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
149
|
+
const {
|
|
150
|
+
rid,
|
|
151
|
+
error = null,
|
|
152
|
+
time = 0,
|
|
153
|
+
example = null,
|
|
154
|
+
files = [],
|
|
155
|
+
filesBuffers = [],
|
|
156
|
+
steps,
|
|
157
|
+
code = null,
|
|
158
|
+
title,
|
|
159
|
+
file,
|
|
160
|
+
suite_title,
|
|
161
|
+
suite_id,
|
|
162
|
+
test_id,
|
|
163
|
+
manuallyAttachedArtifacts,
|
|
164
|
+
} = testData;
|
|
165
|
+
let { message = '', meta = {} } = testData;
|
|
166
|
+
|
|
167
|
+
// stringify meta values and limit keys and values length to 255
|
|
168
|
+
meta = Object.entries(meta)
|
|
169
|
+
.filter(([, value]) => value !== null && value !== undefined)
|
|
170
|
+
.map(([key, value]) => {
|
|
171
|
+
try {
|
|
172
|
+
if (typeof value === 'object') {
|
|
173
|
+
value = JSON.stringify(value);
|
|
174
|
+
} else if (typeof value !== 'string') {
|
|
184
175
|
try {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
else if (typeof value !== 'string') {
|
|
189
|
-
try {
|
|
190
|
-
value = value.toString();
|
|
191
|
-
}
|
|
192
|
-
catch (err) {
|
|
193
|
-
console.warn(constants_js_1.APP_PREFIX, `Can't convert meta value to string`, err);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
if (value?.length > 255) {
|
|
197
|
-
value = value.substring(0, 255);
|
|
198
|
-
debug(constants_js_1.APP_PREFIX, `Meta info value "${value}" is too long, trimmed to 255 characters`);
|
|
199
|
-
}
|
|
200
|
-
if (key?.length > 255) {
|
|
201
|
-
const newKey = key.substring(0, 255);
|
|
202
|
-
debug(constants_js_1.APP_PREFIX, `Meta info key "${key}" is too long, trimmed to 255 characters`);
|
|
203
|
-
return [newKey, value];
|
|
204
|
-
}
|
|
205
|
-
return [key, value];
|
|
206
|
-
}
|
|
207
|
-
catch (err) {
|
|
208
|
-
debug(constants_js_1.APP_PREFIX, `Error while processing meta info key ${key}`, err);
|
|
209
|
-
return [null, null];
|
|
210
|
-
}
|
|
211
|
-
})
|
|
212
|
-
.reduce((acc, [key, value]) => {
|
|
213
|
-
if (key)
|
|
214
|
-
acc[key] = value;
|
|
215
|
-
return acc;
|
|
216
|
-
}, {});
|
|
217
|
-
let errorFormatted = '';
|
|
218
|
-
if (error) {
|
|
219
|
-
errorFormatted += this.formatError(error) || '';
|
|
220
|
-
message = error?.message;
|
|
221
|
-
}
|
|
222
|
-
// Attach logs
|
|
223
|
-
const fullLogs = this.formatLogs({ error: errorFormatted, steps, logs: testData.logs });
|
|
224
|
-
// add artifacts
|
|
225
|
-
if (manuallyAttachedArtifacts?.length)
|
|
226
|
-
files.push(...manuallyAttachedArtifacts);
|
|
227
|
-
const uploadedFiles = [];
|
|
228
|
-
for (let f of files) {
|
|
229
|
-
if (!f)
|
|
230
|
-
continue; // f === null
|
|
231
|
-
if (typeof f === 'object') {
|
|
232
|
-
if (!f.path)
|
|
233
|
-
continue;
|
|
234
|
-
f = f.path;
|
|
176
|
+
value = value.toString();
|
|
177
|
+
} catch (err) {
|
|
178
|
+
console.warn(APP_PREFIX, `Can't convert meta value to string`, err);
|
|
235
179
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (value?.length > 255) {
|
|
183
|
+
value = value.substring(0, 255);
|
|
184
|
+
debug(APP_PREFIX, `Meta info value "${value}" is too long, trimmed to 255 characters`);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (key?.length > 255) {
|
|
188
|
+
const newKey = key.substring(0, 255);
|
|
189
|
+
debug(APP_PREFIX, `Meta info key "${key}" is too long, trimmed to 255 characters`);
|
|
190
|
+
return [newKey, value];
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return [key, value];
|
|
194
|
+
} catch (err) {
|
|
195
|
+
debug(APP_PREFIX, `Error while processing meta info key ${key}`, err);
|
|
196
|
+
return [null, null];
|
|
241
197
|
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
file: relativeFile,
|
|
254
|
-
code,
|
|
255
|
-
title,
|
|
256
|
-
suite_title,
|
|
257
|
-
suite_id,
|
|
258
|
-
test_id,
|
|
259
|
-
message,
|
|
260
|
-
run_time: typeof time === 'number' ? time : parseFloat(time),
|
|
261
|
-
artifacts,
|
|
262
|
-
meta,
|
|
263
|
-
...(rootSuiteId && { root_suite_id: rootSuiteId }),
|
|
264
|
-
};
|
|
265
|
-
// debug('Adding test run...', data);
|
|
266
|
-
// @ts-ignore
|
|
267
|
-
this.queue = this.queue.then(() => Promise.all(this.pipes.map(async (pipe) => {
|
|
268
|
-
try {
|
|
269
|
-
const result = await pipe.addTest(data);
|
|
270
|
-
return { pipe: pipe.toString(), result };
|
|
271
|
-
}
|
|
272
|
-
catch (err) {
|
|
273
|
-
console.log(constants_js_1.APP_PREFIX, pipe.toString(), err);
|
|
274
|
-
}
|
|
275
|
-
})));
|
|
276
|
-
// @ts-ignore
|
|
277
|
-
return this.queue;
|
|
198
|
+
})
|
|
199
|
+
.reduce((acc, [key, value]) => {
|
|
200
|
+
if (key) acc[key] = value;
|
|
201
|
+
return acc;
|
|
202
|
+
}, {});
|
|
203
|
+
|
|
204
|
+
let errorFormatted = '';
|
|
205
|
+
|
|
206
|
+
if (error) {
|
|
207
|
+
errorFormatted += this.formatError(error) || '';
|
|
208
|
+
message = error?.message;
|
|
278
209
|
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
return;
|
|
298
|
-
const filesizeStrMaxLength = 7;
|
|
299
|
-
if (this.uploader.successfulUploads.length) {
|
|
300
|
-
debug('\n', constants_js_1.APP_PREFIX, `🗄️ ${this.uploader.successfulUploads.length} artifacts uploaded to S3 bucket`);
|
|
301
|
-
const uploadedArtifacts = this.uploader.successfulUploads.map(file => ({
|
|
302
|
-
relativePath: file.path.replace(process.cwd(), ''),
|
|
303
|
-
link: file.link,
|
|
304
|
-
sizePretty: (0, filesize_1.filesize)(file.size, { round: 0 }).toString(),
|
|
305
|
-
}));
|
|
306
|
-
uploadedArtifacts.forEach(upload => {
|
|
307
|
-
debug(`🟢Uploaded artifact`, `${upload.relativePath},`, 'size:', `${upload.sizePretty},`, 'link:', `${upload.link}`);
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
if (this.uploader.failedUploads.length) {
|
|
311
|
-
console.log(constants_js_1.APP_PREFIX, `🗄️ ${this.uploader.failedUploads.length} artifacts 🔴${picocolors_1.default.bold('failed')} to upload`);
|
|
312
|
-
const failedUploads = this.uploader.failedUploads.map(file => ({
|
|
313
|
-
relativePath: file.path.replace(process.cwd(), ''),
|
|
314
|
-
sizePretty: (0, filesize_1.filesize)(file.size, { round: 0 }).toString(),
|
|
315
|
-
}));
|
|
316
|
-
const pathPadding = Math.max(...failedUploads.map(upload => upload.relativePath.length)) + 1;
|
|
317
|
-
failedUploads.forEach(upload => {
|
|
318
|
-
console.log(` ${picocolors_1.default.gray('|')} 🔴 ${upload.relativePath.padEnd(pathPadding)} ${picocolors_1.default.gray(`| ${upload.sizePretty.padStart(filesizeStrMaxLength)} |`)}`);
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
if (this.uploader.skippedUploads.length) {
|
|
322
|
-
console.log('\n', constants_js_1.APP_PREFIX, `🗄️ ${picocolors_1.default.bold(this.uploader.skippedUploads.length)} artifacts uploading 🟡${picocolors_1.default.bold('skipped')}`);
|
|
323
|
-
const skippedUploads = this.uploader.skippedUploads.map(file => ({
|
|
324
|
-
relativePath: file.path.replace(process.cwd(), ''),
|
|
325
|
-
sizePretty: file.size === null ? 'unknown' : (0, filesize_1.filesize)(file.size, { round: 0 }).toString(),
|
|
326
|
-
}));
|
|
327
|
-
const pathPadding = Math.max(...skippedUploads.map(upload => upload.relativePath.length)) + 1;
|
|
328
|
-
skippedUploads.forEach(upload => {
|
|
329
|
-
console.log(` ${picocolors_1.default.gray('|')} 🟡 ${upload.relativePath.padEnd(pathPadding)} ${picocolors_1.default.gray(`| ${upload.sizePretty.padStart(filesizeStrMaxLength)} |`)}`);
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
if (this.uploader.skippedUploads.length || this.uploader.failedUploads.length) {
|
|
333
|
-
const command = `TESTOMATIO=<your_api_key> TESTOMATIO_RUN=${this.runId} npx @testomatio/reporter upload-artifacts`;
|
|
334
|
-
const numberOfNotUploadedArtifacts = this.uploader.skippedUploads.length + this.uploader.failedUploads.length;
|
|
335
|
-
console.log(constants_js_1.APP_PREFIX, `${numberOfNotUploadedArtifacts} artifacts were not uploaded.
|
|
336
|
-
Run "${picocolors_1.default.magenta(command)}" with valid S3 credentials to upload skipped & failed artifacts`);
|
|
337
|
-
}
|
|
338
|
-
})
|
|
339
|
-
.catch(err => console.log(constants_js_1.APP_PREFIX, err));
|
|
340
|
-
return this.queue;
|
|
210
|
+
|
|
211
|
+
// Attach logs
|
|
212
|
+
const fullLogs = this.formatLogs({ error: errorFormatted, steps, logs: testData.logs });
|
|
213
|
+
|
|
214
|
+
// add artifacts
|
|
215
|
+
if (manuallyAttachedArtifacts?.length) files.push(...manuallyAttachedArtifacts);
|
|
216
|
+
|
|
217
|
+
const uploadedFiles = [];
|
|
218
|
+
|
|
219
|
+
for (let f of files) {
|
|
220
|
+
if (!f) continue; // f === null
|
|
221
|
+
if (typeof f === 'object') {
|
|
222
|
+
if (!f.path) continue;
|
|
223
|
+
|
|
224
|
+
f = f.path;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
uploadedFiles.push(this.uploader.uploadFileByPath(f, [this.runId, rid, path.basename(f)]));
|
|
341
228
|
}
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
formatLogs({ error, steps, logs }) {
|
|
347
|
-
error = error?.trim();
|
|
348
|
-
logs = logs?.trim();
|
|
349
|
-
if (Array.isArray(steps)) {
|
|
350
|
-
steps = steps
|
|
351
|
-
.map(step => (0, utils_js_1.formatStep)(step))
|
|
352
|
-
.flat()
|
|
353
|
-
.join('\n');
|
|
354
|
-
}
|
|
355
|
-
let testLogs = '';
|
|
356
|
-
if (steps)
|
|
357
|
-
testLogs += `${picocolors_1.default.bold(picocolors_1.default.blue('################[ Steps ]################'))}\n${steps}\n\n`;
|
|
358
|
-
if (logs)
|
|
359
|
-
testLogs += `${picocolors_1.default.bold(picocolors_1.default.gray('################[ Logs ]################'))}\n${logs}\n\n`;
|
|
360
|
-
if (error)
|
|
361
|
-
testLogs += `${picocolors_1.default.bold(picocolors_1.default.red('################[ Failure ]################'))}\n${error}`;
|
|
362
|
-
return testLogs;
|
|
229
|
+
|
|
230
|
+
for (const [idx, buffer] of filesBuffers.entries()) {
|
|
231
|
+
const fileName = `${idx + 1}-${title.replace(/\s+/g, '-')}`;
|
|
232
|
+
uploadedFiles.push(this.uploader.uploadFileAsBuffer(buffer, [this.runId, rid, fileName]));
|
|
363
233
|
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
234
|
+
|
|
235
|
+
const artifacts = (await Promise.all(uploadedFiles)).filter(n => !!n);
|
|
236
|
+
|
|
237
|
+
const data = {
|
|
238
|
+
rid,
|
|
239
|
+
files,
|
|
240
|
+
steps,
|
|
241
|
+
status,
|
|
242
|
+
stack: fullLogs,
|
|
243
|
+
example,
|
|
244
|
+
file,
|
|
245
|
+
code,
|
|
246
|
+
title,
|
|
247
|
+
suite_title,
|
|
248
|
+
suite_id,
|
|
249
|
+
test_id,
|
|
250
|
+
message,
|
|
251
|
+
run_time: typeof time === 'number' ? time : parseFloat(time),
|
|
252
|
+
artifacts,
|
|
253
|
+
meta,
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
// debug('Adding test run...', data);
|
|
257
|
+
|
|
258
|
+
this.queue = this.queue.then(() =>
|
|
259
|
+
Promise.all(
|
|
260
|
+
this.pipes.map(async pipe => {
|
|
261
|
+
try {
|
|
262
|
+
const result = await pipe.addTest(data);
|
|
263
|
+
return { pipe: pipe.toString(), result };
|
|
264
|
+
} catch (err) {
|
|
265
|
+
console.log(APP_PREFIX, pipe.toString(), err);
|
|
266
|
+
}
|
|
267
|
+
}),
|
|
268
|
+
),
|
|
269
|
+
);
|
|
270
|
+
|
|
271
|
+
return this.queue;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
*
|
|
276
|
+
* Updates the status of the current test run and finishes the run.
|
|
277
|
+
* @param {'passed' | 'failed' | 'skipped' | 'finished'} status - The status of the current test run.
|
|
278
|
+
* Must be one of "passed", "failed", or "finished"
|
|
279
|
+
* @param {boolean} [isParallel] - Whether the current test run was executed in parallel with other tests.
|
|
280
|
+
* @returns {Promise<any>} - A Promise that resolves when finishes the run.
|
|
281
|
+
*/
|
|
282
|
+
updateRunStatus(status, isParallel = false) {
|
|
283
|
+
debug('Updating run status...');
|
|
284
|
+
// all pipes disabled, skipping
|
|
285
|
+
if (!this.pipes?.filter(p => p.isEnabled).length) return Promise.resolve();
|
|
286
|
+
|
|
287
|
+
const runParams = { status, parallel: isParallel };
|
|
288
|
+
|
|
289
|
+
this.queue = this.queue
|
|
290
|
+
.then(() => Promise.all(this.pipes.map(p => p.finishRun(runParams))))
|
|
291
|
+
.then(() => {
|
|
292
|
+
if (!this.uploader.isEnabled) return;
|
|
293
|
+
|
|
294
|
+
if (this.uploader.successfulUploads.length) {
|
|
295
|
+
console.log(
|
|
296
|
+
APP_PREFIX,
|
|
297
|
+
`🗄️ ${this.uploader.successfulUploads.length} artifacts ${
|
|
298
|
+
process.env.TESTOMATIO_PRIVATE_ARTIFACTS ? 'privately' : chalk.bold('publicly')
|
|
299
|
+
} 🟢uploaded to S3 bucket`,
|
|
300
|
+
);
|
|
382
301
|
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
302
|
+
|
|
303
|
+
const filesizeStrMaxLength = 7;
|
|
304
|
+
|
|
305
|
+
if (this.uploader.successfulUploads.length) {
|
|
306
|
+
debug('\n', APP_PREFIX, `🗄️ ${this.uploader.successfulUploads.length} artifacts uploaded to S3 bucket`);
|
|
307
|
+
const uploadedArtifacts = this.uploader.successfulUploads.map(file => ({
|
|
308
|
+
relativePath: file.path.replace(process.cwd(), ''),
|
|
309
|
+
link: file.link,
|
|
310
|
+
sizePretty: prettyBytes(file.size, { round: 0 }).toString(),
|
|
311
|
+
}));
|
|
312
|
+
|
|
313
|
+
uploadedArtifacts.forEach(upload => {
|
|
314
|
+
debug(
|
|
315
|
+
`🟢Uploaded artifact`,
|
|
316
|
+
`${upload.relativePath},`,
|
|
317
|
+
'size:',
|
|
318
|
+
`${upload.sizePretty},`,
|
|
319
|
+
'link:',
|
|
320
|
+
`${upload.link}`,
|
|
321
|
+
);
|
|
322
|
+
});
|
|
389
323
|
}
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
324
|
+
|
|
325
|
+
if (this.uploader.failedUploads.length) {
|
|
326
|
+
console.log(
|
|
327
|
+
'\n',
|
|
328
|
+
APP_PREFIX,
|
|
329
|
+
`🗄️ ${this.uploader.failedUploads.length} artifacts 🔴${chalk.bold('failed')} to upload`,
|
|
330
|
+
);
|
|
331
|
+
const failedUploads = this.uploader.failedUploads.map(file => ({
|
|
332
|
+
relativePath: file.path.replace(process.cwd(), ''),
|
|
333
|
+
sizePretty: prettyBytes(file.size, { round: 0 }).toString(),
|
|
334
|
+
}));
|
|
335
|
+
|
|
336
|
+
const pathPadding = Math.max(...failedUploads.map(upload => upload.relativePath.length)) + 1;
|
|
337
|
+
|
|
338
|
+
failedUploads.forEach(upload => {
|
|
339
|
+
console.log(
|
|
340
|
+
` ${chalk.gray('|')} 🔴 ${upload.relativePath.padEnd(pathPadding)} ${chalk.gray(
|
|
341
|
+
`| ${upload.sizePretty.padStart(filesizeStrMaxLength)} |`,
|
|
342
|
+
)}`,
|
|
343
|
+
);
|
|
344
|
+
});
|
|
410
345
|
}
|
|
411
|
-
|
|
412
|
-
|
|
346
|
+
|
|
347
|
+
if (this.uploader.skippedUploads.length) {
|
|
348
|
+
console.log(
|
|
349
|
+
'\n',
|
|
350
|
+
APP_PREFIX,
|
|
351
|
+
`🗄️ ${chalk.bold(this.uploader.skippedUploads.length)} artifacts uploading 🟡${chalk.bold('skipped')}`,
|
|
352
|
+
);
|
|
353
|
+
const skippedUploads = this.uploader.skippedUploads.map(file => ({
|
|
354
|
+
relativePath: file.path.replace(process.cwd(), ''),
|
|
355
|
+
sizePretty: file.size === null ? 'unknown' : prettyBytes(file.size, { round: 0 }).toString(),
|
|
356
|
+
}));
|
|
357
|
+
const pathPadding = Math.max(...skippedUploads.map(upload => upload.relativePath.length)) + 1;
|
|
358
|
+
skippedUploads.forEach(upload => {
|
|
359
|
+
console.log(
|
|
360
|
+
` ${chalk.gray('|')} 🟡 ${upload.relativePath.padEnd(pathPadding)} ${chalk.gray(
|
|
361
|
+
`| ${upload.sizePretty.padStart(filesizeStrMaxLength)} |`,
|
|
362
|
+
)}`,
|
|
363
|
+
);
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
if (this.uploader.skippedUploads.length || this.uploader.failedUploads.length) {
|
|
368
|
+
const command = `TESTOMATIO=<your_api_key> TESTOMATIO_RUN=${
|
|
369
|
+
this.runId
|
|
370
|
+
} npx @testomatio/reporter upload-artifacts`;
|
|
371
|
+
console.log(
|
|
372
|
+
APP_PREFIX,
|
|
373
|
+
`Run "${chalk.magenta(command)}" with valid S3 credentials to upload skipped & failed artifacts`,
|
|
374
|
+
);
|
|
413
375
|
}
|
|
376
|
+
})
|
|
377
|
+
.catch(err => console.log(APP_PREFIX, err));
|
|
378
|
+
|
|
379
|
+
return this.queue;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Returns the formatted stack including the stack trace, steps, and logs.
|
|
384
|
+
* @returns {string}
|
|
385
|
+
*/
|
|
386
|
+
formatLogs({ error, steps, logs }) {
|
|
387
|
+
error = error?.trim();
|
|
388
|
+
logs = logs?.trim();
|
|
389
|
+
|
|
390
|
+
if (Array.isArray(steps)) {
|
|
391
|
+
steps = steps
|
|
392
|
+
.map(step => formatStep(step))
|
|
393
|
+
.flat()
|
|
394
|
+
.join('\n');
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
let testLogs = '';
|
|
398
|
+
if (steps) testLogs += `${chalk.bold.blue('################[ Steps ]################')}\n${steps}\n\n`;
|
|
399
|
+
if (logs) testLogs += `${chalk.bold.gray('################[ Logs ]################')}\n${logs}\n\n`;
|
|
400
|
+
if (error) testLogs += `${chalk.bold.red('################[ Failure ]################')}\n${error}`;
|
|
401
|
+
return testLogs;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
formatError(error, message) {
|
|
405
|
+
if (!message) message = error.message;
|
|
406
|
+
if (error.inspect) message = error.inspect() || '';
|
|
407
|
+
|
|
408
|
+
let stack = '';
|
|
409
|
+
if (error.name) stack += `${chalk.red(error.name)}`;
|
|
410
|
+
if (error.operator) stack += ` (${chalk.red(error.operator)})`;
|
|
411
|
+
// add new line if something was added to stack
|
|
412
|
+
if (stack) stack += ': ';
|
|
413
|
+
|
|
414
|
+
stack += `${message}\n`;
|
|
415
|
+
|
|
416
|
+
if (error.diff) {
|
|
417
|
+
// diff for vitest
|
|
418
|
+
stack += error.diff;
|
|
419
|
+
stack += '\n\n';
|
|
420
|
+
} else if (error.actual && error.expected && error.actual !== error.expected) {
|
|
421
|
+
// diffs for mocha, cypress, codeceptjs style
|
|
422
|
+
stack += `\n\n${chalk.bold.green('+ expected')} ${chalk.bold.red('- actual')}`;
|
|
423
|
+
stack += `\n${chalk.green(`+ ${error.expected.toString().split('\n').join('\n+ ')}`)}`;
|
|
424
|
+
stack += `\n${chalk.red(`- ${error.actual.toString().split('\n').join('\n- ')}`)}`;
|
|
425
|
+
stack += '\n\n';
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
const customFilter = process.env.TESTOMATIO_STACK_IGNORE;
|
|
429
|
+
|
|
430
|
+
try {
|
|
431
|
+
let hasFrame = false;
|
|
432
|
+
const record = createCallsiteRecord({
|
|
433
|
+
forError: error,
|
|
434
|
+
isCallsiteFrame: frame => {
|
|
435
|
+
if (customFilter && minimatch(frame.getFileName(), customFilter)) return false;
|
|
436
|
+
if (hasFrame) return false;
|
|
437
|
+
if (isNotInternalFrame(frame)) hasFrame = true;
|
|
438
|
+
return hasFrame;
|
|
439
|
+
},
|
|
440
|
+
});
|
|
441
|
+
if (record && !record.filename.startsWith('http')) {
|
|
442
|
+
stack += record.renderSync({ stackFilter: isNotInternalFrame });
|
|
443
|
+
}
|
|
444
|
+
return stack;
|
|
445
|
+
} catch (e) {
|
|
446
|
+
console.log(e);
|
|
414
447
|
}
|
|
448
|
+
}
|
|
415
449
|
}
|
|
416
|
-
|
|
450
|
+
|
|
417
451
|
function isNotInternalFrame(frame) {
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
452
|
+
return (
|
|
453
|
+
frame.getFileName() &&
|
|
454
|
+
frame.getFileName().includes(sep) &&
|
|
455
|
+
!frame.getFileName().includes('node_modules') &&
|
|
456
|
+
!frame.getFileName().includes('internal')
|
|
457
|
+
);
|
|
422
458
|
}
|
|
459
|
+
|
|
423
460
|
/**
|
|
424
461
|
*
|
|
425
462
|
* @param {TestData} testData
|
|
426
463
|
* @returns boolean
|
|
427
464
|
*/
|
|
428
465
|
function isTestShouldBeExculedFromReport(testData) {
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
return false;
|
|
436
|
-
}
|
|
437
|
-
const excludeParretnsList = globExcludeFilesPattern.split(';');
|
|
438
|
-
// as scanning files is time consuming operation, just save the result in variable to avoid multiple scans
|
|
439
|
-
if (!listOfTestFilesToExcludeFromReport) {
|
|
440
|
-
// list of files with relative paths
|
|
441
|
-
listOfTestFilesToExcludeFromReport = glob_1.glob.sync(excludeParretnsList, { ignore: '**/node_modules/**' });
|
|
442
|
-
debug('Tests from next files will not be reported:', listOfTestFilesToExcludeFromReport);
|
|
443
|
-
}
|
|
444
|
-
const testFileRelativePath = path_1.default.relative(process.cwd(), testData.file);
|
|
445
|
-
// no files found matching the exclusion pattern
|
|
446
|
-
if (!listOfTestFilesToExcludeFromReport.length)
|
|
447
|
-
return false;
|
|
448
|
-
if (listOfTestFilesToExcludeFromReport.includes(testFileRelativePath)) {
|
|
449
|
-
debug(`Excluding test '${testData.title}' <${testFileRelativePath}> from reporting`);
|
|
450
|
-
return true;
|
|
451
|
-
}
|
|
466
|
+
// const fileName = path.basename(test.location?.file || '');
|
|
467
|
+
const globExcludeFilesPattern = process.env.TESTOMATIO_EXCLUDE_FILES_FROM_REPORT_GLOB_PATTERN;
|
|
468
|
+
if (!globExcludeFilesPattern) return false;
|
|
469
|
+
|
|
470
|
+
if (!testData.file) {
|
|
471
|
+
debug('No "file" property found for test ', testData.title);
|
|
452
472
|
return false;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
const excludeParretnsList = globExcludeFilesPattern.split(';');
|
|
476
|
+
|
|
477
|
+
// as scanning files is time consuming operation, just save the result in variable to avoid multiple scans
|
|
478
|
+
if (!listOfTestFilesToExcludeFromReport) {
|
|
479
|
+
// list of files with relative paths
|
|
480
|
+
listOfTestFilesToExcludeFromReport = glob.sync(excludeParretnsList, { ignore: '**/node_modules/**' });
|
|
481
|
+
debug('Tests from next files will not be reported:', listOfTestFilesToExcludeFromReport);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
const testFileRelativePath = path.relative(process.cwd(), testData.file);
|
|
485
|
+
|
|
486
|
+
// no files found matching the exclusion pattern
|
|
487
|
+
if (!listOfTestFilesToExcludeFromReport.length) return false;
|
|
488
|
+
|
|
489
|
+
if (listOfTestFilesToExcludeFromReport.includes(testFileRelativePath)) {
|
|
490
|
+
debug(`Excluding test '${testData.title}' <${testFileRelativePath}> from reporting`);
|
|
491
|
+
return true;
|
|
492
|
+
}
|
|
493
|
+
return false;
|
|
453
494
|
}
|
|
454
|
-
module.exports = Client;
|
|
455
495
|
|
|
456
|
-
module.exports
|
|
496
|
+
module.exports = Client;
|
|
497
|
+
module.exports.TestomatioClient = Client;
|