@@ -291,24 +291,23 @@ function getHead(
291291
292292/**
293293 *
294- * @param {object } reportContent : processed details from the displayContent
295- * @returns { string } formatted output for the support check run
294+ * @param {object } supportResult : support check result
295+ *
296296 */
297- function makeConsoleReport ( reportContent ) {
298- const {
299- body,
300- isInSupportWindow,
301- currentPolicy,
297+ function makeConsoleReport ( supportResult , flags , supportMessage ) {
298+ const isInSupportWindow = supportResult . isInSupportWindow ;
299+ const currentPolicy = supportMessage ? supportMessage : DEFAULT_SUPPORT_MESSAGE ( ) ;
300+ let {
302301 expiresSoon,
303302 unsupportedPackages,
304- supportedPackages,
305303 nodePackage,
306304 emberPackage,
307- } = reportContent ;
305+ supportedPackages,
306+ } = getCategorisedList ( supportResult . supportChecks ) ;
308307
309- let title = getTitle ( isInSupportWindow , expiresSoon , nodePackage , emberPackage ) ;
308+ const title = getTitle ( isInSupportWindow , expiresSoon , nodePackage , emberPackage ) ;
310309
311- let head = getHead (
310+ const head = getHead (
312311 isInSupportWindow ,
313312 unsupportedPackages ,
314313 supportedPackages ,
@@ -318,9 +317,13 @@ function makeConsoleReport(reportContent) {
318317 currentPolicy ,
319318 ) ;
320319
321- return `${ title } ${ head }
322- ${ body }
323- ` ;
320+ const body = getBodyContent ( supportResult . supportChecks , flags ) ;
321+
322+ return {
323+ title,
324+ head,
325+ body,
326+ } ;
324327}
325328
326329/**
@@ -413,36 +416,17 @@ function getCategorisedList(pkgList) {
413416 *
414417 */
415418function displayResult ( supportResult , flags , supportMessage ) {
416- const title = supportResult . projectName ;
417- const isInSupportWindow = supportResult . isInSupportWindow ;
418- const currentPolicy = supportMessage ? supportMessage : DEFAULT_SUPPORT_MESSAGE ( ) ;
419- let {
420- expiresSoon,
421- unsupportedPackages,
422- nodePackage,
423- emberPackage,
424- supportedPackages,
425- } = getCategorisedList ( supportResult . supportChecks ) ;
419+ const { title, head, body } = makeConsoleReport ( supportResult , flags , supportMessage ) ;
426420
427- console . log (
428- makeConsoleReport ( {
429- title,
430- isInSupportWindow,
431- body : getBodyContent ( supportResult . supportChecks , flags ) ,
432- currentPolicy,
433- expiresSoon,
434- unsupportedPackages,
435- supportedPackages,
436- nodePackage,
437- emberPackage,
438- } ) ,
439- ) ;
421+ console . log ( `${ title } ${ head }
422+ ${ body } ` ) ;
440423}
441424
442425module . exports = {
443426 displayResult,
444- getBodyContent,
445427 getCategorisedList,
428+ getBodyContent,
446429 getHead,
447430 getTitle,
431+ makeConsoleReport,
448432} ;
0 commit comments