@@ -64,6 +64,10 @@ export default class Teams extends SfdxCommand {
64
64
}
65
65
66
66
private formatMilliseconds ( milliseconds ) {
67
+ if ( milliseconds == 0 ) {
68
+ return '0s' ;
69
+ }
70
+
67
71
let seconds = Math . floor ( ( milliseconds / 1000 ) % 60 ) ;
68
72
let minutes = Math . floor ( ( milliseconds / ( 1000 * 60 ) ) % 60 ) ;
69
73
let hours = Math . floor ( ( milliseconds / ( 1000 * 60 * 60 ) ) % 24 ) ;
@@ -146,13 +150,23 @@ export default class Teams extends SfdxCommand {
146
150
coverageApexClasses . push ( currentClass ) ;
147
151
}
148
152
let globalCoverage = Math . round ( ( 1 - ( globalNumLinesNotCovered / globalNumLines ) ) * 100 ) ;
153
+ if ( globalNumLines == 0 ) {
154
+ globalCoverage = 0 ;
155
+ }
156
+
149
157
this . ux . stopSpinner ( 'done' ) ;
150
158
159
+ let formattedDate = new Date ( testResult . result . startDate ) . toLocaleString ( 'fr-FR' , { timeZone : 'CET' } ) ;
160
+ let createdDate = new Date ( testResult . result . createdDate ) ;
161
+ let completedDate = new Date ( testResult . result . completedDate ) ;
162
+ let executionTime = this . formatMilliseconds ( completedDate . getTime ( ) - createdDate . getTime ( ) ) ;
163
+
164
+
151
165
// Generate Global information
152
166
let status = testResult . result . numberTestErrors > 0 ? 'Failed' : 'Passed' ;
153
167
let statusColor = status == 'Passed' ? 'green' : 'red' ;
154
- let summaryTitle = 'Test Execution in ' + this . flags . env + ' - ' + testResult . result . startDate ;
155
- let summaryContent = '<strong>TestRunId : </strong>' + testResult . result . id + ' (Execution Time: ' + this . formatMilliseconds ( testResult . result . details . runTestResult . totalTime ) + ')'
168
+ let summaryTitle = 'Test Execution in ' + this . flags . env + ' - ' + formattedDate ;
169
+ let summaryContent = '<strong>DeploymentId : </strong>' + testResult . result . id + ' (Execution Time: ' + executionTime + ')'
156
170
+ '\n\n' + '<strong>Status: </strong><span style="color:' + statusColor + ';">' + status + '</span>'
157
171
+ '\n\n' + '<strong>Code Coverage: </strong>' + globalCoverage + '%'
158
172
+ '\n\n' + '<strong>Tests Ran: </strong>' + testResult . result . numberTestsTotal
@@ -252,7 +266,7 @@ export default class Teams extends SfdxCommand {
252
266
253
267
this . ux . startSpinner ( 'Notify deployment status on Microsoft Teams' ) ;
254
268
await HttpClient . sendRequest ( this . flags . url . toString ( ) , data ) ;
255
- this . ux . stopSpinner ( 'Done! ' ) ;
269
+ this . ux . stopSpinner ( 'done ' ) ;
256
270
} catch ( error ) {
257
271
throw error ;
258
272
}
0 commit comments