@@ -5,7 +5,6 @@ dotenv.config();
55import { fileURLToPath } from "node:url" ;
66import path from "node:path" ;
77import { describe , it } from "node:test" ;
8- import assert from "node:assert" ;
98
109// Import Third-party Dependencies
1110import stripAnsi from "strip-ansi" ;
@@ -20,22 +19,25 @@ const kProcessDir = path.join(__dirname, "..", "process");
2019const kProcessPath = path . join ( kProcessDir , "summary.js" ) ;
2120
2221describe ( "CLI Commands: summary" , ( ) => {
23- it ( "should execute command on fixture 'result-test1.json'" , async ( ) => {
22+ it ( "should execute command on fixture 'result-test1.json'" , async ( t ) => {
2423 await i18n . setLocalLang ( "english" ) ;
2524 const lines = [
2625 / G l o b a l S t a t s : e x p r e s s .* $ / ,
2726 / .* / ,
28- / T o t a l o f p a c k a g e s : .* 6 5 .* $ / ,
29- / T o t a l s i z e : .* 1 . 6 2 M B .* $ / ,
30- / P a c k a g e s w i t h i n d i r e c t d e p e n d e n c i e s : .* 6 .* $ / ,
27+ / T o t a l o f p a c k a g e s : .* 1 7 .* $ / ,
28+ / T o t a l s i z e : .* 9 9 0 . 9 5 K B .* $ / ,
29+ / P a c k a g e s w i t h i n d i r e c t d e p e n d e n c i e s : .* 3 .* $ / ,
3130 / .* / ,
3231 / E x t e n s i o n s : .* $ / ,
33- / \( 4 8 \) { 2 } - \( 5 0 \) \. m d - \( 5 0 \) \. j s o n - \( 5 0 \) \. j s - \( 5 \) \. t s - \( 2 \) \. y m l .* $ / ,
32+ / \( 1 6 \) { 2 } - \( 1 8 \) \. j s - \( 1 8 \) \. j s o n - \( 1 6 \) \. m d - \( 7 \) \. y m l - \( 1 \) \. o p t s .* $ / ,
33+ / \( 1 \) .r e j - \( 1 \) .m a r k d o w n - \( 1 \) .t y p e s - \( 2 \) .h t m l - \( 2 \) .c s s - \( 1 \) .t x t - \( 1 \) $ / ,
34+ / .i c o - \( 1 \) .p n g - \( 1 \) .d a t $ / ,
3435 / .* / ,
3536 / L i c e n s e s : .* $ / ,
36- / \( 4 7 \) M I T - \( 2 \) I S C . * $ / ,
37+ / \( 5 \) M I T * $ / ,
3738 / .* /
3839 ] ;
40+ t . plan ( lines . length * 2 ) ;
3941
4042 const processOptions = {
4143 path : kProcessPath ,
@@ -44,18 +46,19 @@ describe("CLI Commands: summary", () => {
4446
4547 for await ( const line of runProcess ( processOptions ) ) {
4648 const regexp = lines . shift ( ) ;
47- assert . ok ( regexp , "we are expecting this line" ) ;
48- assert . ok ( regexp . test ( stripAnsi ( line ) ) , `line (${ line } ) matches ${ regexp } ` ) ;
49+ t . assert . ok ( regexp , "we are expecting this line" ) ;
50+ t . assert . ok ( regexp . test ( stripAnsi ( line ) ) , `line (${ line } ) matches ${ regexp } ` ) ;
4951 }
5052 } ) ;
5153
52- it ( "should not have dependencies" , async ( ) => {
54+ it ( "should not have dependencies" , async ( t ) => {
5355 const expectedLines = [
5456 / G l o b a l S t a t s : e x p r e s s .* $ / ,
5557 / .* / ,
5658 / E r r o r : .* N o d e p e n d e n c i e s .* $ / ,
5759 / .* /
5860 ] ;
61+ t . plan ( expectedLines . length * 2 ) ;
5962 const processOptions = {
6063 path : kProcessPath . replace ( "summary.js" , "summary-zero-dependencies.js" ) ,
6164 cwd : path . join ( __dirname , ".." , "fixtures" )
@@ -64,8 +67,8 @@ describe("CLI Commands: summary", () => {
6467 for await ( const line of runProcess ( processOptions ) ) {
6568 const expectedLineRegex = expectedLines . shift ( ) ;
6669 const formattedLine = stripAnsi ( line ) ;
67- assert . ok ( expectedLineRegex , "we are expecting this line" ) ;
68- assert . ok ( expectedLineRegex . test ( formattedLine ) , `line (${ formattedLine } ) should match ${ expectedLineRegex } ` ) ;
70+ t . assert . ok ( expectedLineRegex , "we are expecting this line" ) ;
71+ t . assert . ok ( expectedLineRegex . test ( formattedLine ) , `line (${ formattedLine } ) should match ${ expectedLineRegex } ` ) ;
6972 }
7073 } ) ;
7174} ) ;
0 commit comments