@testomatio/reporter 2.3.7-beta.1-xml-import → 2.3.7-beta.10-stack-artifacts
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/adapter/codecept.js +22 -2
- package/lib/bin/cli.js +0 -0
- package/lib/bin/reportXml.js +1 -4
- package/lib/bin/startTest.js +0 -0
- package/lib/bin/uploadArtifacts.js +0 -0
- package/lib/client.js +32 -21
- package/lib/junit-adapter/csharp.d.ts +1 -0
- package/lib/junit-adapter/csharp.js +7 -36
- package/lib/pipe/debug.js +1 -1
- package/lib/pipe/testomatio.js +14 -19
- package/lib/reporter.d.ts +19 -9
- package/lib/reporter.js +40 -5
- package/lib/uploader.js +0 -4
- package/lib/utils/utils.d.ts +1 -0
- package/lib/utils/utils.js +23 -35
- package/lib/xmlReader.d.ts +26 -11
- package/lib/xmlReader.js +1 -50
- package/package.json +1 -1
- package/src/adapter/codecept.js +27 -3
- package/src/bin/reportXml.js +1 -4
- package/src/client.js +57 -27
- package/src/junit-adapter/csharp.js +6 -40
- package/src/pipe/debug.js +3 -2
- package/src/pipe/testomatio.js +80 -76
- package/src/reporter.js +7 -4
- package/src/uploader.js +0 -5
- package/src/utils/utils.js +21 -35
- package/src/xmlReader.js +1 -62
- package/lib/junit-adapter/nunit-parser.d.ts +0 -82
- package/lib/junit-adapter/nunit-parser.js +0 -357
- package/src/junit-adapter/nunit-parser.js +0 -391
package/lib/xmlReader.d.ts
CHANGED
|
@@ -19,11 +19,25 @@ declare class XmlReader {
|
|
|
19
19
|
tests: any[];
|
|
20
20
|
stats: {};
|
|
21
21
|
uploader: S3Uploader;
|
|
22
|
-
enhancedNunit: boolean;
|
|
23
|
-
groupParameterized: boolean;
|
|
24
22
|
version: any;
|
|
25
23
|
connectAdapter(): import("./junit-adapter/adapter.js").default;
|
|
26
|
-
parse(fileName: any):
|
|
24
|
+
parse(fileName: any): {
|
|
25
|
+
status: string;
|
|
26
|
+
create_tests: boolean;
|
|
27
|
+
tests_count: number;
|
|
28
|
+
passed_count: number;
|
|
29
|
+
skipped_count: number;
|
|
30
|
+
failed_count: number;
|
|
31
|
+
tests: any;
|
|
32
|
+
} | {
|
|
33
|
+
status: any;
|
|
34
|
+
create_tests: boolean;
|
|
35
|
+
tests_count: number;
|
|
36
|
+
passed_count: number;
|
|
37
|
+
failed_count: number;
|
|
38
|
+
skipped_count: number;
|
|
39
|
+
tests: any[];
|
|
40
|
+
};
|
|
27
41
|
processJUnit(jsonSuite: any): {
|
|
28
42
|
create_tests: boolean;
|
|
29
43
|
duration: number;
|
|
@@ -35,14 +49,15 @@ declare class XmlReader {
|
|
|
35
49
|
tests: any[];
|
|
36
50
|
tests_count: number;
|
|
37
51
|
};
|
|
38
|
-
processNUnit(jsonSuite: any):
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
52
|
+
processNUnit(jsonSuite: any): {
|
|
53
|
+
status: any;
|
|
54
|
+
create_tests: boolean;
|
|
55
|
+
tests_count: number;
|
|
56
|
+
passed_count: number;
|
|
57
|
+
failed_count: number;
|
|
58
|
+
skipped_count: number;
|
|
59
|
+
tests: any[];
|
|
60
|
+
};
|
|
46
61
|
processTRX(jsonSuite: any): {
|
|
47
62
|
status: string;
|
|
48
63
|
create_tests: boolean;
|
package/lib/xmlReader.js
CHANGED
|
@@ -11,7 +11,6 @@ const fast_xml_parser_1 = require("fast-xml-parser");
|
|
|
11
11
|
const constants_js_1 = require("./constants.js");
|
|
12
12
|
const crypto_1 = require("crypto");
|
|
13
13
|
const url_1 = require("url");
|
|
14
|
-
const nunit_parser_js_1 = require("./junit-adapter/nunit-parser.js");
|
|
15
14
|
const utils_js_1 = require("./utils/utils.js");
|
|
16
15
|
const index_js_1 = require("./pipe/index.js");
|
|
17
16
|
const index_js_2 = __importDefault(require("./junit-adapter/index.js"));
|
|
@@ -55,9 +54,6 @@ class XmlReader {
|
|
|
55
54
|
this.stats = {};
|
|
56
55
|
this.stats.language = opts.lang?.toLowerCase();
|
|
57
56
|
this.uploader = new uploader_js_1.S3Uploader();
|
|
58
|
-
// Enhanced NUnit parsing - enabled by default for NUnit XML
|
|
59
|
-
this.enhancedNunit = opts.enhancedNunit !== false; // Default true, can be disabled
|
|
60
|
-
this.groupParameterized = opts.groupParameterized !== false; // Default true, can be disabled
|
|
61
57
|
// @ts-ignore
|
|
62
58
|
const packageJsonPath = path_1.default.resolve(__dirname, '..', 'package.json');
|
|
63
59
|
this.version = JSON.parse(fs_1.default.readFileSync(packageJsonPath).toString()).version;
|
|
@@ -106,8 +102,7 @@ class XmlReader {
|
|
|
106
102
|
return this.processJUnit(jsonSuite);
|
|
107
103
|
}
|
|
108
104
|
processJUnit(jsonSuite) {
|
|
109
|
-
const { testsuite, name, failures, errors } = jsonSuite;
|
|
110
|
-
const tests = testsuite?.tests || jsonSuite.tests;
|
|
105
|
+
const { testsuite, name, tests, failures, errors } = jsonSuite;
|
|
111
106
|
reduceOptions.preferClassname = this.stats.language === 'python';
|
|
112
107
|
const resultTests = processTestSuite(testsuite);
|
|
113
108
|
const hasFailures = resultTests.filter(t => t.status === 'failed').length > 0;
|
|
@@ -133,13 +128,6 @@ class XmlReader {
|
|
|
133
128
|
};
|
|
134
129
|
}
|
|
135
130
|
processNUnit(jsonSuite) {
|
|
136
|
-
// Use enhanced NUnit parser if enabled and this is actually NUnit XML
|
|
137
|
-
if (this.enhancedNunit && this.isNUnitXml(jsonSuite)) {
|
|
138
|
-
debug('Using enhanced NUnit parser');
|
|
139
|
-
return this.processNUnitEnhanced(jsonSuite);
|
|
140
|
-
}
|
|
141
|
-
// Fallback to legacy parser for backward compatibility
|
|
142
|
-
debug('Using legacy NUnit parser');
|
|
143
131
|
const { result, total, passed, failed, inconclusive, skipped } = jsonSuite;
|
|
144
132
|
reduceOptions.preferClassname = this.stats.language === 'python';
|
|
145
133
|
const resultTests = processTestSuite(jsonSuite['test-suite']);
|
|
@@ -154,43 +142,6 @@ class XmlReader {
|
|
|
154
142
|
tests: resultTests,
|
|
155
143
|
};
|
|
156
144
|
}
|
|
157
|
-
/**
|
|
158
|
-
* Check if the XML is actually NUnit format (has test-suite hierarchy)
|
|
159
|
-
* @param {Object} jsonSuite - Parsed XML suite object
|
|
160
|
-
* @returns {boolean} - True if this is NUnit XML format
|
|
161
|
-
*/
|
|
162
|
-
isNUnitXml(jsonSuite) {
|
|
163
|
-
// NUnit XML has test-suite elements with type attributes
|
|
164
|
-
if (jsonSuite['test-suite']) {
|
|
165
|
-
const testSuite = Array.isArray(jsonSuite['test-suite']) ? jsonSuite['test-suite'][0] : jsonSuite['test-suite'];
|
|
166
|
-
// Check for NUnit-specific test-suite types
|
|
167
|
-
return (testSuite &&
|
|
168
|
-
testSuite.type &&
|
|
169
|
-
['Assembly', 'TestSuite', 'TestFixture', 'ParameterizedMethod'].includes(testSuite.type));
|
|
170
|
-
}
|
|
171
|
-
return false;
|
|
172
|
-
}
|
|
173
|
-
processNUnitEnhanced(jsonSuite) {
|
|
174
|
-
debug('Processing NUnit XML with enhanced parser');
|
|
175
|
-
try {
|
|
176
|
-
const nunitParser = new nunit_parser_js_1.NUnitXmlParser({
|
|
177
|
-
groupParameterized: this.groupParameterized,
|
|
178
|
-
...this.opts,
|
|
179
|
-
});
|
|
180
|
-
const result = nunitParser.parseTestRun(jsonSuite);
|
|
181
|
-
// Add parsed tests to our collection
|
|
182
|
-
this.tests = this.tests.concat(result.tests);
|
|
183
|
-
debug(`Enhanced NUnit parser processed ${result.tests.length} tests`);
|
|
184
|
-
return result;
|
|
185
|
-
}
|
|
186
|
-
catch (error) {
|
|
187
|
-
debug('Enhanced NUnit parser failed, falling back to legacy parser:', error.message);
|
|
188
|
-
console.warn(`${constants_js_1.APP_PREFIX} Enhanced NUnit parsing failed, using legacy parser: ${error.message}`);
|
|
189
|
-
// Fallback to legacy parser
|
|
190
|
-
this.enhancedNunit = false;
|
|
191
|
-
return this.processNUnit(jsonSuite);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
145
|
processTRX(jsonSuite) {
|
|
195
146
|
let defs = jsonSuite?.TestRun?.TestDefinitions?.UnitTest;
|
|
196
147
|
if (!Array.isArray(defs))
|
package/package.json
CHANGED
package/src/adapter/codecept.js
CHANGED
|
@@ -2,7 +2,7 @@ import createDebugMessages from 'debug';
|
|
|
2
2
|
import pc from 'picocolors';
|
|
3
3
|
import TestomatClient from '../client.js';
|
|
4
4
|
import { STATUS, APP_PREFIX, TESTOMAT_TMP_STORAGE_DIR } from '../constants.js';
|
|
5
|
-
import { getTestomatIdFromTestTitle, fileSystem } from '../utils/utils.js';
|
|
5
|
+
import { getTestomatIdFromTestTitle, truncate, fileSystem } from '../utils/utils.js';
|
|
6
6
|
import { services } from '../services/index.js';
|
|
7
7
|
import { dataStorage } from '../data-storage.js';
|
|
8
8
|
import codeceptjs from 'codeceptjs';
|
|
@@ -127,6 +127,28 @@ function CodeceptReporter(config) {
|
|
|
127
127
|
});
|
|
128
128
|
|
|
129
129
|
|
|
130
|
+
// mark as failed all tests inside the failed hook
|
|
131
|
+
event.dispatcher.on(event.hook.failed, hook => {
|
|
132
|
+
if (hook.name !== 'BeforeSuiteHook') return;
|
|
133
|
+
const suite = hook.runnable.parent;
|
|
134
|
+
|
|
135
|
+
if (!suite) return;
|
|
136
|
+
|
|
137
|
+
const error = hook?.ctx?.currentTest?.err;
|
|
138
|
+
|
|
139
|
+
for (const test of suite.tests) {
|
|
140
|
+
client.addTestRun('failed', {
|
|
141
|
+
...stripExampleFromTitle(test.title),
|
|
142
|
+
rid: test.uid,
|
|
143
|
+
test_id: getTestomatIdFromTestTitle(test.title),
|
|
144
|
+
suite_title: stripTagsFromTitle(suite.title),
|
|
145
|
+
error,
|
|
146
|
+
time: hook?.runnable?.duration,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
|
|
130
152
|
event.dispatcher.on(event.suite.before, suite => {
|
|
131
153
|
dataStorage.setContext(suite.fullTitle());
|
|
132
154
|
});
|
|
@@ -441,7 +463,7 @@ function formatCodeceptStep(step) {
|
|
|
441
463
|
if (!step) return null;
|
|
442
464
|
|
|
443
465
|
const category = step.constructor.name === 'HelperStep' ? 'framework' : 'user';
|
|
444
|
-
const title = step
|
|
466
|
+
const title = truncate(step); // Use built-in toString
|
|
445
467
|
const duration = step.duration || 0; // Use built-in duration
|
|
446
468
|
|
|
447
469
|
const formattedStep = {
|
|
@@ -469,10 +491,11 @@ function formatHookStep(step) {
|
|
|
469
491
|
if (step.actor && step.name) {
|
|
470
492
|
title = `${step.actor} ${step.name}`;
|
|
471
493
|
if (step.args && step.args.length > 0) {
|
|
472
|
-
const argsStr = step.args.map(arg => JSON.stringify(arg)).join(', ');
|
|
494
|
+
const argsStr = step.args.map(arg => truncate(JSON.stringify(arg))).join(', ');
|
|
473
495
|
title += ` ${argsStr}`;
|
|
474
496
|
}
|
|
475
497
|
}
|
|
498
|
+
title = truncate(title);
|
|
476
499
|
|
|
477
500
|
return {
|
|
478
501
|
category: 'hook',
|
|
@@ -481,5 +504,6 @@ function formatHookStep(step) {
|
|
|
481
504
|
};
|
|
482
505
|
}
|
|
483
506
|
|
|
507
|
+
|
|
484
508
|
export { CodeceptReporter };
|
|
485
509
|
export default CodeceptReporter;
|
package/src/bin/reportXml.js
CHANGED
|
@@ -34,10 +34,7 @@ program
|
|
|
34
34
|
}
|
|
35
35
|
lang = lang?.toLowerCase();
|
|
36
36
|
if (javaTests === true || (lang === 'java' && !javaTests)) javaTests = 'src/test/java';
|
|
37
|
-
const runReader = new XmlReader({
|
|
38
|
-
javaTests,
|
|
39
|
-
lang,
|
|
40
|
-
});
|
|
37
|
+
const runReader = new XmlReader({ javaTests, lang });
|
|
41
38
|
const files = glob.sync(pattern, { cwd: opts.dir || process.cwd() });
|
|
42
39
|
if (!files.length) {
|
|
43
40
|
console.log(APP_PREFIX, `Report can't be created. No XML files found 😥`);
|
package/src/client.js
CHANGED
|
@@ -10,11 +10,21 @@ import { glob } from 'glob';
|
|
|
10
10
|
import path, { sep } from 'path';
|
|
11
11
|
import { fileURLToPath } from 'node:url';
|
|
12
12
|
import { S3Uploader } from './uploader.js';
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
formatStep,
|
|
15
|
+
truncate,
|
|
16
|
+
readLatestRunId,
|
|
17
|
+
storeRunId,
|
|
18
|
+
validateSuiteId,
|
|
19
|
+
transformEnvVarToBoolean
|
|
20
|
+
} from './utils/utils.js';
|
|
14
21
|
import { filesize as prettyBytes } from 'filesize';
|
|
22
|
+
import { stripVTControlCharacters } from 'util';
|
|
15
23
|
|
|
16
24
|
const debug = createDebugMessages('@testomatio/reporter:client');
|
|
17
25
|
|
|
26
|
+
const stripColors = stripVTControlCharacters || ((str) => str?.replace(/\x1b\[[0-9;]*m/g, '') || '');
|
|
27
|
+
|
|
18
28
|
// removed __dirname usage, because:
|
|
19
29
|
// 1. replaced with ESM syntax (import.meta.url), but it throws an error on tsc compilation;
|
|
20
30
|
// 2. got error "__dirname already defined" in compiles js code (cjs dir)
|
|
@@ -139,19 +149,6 @@ class Client {
|
|
|
139
149
|
* @returns {Promise<PipeResult[]>}
|
|
140
150
|
*/
|
|
141
151
|
async addTestRun(status, testData) {
|
|
142
|
-
if (!this.pipes || !this.pipes.length)
|
|
143
|
-
this.pipes = await pipesFactory(this.paramsForPipesFactory || {}, this.pipeStore);
|
|
144
|
-
|
|
145
|
-
// all pipes disabled, skipping
|
|
146
|
-
if (!this.pipes?.filter(p => p.isEnabled).length) return [];
|
|
147
|
-
|
|
148
|
-
if (isTestShouldBeExculedFromReport(testData)) return [];
|
|
149
|
-
|
|
150
|
-
if (status === STATUS.SKIPPED && process.env.TESTOMATIO_EXCLUDE_SKIPPED) {
|
|
151
|
-
debug('Skipping test from report', testData?.title);
|
|
152
|
-
return []; // do not log skipped tests
|
|
153
|
-
}
|
|
154
|
-
|
|
155
152
|
if (!testData)
|
|
156
153
|
testData = {
|
|
157
154
|
title: 'Unknown test',
|
|
@@ -169,15 +166,23 @@ class Client {
|
|
|
169
166
|
const {
|
|
170
167
|
rid,
|
|
171
168
|
error = null,
|
|
169
|
+
steps: originalSteps,
|
|
170
|
+
title,
|
|
171
|
+
suite_title,
|
|
172
|
+
} = testData;
|
|
173
|
+
const steps = originalSteps;
|
|
174
|
+
|
|
175
|
+
const uploadedFiles = [];
|
|
176
|
+
const stackArtifactsEnabled = transformEnvVarToBoolean(process.env.TESTOMATIO_STACK_ARTIFACTS);
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
const {
|
|
172
180
|
time = 0,
|
|
173
181
|
example = null,
|
|
174
182
|
files = [],
|
|
175
183
|
filesBuffers = [],
|
|
176
|
-
steps,
|
|
177
184
|
code = null,
|
|
178
|
-
title,
|
|
179
185
|
file,
|
|
180
|
-
suite_title,
|
|
181
186
|
suite_id,
|
|
182
187
|
test_id,
|
|
183
188
|
timestamp,
|
|
@@ -188,7 +193,6 @@ class Client {
|
|
|
188
193
|
} = testData;
|
|
189
194
|
let { message = '', meta = {} } = testData;
|
|
190
195
|
|
|
191
|
-
// stringify meta values and limit keys and values length to 255
|
|
192
196
|
meta = Object.entries(meta)
|
|
193
197
|
.filter(([, value]) => value !== null && value !== undefined)
|
|
194
198
|
.reduce((acc, [key, value]) => {
|
|
@@ -196,7 +200,6 @@ class Client {
|
|
|
196
200
|
return acc;
|
|
197
201
|
}, {});
|
|
198
202
|
|
|
199
|
-
// Get links from storage using the test context
|
|
200
203
|
const testContext = suite_title ? `${suite_title} ${title}` : title;
|
|
201
204
|
|
|
202
205
|
let errorFormatted = '';
|
|
@@ -205,13 +208,40 @@ class Client {
|
|
|
205
208
|
message = error?.message;
|
|
206
209
|
}
|
|
207
210
|
|
|
208
|
-
|
|
209
|
-
const fullLogs = this.formatLogs({ error: errorFormatted, steps, logs: testData.logs });
|
|
211
|
+
let fullLogs = this.formatLogs({ error: errorFormatted, steps, logs: testData.logs });
|
|
210
212
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
+
if (stackArtifactsEnabled && status && (steps || testData.logs || error)) {
|
|
214
|
+
const timestamp = +new Date;
|
|
215
|
+
if (fullLogs && fullLogs.trim().length > 0) {
|
|
216
|
+
uploadedFiles.push(
|
|
217
|
+
this.uploader.uploadFileAsBuffer(
|
|
218
|
+
Buffer.from(stripColors(fullLogs), 'utf8'),
|
|
219
|
+
[this.runId, rid, `logs_${timestamp}.txt`]
|
|
220
|
+
)
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
fullLogs = '';
|
|
224
|
+
}
|
|
213
225
|
|
|
214
|
-
|
|
226
|
+
|
|
227
|
+
if (!this.pipes || !this.pipes.length)
|
|
228
|
+
this.pipes = await pipesFactory(this.paramsForPipesFactory || {}, this.pipeStore);
|
|
229
|
+
|
|
230
|
+
if (!this.pipes?.filter(p => p.isEnabled).length) {
|
|
231
|
+
if (uploadedFiles.length > 0) {
|
|
232
|
+
await Promise.all(uploadedFiles);
|
|
233
|
+
}
|
|
234
|
+
return [];
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if (isTestShouldBeExculedFromReport(testData)) return [];
|
|
238
|
+
|
|
239
|
+
if (status === STATUS.SKIPPED && process.env.TESTOMATIO_EXCLUDE_SKIPPED) {
|
|
240
|
+
debug('Skipping test from report', testData?.title);
|
|
241
|
+
return [];
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if (manuallyAttachedArtifacts?.length) files.push(...manuallyAttachedArtifacts);
|
|
215
245
|
|
|
216
246
|
for (let f of files) {
|
|
217
247
|
if (!f) continue; // f === null
|
|
@@ -308,7 +338,7 @@ class Client {
|
|
|
308
338
|
const uploadedArtifacts = this.uploader.successfulUploads.map(file => ({
|
|
309
339
|
relativePath: file.path.replace(process.cwd(), ''),
|
|
310
340
|
link: file.link,
|
|
311
|
-
sizePretty: prettyBytes(file.size, { round: 0 }).toString(),
|
|
341
|
+
sizePretty: file.size == null ? 'unknown' : prettyBytes(file.size, { round: 0 }).toString(),
|
|
312
342
|
}));
|
|
313
343
|
|
|
314
344
|
uploadedArtifacts.forEach(upload => {
|
|
@@ -330,7 +360,7 @@ class Client {
|
|
|
330
360
|
);
|
|
331
361
|
const failedUploads = this.uploader.failedUploads.map(file => ({
|
|
332
362
|
relativePath: file.path.replace(process.cwd(), ''),
|
|
333
|
-
sizePretty: prettyBytes(file.size, { round: 0 }).toString(),
|
|
363
|
+
sizePretty: file.size == null ? 'unknown' : prettyBytes(file.size, { round: 0 }).toString(),
|
|
334
364
|
}));
|
|
335
365
|
|
|
336
366
|
const pathPadding = Math.max(...failedUploads.map(upload => upload.relativePath.length)) + 1;
|
|
@@ -387,7 +417,7 @@ class Client {
|
|
|
387
417
|
*/
|
|
388
418
|
formatLogs({ error, steps, logs }) {
|
|
389
419
|
error = error?.trim();
|
|
390
|
-
logs = logs?.trim();
|
|
420
|
+
logs = logs?.trim().split('\n').map(l => truncate(l)).join('\n');
|
|
391
421
|
|
|
392
422
|
if (Array.isArray(steps)) {
|
|
393
423
|
steps = steps
|
|
@@ -3,45 +3,18 @@ import Adapter from './adapter.js';
|
|
|
3
3
|
|
|
4
4
|
class CSharpAdapter extends Adapter {
|
|
5
5
|
formatTest(t) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
const title = t.title.replace(/\(.*?\)/, '').trim();
|
|
10
|
-
const exampleMatch = t.title.match(/\((.*?)\)/);
|
|
11
|
-
if (exampleMatch) {
|
|
12
|
-
// Keep as array for consistency with NUnit XML processing
|
|
13
|
-
t.example = exampleMatch[1].split(',').map(param => param.trim());
|
|
14
|
-
}
|
|
15
|
-
t.title = title.trim();
|
|
16
|
-
}
|
|
17
|
-
|
|
6
|
+
const title = t.title.replace(/\(.*?\)/, '').trim();
|
|
7
|
+
const example = t.title.match(/\((.*?)\)/);
|
|
8
|
+
if (example) t.example = { ...example[1].split(',') };
|
|
18
9
|
const suite = t.suite_title.split('.');
|
|
19
10
|
t.suite_title = suite.pop();
|
|
20
11
|
t.file = namespaceToFileName(t.file);
|
|
12
|
+
t.title = title.trim();
|
|
21
13
|
return t;
|
|
22
14
|
}
|
|
23
15
|
|
|
24
16
|
getFilePath(t) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// Normalize path separators for cross-platform compatibility
|
|
28
|
-
let filePath = t.file.replace(/\\/g, '/');
|
|
29
|
-
|
|
30
|
-
// If file already has .cs extension, use it directly
|
|
31
|
-
if (filePath.endsWith('.cs')) {
|
|
32
|
-
// Make relative path if it's absolute
|
|
33
|
-
if (path.isAbsolute(filePath)) {
|
|
34
|
-
// Try to find project-relative path
|
|
35
|
-
const cwd = process.cwd().replace(/\\/g, '/');
|
|
36
|
-
if (filePath.startsWith(cwd)) {
|
|
37
|
-
filePath = path.relative(cwd, filePath).replace(/\\/g, '/');
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return filePath;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Convert namespace path to file path
|
|
44
|
-
const fileName = namespaceToFileName(filePath);
|
|
17
|
+
const fileName = namespaceToFileName(t.file);
|
|
45
18
|
return fileName;
|
|
46
19
|
}
|
|
47
20
|
}
|
|
@@ -49,14 +22,7 @@ class CSharpAdapter extends Adapter {
|
|
|
49
22
|
export default CSharpAdapter;
|
|
50
23
|
|
|
51
24
|
function namespaceToFileName(fileName) {
|
|
52
|
-
if (!fileName) return '';
|
|
53
|
-
|
|
54
|
-
// If already a .cs file path, clean it up
|
|
55
|
-
if (fileName.endsWith('.cs')) {
|
|
56
|
-
return fileName.replace(/\\/g, '/');
|
|
57
|
-
}
|
|
58
|
-
|
|
59
25
|
const fileParts = fileName.split('.');
|
|
60
26
|
fileParts[fileParts.length - 1] = fileParts[fileParts.length - 1]?.replace(/\$.*/, '');
|
|
61
|
-
return `${fileParts.join(
|
|
27
|
+
return `${fileParts.join(path.sep)}.cs`;
|
|
62
28
|
}
|
package/src/pipe/debug.js
CHANGED
|
@@ -15,7 +15,7 @@ export class DebugPipe {
|
|
|
15
15
|
this.isEnabled = !!process.env.TESTOMATIO_DEBUG || !!process.env.DEBUG;
|
|
16
16
|
if (this.isEnabled) {
|
|
17
17
|
this.batch = {
|
|
18
|
-
isEnabled: this.params.isBatchEnabled ??
|
|
18
|
+
isEnabled: this.params.isBatchEnabled ?? !process.env.TESTOMATIO_DISABLE_BATCH_UPLOAD ?? true,
|
|
19
19
|
intervalFunction: null,
|
|
20
20
|
intervalTime: 5000,
|
|
21
21
|
tests: [],
|
|
@@ -93,7 +93,8 @@ export class DebugPipe {
|
|
|
93
93
|
const logData = { action: 'addTest', testId: data };
|
|
94
94
|
if (this.store.runId) logData.runId = this.store.runId;
|
|
95
95
|
this.logToFile(logData);
|
|
96
|
-
}
|
|
96
|
+
}
|
|
97
|
+
else this.batch.tests.push(data);
|
|
97
98
|
|
|
98
99
|
if (!this.batch.intervalFunction) await this.batchUpload();
|
|
99
100
|
}
|