engine-dependency 1.0.2 → 1.0.4

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.
@@ -26,21 +26,21 @@ class TestInformationService extends services_base_service.default {
26
26
 
27
27
  buildTestPayload(testInfo) {
28
28
  return {
29
- testTitle: testInfo.titlePath?.join(' > ') || testInfo.title,
30
- testStatus: testInfo.status,
29
+ testTitle: testInfo.title,
30
+ testStatus: testInfo.status || testInfo.state,
31
31
  duration: testInfo.duration,
32
32
  testFile: testInfo.file,
33
33
  testProject: process.env.PROJECT_NAME,
34
- retries: testInfo.retries ?? 0,
34
+ retries: (testInfo.retries || testInfo.retries?.length) ?? 0,
35
35
  retry: testInfo.retry ?? 0,
36
36
  tags: testInfo.tags || [],
37
37
  environment: process.env.ENV,
38
38
  testInfo: {
39
39
  title: testInfo.title,
40
- expectedStatus: testInfo.expectedStatus,
41
- annotations: testInfo.annotations || [],
42
- timeout: testInfo.timeout,
43
- errors: testInfo.errors || []
40
+ expectedStatus: testInfo.expectedStatus || null,
41
+ annotations: testInfo.annotations || null,
42
+ timeout: testInfo.timeout || testInfo.timedOut,
43
+ errors: testInfo.errors || testInfo.err || null
44
44
  },
45
45
  pipelineId: process.env.BUILD_BUILDID || null,
46
46
  commitSha: process.env.BUILD_SOURCEVERSION || null,
@@ -52,6 +52,26 @@ class TestInformationService extends services_base_service.default {
52
52
  };
53
53
  }
54
54
 
55
+ buildLocalPayload(testInfo) {
56
+ return {
57
+ testTitle: testInfo.title,
58
+ testStatus: testInfo.status || testInfo.state,
59
+ duration: testInfo.duration,
60
+ testFile: testInfo.file,
61
+ testProject: process.env.PROJECT_NAME,
62
+ retries: testInfo.retries || testInfo.retries?.length || 0,
63
+ retry: testInfo.retry ?? 0,
64
+ tags: testInfo.tags || [],
65
+ environment: process.env.ENV,
66
+ testInfo: testInfo,
67
+ pipelineId: null,
68
+ commitSha: null,
69
+ branch: null,
70
+ runUrl: null,
71
+ provider: null
72
+ };
73
+ }
74
+
55
75
  async sendTestResult(testInfo) {
56
76
  if (!process.env.CI) return;
57
77
 
@@ -75,6 +95,21 @@ class TestInformationService extends services_base_service.default {
75
95
  console.log(`Error enviando resultado de test: ${error?.message || error}`);
76
96
  }
77
97
  }
98
+
99
+ async sendLocalTestResult(testInfo) {
100
+ try {
101
+ const payload = this.buildLocalPayload(testInfo);
102
+ const response = await this.sendPOSTRequest(
103
+ `${this.baseUrl}${this.testResultsEndpoint}`,
104
+ payload
105
+ );
106
+
107
+ console.log(`Resultado de test enviado: ${testInfo.title} - ${testInfo.status}`);
108
+ return response?.data;
109
+ } catch (error) {
110
+ console.log(`Error enviando resultado de test: ${error?.message || error}`);
111
+ }
112
+ }
78
113
  }
79
114
 
80
115
  exports.TestInformationService = TestInformationService;
@@ -24,21 +24,21 @@ class TestInformationService extends BaseService {
24
24
 
25
25
  buildTestPayload(testInfo) {
26
26
  return {
27
- testTitle: testInfo.titlePath?.join(' > ') || testInfo.title,
28
- testStatus: testInfo.status,
27
+ testTitle: testInfo.title,
28
+ testStatus: testInfo.status || testInfo.state,
29
29
  duration: testInfo.duration,
30
30
  testFile: testInfo.file,
31
31
  testProject: process.env.PROJECT_NAME,
32
- retries: testInfo.retries ?? 0,
32
+ retries: (testInfo.retries || testInfo.retries?.length) ?? 0,
33
33
  retry: testInfo.retry ?? 0,
34
34
  tags: testInfo.tags || [],
35
35
  environment: process.env.ENV,
36
36
  testInfo: {
37
37
  title: testInfo.title,
38
- expectedStatus: testInfo.expectedStatus,
39
- annotations: testInfo.annotations || [],
40
- timeout: testInfo.timeout,
41
- errors: testInfo.errors || []
38
+ expectedStatus: testInfo.expectedStatus || null,
39
+ annotations: testInfo.annotations || null,
40
+ timeout: testInfo.timeout || testInfo.timedOut,
41
+ errors: testInfo.errors || testInfo.err || null
42
42
  },
43
43
  pipelineId: process.env.BUILD_BUILDID || null,
44
44
  commitSha: process.env.BUILD_SOURCEVERSION || null,
@@ -50,6 +50,26 @@ class TestInformationService extends BaseService {
50
50
  };
51
51
  }
52
52
 
53
+ buildLocalPayload(testInfo) {
54
+ return {
55
+ testTitle: testInfo.title,
56
+ testStatus: testInfo.status || testInfo.state,
57
+ duration: testInfo.duration,
58
+ testFile: testInfo.file,
59
+ testProject: process.env.PROJECT_NAME,
60
+ retries: testInfo.retries || testInfo.retries?.length || 0,
61
+ retry: testInfo.retry ?? 0,
62
+ tags: testInfo.tags || [],
63
+ environment: process.env.ENV,
64
+ testInfo: testInfo,
65
+ pipelineId: null,
66
+ commitSha: null,
67
+ branch: null,
68
+ runUrl: null,
69
+ provider: null
70
+ };
71
+ }
72
+
53
73
  async sendTestResult(testInfo) {
54
74
  if (!process.env.CI) return;
55
75
 
@@ -73,6 +93,21 @@ class TestInformationService extends BaseService {
73
93
  console.log(`Error enviando resultado de test: ${error?.message || error}`);
74
94
  }
75
95
  }
96
+
97
+ async sendLocalTestResult(testInfo) {
98
+ try {
99
+ const payload = this.buildLocalPayload(testInfo);
100
+ const response = await this.sendPOSTRequest(
101
+ `${this.baseUrl}${this.testResultsEndpoint}`,
102
+ payload
103
+ );
104
+
105
+ console.log(`Resultado de test enviado: ${testInfo.title} - ${testInfo.status}`);
106
+ return response?.data;
107
+ } catch (error) {
108
+ console.log(`Error enviando resultado de test: ${error?.message || error}`);
109
+ }
110
+ }
76
111
  }
77
112
 
78
113
  export { TestInformationService };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "engine-dependency",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Dependencia centralizada para envio de datos via API al servicio Data Engine",
5
5
  "type": "module",
6
6
  "main": "dist/cjs/index.cjs",