@@ -176,7 +176,7 @@ describe('auditDetailsIssues', () => {
176176 severity : 'warning' ,
177177 } as Issue ,
178178 ] ) ?. toString ( ) ,
179- ) . toMatch ( / \| \s * 4 - 7 \s * \| / ) ;
179+ ) . toContainMarkdownTableRow ( [ '⚠️ _warning_' , '' , '`index.js`' , ' 4-7' ] ) ;
180180 } ) ;
181181} ) ;
182182
@@ -286,8 +286,8 @@ describe('auditDetails', () => {
286286 } as AuditReport ) . toString ( ) ;
287287 expect ( md ) . toMatch ( '<details>' ) ;
288288 expect ( md ) . toMatch ( '#### Elements' ) ;
289- expect ( md ) . toMatch ( / \| \s * b u t t o n \s * \| / ) ;
290- expect ( md ) . toMatch ( / \| \s * d i v \s * \| / ) ;
289+ expect ( md ) . toContainMarkdownTableRow ( [ ' button' ] ) ;
290+ expect ( md ) . toContainMarkdownTableRow ( [ ' div' ] ) ;
291291 expect ( md ) . not . toMatch ( '#### Issues' ) ;
292292 } ) ;
293293
@@ -375,10 +375,13 @@ describe('auditsSection', () => {
375375 ] ,
376376 } as ScoredReport ) . toString ( ) ;
377377 expect ( md ) . toMatch ( '#### Issues' ) ;
378- expect ( md ) . toMatch (
379- / \| \s * S e v e r i t y \s * \| \s * M e s s a g e \s * \| \s * S o u r c e f i l e \s * \| \s * L i n e \( s \) \s * \| / ,
380- ) ;
381- expect ( md ) . toMatch ( / \| \s * v a l u e \s * \| / ) ;
378+ expect ( md ) . toContainMarkdownTableRow ( [
379+ 'Severity' ,
380+ 'Message' ,
381+ 'Source file' ,
382+ 'Line(s)' ,
383+ ] ) ;
384+ expect ( md ) . toContainMarkdownTableRow ( [ 'value' ] ) ;
382385 } ) ;
383386
384387 it ( 'should render audit meta information' , ( ) => {
@@ -472,12 +475,23 @@ describe('aboutSection', () => {
472475 ] ,
473476 categories : Array . from ( { length : 3 } ) ,
474477 } as ScoredReport ) . toString ( ) ;
475- expect ( md ) . toMatch (
476- / \| \s * C o m m i t \s * \| \s * V e r s i o n \s * \| \s * D u r a t i o n \s * \| \s * P l u g i n s \s * \| \s * C a t e g o r i e s \s * \| \s * A u d i t s \s * \| / ,
477- ) ;
478- expect ( md ) . toMatch (
479- / \| \s * c i : u p d a t e a c t i o n \( 5 3 5 b 8 e 9 e 5 5 7 3 3 6 6 1 8 a 7 6 4 f 3 f a 4 5 6 0 9 d 2 2 4 a 6 2 8 3 7 \) \s * \| \s * ` v 1 .0 .0 ` \s * \| \s * 4 .2 0 s \s * \| \s * 1 \s * \| \s * 3 \s * \| \s * 3 \s * \| / ,
480- ) ;
478+
479+ expect ( md ) . toContainMarkdownTableRow ( [
480+ 'Commit' ,
481+ 'Version' ,
482+ 'Duration' ,
483+ 'Plugins' ,
484+ 'Categories' ,
485+ 'Audits' ,
486+ ] ) ;
487+ expect ( md ) . toContainMarkdownTableRow ( [
488+ 'ci: update action (535b8e9e557336618a764f3fa45609d224a62837)' ,
489+ '`v1.0.0`' ,
490+ '4.20 s' ,
491+ '1' ,
492+ '3' ,
493+ '3' ,
494+ ] ) ;
481495 } ) ;
482496
483497 it ( 'should return plugins section with content' , ( ) => {
@@ -498,15 +512,25 @@ describe('aboutSection', () => {
498512 } ,
499513 ] ,
500514 } as ScoredReport ) . toString ( ) ;
501- expect ( md ) . toMatch (
502- / \| \s * P l u g i n \s * \| \s * A u d i t s \s * \| \s * V e r s i o n \s * \| \s * D u r a t i o n \s * \| / ,
503- ) ;
504- expect ( md ) . toMatch (
505- / \| \s * L i g h t h o u s e \s * \| \s * 7 8 \s * \| \s * ` 1 .0 .1 ` \s * \| \s * 1 5 .3 7 s \s * \| / ,
506- ) ;
507- expect ( md ) . toMatch (
508- / \| \s * F i l e S i z e \s * \| \s * 2 \s * \| \s * ` 0 .3 .1 2 ` \s * \| \s * 2 6 0 m s \s * \| / ,
509- ) ;
515+
516+ expect ( md ) . toContainMarkdownTableRow ( [
517+ 'Plugin' ,
518+ 'Audits' ,
519+ 'Version' ,
520+ 'Duration' ,
521+ ] ) ;
522+ expect ( md ) . toContainMarkdownTableRow ( [
523+ 'Lighthouse' ,
524+ '78' ,
525+ '`1.0.1`' ,
526+ '15.37 s' ,
527+ ] ) ;
528+ expect ( md ) . toContainMarkdownTableRow ( [
529+ 'File Size' ,
530+ '2' ,
531+ '`0.3.12`' ,
532+ '260 ms' ,
533+ ] ) ;
510534 } ) ;
511535
512536 it ( 'should return full about section' , ( ) => {
@@ -534,19 +558,24 @@ describe('generateMdReport', () => {
534558 // report title
535559 expect ( md ) . toMatch ( '# Code PushUp Report' ) ;
536560 // categories section heading
537- expect ( md ) . toMatch (
538- / \| \s * 🏷 C a t e g o r y \s * \| \s * ⭐ S c o r e \s * \| \s * 🛡 A u d i t s \s * \| / ,
539- ) ;
561+ expect ( md ) . toContainMarkdownTableRow ( [
562+ '🏷 Category' ,
563+ '⭐ Score' ,
564+ '🛡 Audits' ,
565+ ] ) ;
540566 // categories section heading
541567 expect ( md ) . toMatch ( '## 🏷 Categories' ) ;
542568 // audits heading
543569 expect ( md ) . toMatch ( '## 🛡️ Audits' ) ;
544570 // about section heading
545571 expect ( md ) . toMatch ( '## About' ) ;
546572 // plugin table
547- expect ( md ) . toMatch (
548- / \| \s * P l u g i n \s * \| \s * A u d i t s \s * \| \s * V e r s i o n \s * \| \s * D u r a t i o n \s * \| / ,
549- ) ;
573+ expect ( md ) . toContainMarkdownTableRow ( [
574+ 'Plugin' ,
575+ 'Audits' ,
576+ 'Version' ,
577+ 'Duration' ,
578+ ] ) ;
550579 // made with <3
551580 expect ( md ) . toMatch ( 'Made with ❤ by [Code PushUp]' ) ;
552581 } ) ;
0 commit comments