@@ -11,15 +11,15 @@ describe('cli', () => {
11
11
const res = await execa ( 'npx' , [ 'linkinator' , 'test/fixtures/basic' ] , {
12
12
reject : false ,
13
13
} ) ;
14
- assert . include ( res . stderr , ' ERROR: Detected 1 broken links' ) ;
14
+ assert . match ( res . stderr , / E R R O R : D e t e c t e d 1 b r o k e n l i n k s / ) ;
15
15
} ) ;
16
16
17
17
it ( 'should pass successful markdown scan' , async ( ) => {
18
18
const res = await execa ( 'npx' , [
19
19
'linkinator' ,
20
20
'test/fixtures/markdown/README.md' ,
21
21
] ) ;
22
- assert . include ( res . stderr , ' Successfully scanned' ) ;
22
+ assert . match ( res . stderr , / S u c c e s s f u l l y s c a n n e d / ) ;
23
23
} ) ;
24
24
25
25
it ( 'should allow multiple paths' , async ( ) => {
@@ -28,14 +28,14 @@ describe('cli', () => {
28
28
'test/fixtures/markdown/unlinked.md' ,
29
29
'test/fixtures/markdown/README.md' ,
30
30
] ) ;
31
- assert . include ( res . stderr , ' Successfully scanned' ) ;
31
+ assert . match ( res . stderr , / S u c c e s s f u l l y s c a n n e d / ) ;
32
32
} ) ;
33
33
34
34
it ( 'should show help if no params are provided' , async ( ) => {
35
35
const res = await execa ( 'npx' , [ 'linkinator' ] , {
36
36
reject : false ,
37
37
} ) ;
38
- assert . include ( res . stdout , ' $ linkinator LOCATION [ --arguments ]' ) ;
38
+ assert . match ( res . stdout , / \ $ l i n k i n a t o r L O C A T I O N \ [ - - a r g u m e n t s \] / ) ;
39
39
} ) ;
40
40
41
41
it ( 'should flag skipped links' , async ( ) => {
@@ -47,7 +47,7 @@ describe('cli', () => {
47
47
'LICENSE.md' ,
48
48
'test/fixtures/markdown/README.md' ,
49
49
] ) ;
50
- assert . include ( res . stdout , ' [SKP]' ) ;
50
+ assert . match ( res . stdout , / \ [S K P \] / ) ;
51
51
} ) ;
52
52
53
53
it ( 'should provide CSV if asked nicely' , async ( ) => {
@@ -58,7 +58,7 @@ describe('cli', () => {
58
58
'csv' ,
59
59
'test/fixtures/markdown/README.md' ,
60
60
] ) ;
61
- assert . include ( res . stdout , '/ README.md,200,OK,' ) ;
61
+ assert . match ( res . stdout , / \/ R E A D M E .m d , 2 0 0 , O K , / ) ;
62
62
} ) ;
63
63
64
64
it ( 'should provide JSON if asked nicely' , async ( ) => {
@@ -69,7 +69,7 @@ describe('cli', () => {
69
69
'json' ,
70
70
'test/fixtures/markdown/README.md' ,
71
71
] ) ;
72
- assert . include ( res . stdout , '{' ) ;
72
+ assert . match ( res . stdout , / { / ) ;
73
73
} ) ;
74
74
75
75
it ( 'should not show links if --silent' , async ( ) => {
@@ -78,7 +78,7 @@ describe('cli', () => {
78
78
'--silent' ,
79
79
'test/fixtures/markdown/README.md' ,
80
80
] ) ;
81
- assert . strictEqual ( res . stdout . indexOf ( '[' ) , - 1 ) ;
81
+ assert . notMatch ( res . stdout , / \[ / ) ;
82
82
} ) ;
83
83
84
84
it ( 'should accept a server-root' , async ( ) => {
@@ -89,7 +89,7 @@ describe('cli', () => {
89
89
'test/fixtures/markdown' ,
90
90
'README.md' ,
91
91
] ) ;
92
- assert . ok ( res . stderr . includes ( ' Successfully scanned' ) ) ;
92
+ assert . match ( res . stderr , / S u c c e s s f u l l y s c a n n e d / ) ;
93
93
} ) ;
94
94
95
95
it ( 'should accept globs' , async ( ) => {
@@ -98,7 +98,7 @@ describe('cli', () => {
98
98
'test/fixtures/markdown/*.md' ,
99
99
'test/fixtures/markdown/**/*.md' ,
100
100
] ) ;
101
- assert . ok ( res . stderr . includes ( ' Successfully scanned' ) ) ;
101
+ assert . match ( res . stderr , / S u c c e s s f u l l y s c a n n e d / ) ;
102
102
} ) ;
103
103
104
104
it ( 'should throw on invalid format' , async ( ) => {
@@ -109,7 +109,7 @@ describe('cli', () => {
109
109
reject : false ,
110
110
}
111
111
) ;
112
- assert . include ( res . stderr , ' FORMAT must be' ) ;
112
+ assert . match ( res . stderr , / F O R M A T m u s t b e / ) ;
113
113
} ) ;
114
114
115
115
it ( 'should throw on invalid format' , async ( ) => {
@@ -120,7 +120,7 @@ describe('cli', () => {
120
120
reject : false ,
121
121
}
122
122
) ;
123
- assert . include ( res . stderr , ' FORMAT must be' ) ;
123
+ assert . match ( res . stderr , / F O R M A T m u s t b e / ) ;
124
124
} ) ;
125
125
126
126
it ( 'should throw on invalid verbosity' , async ( ) => {
@@ -131,7 +131,7 @@ describe('cli', () => {
131
131
reject : false ,
132
132
}
133
133
) ;
134
- assert . include ( res . stderr , ' VERBOSITY must be' ) ;
134
+ assert . match ( res . stderr , / V E R B O S I T Y m u s t b e / ) ;
135
135
} ) ;
136
136
137
137
it ( 'should throw when verbosity and silent are flagged' , async ( ) => {
@@ -142,7 +142,7 @@ describe('cli', () => {
142
142
reject : false ,
143
143
}
144
144
) ;
145
- assert . include ( res . stderr , ' The SILENT and VERBOSITY flags' ) ;
145
+ assert . match ( res . stderr , / T h e S I L E N T a n d V E R B O S I T Y f l a g s / ) ;
146
146
} ) ;
147
147
148
148
it ( 'should show no output for verbosity=NONE' , async ( ) => {
@@ -157,4 +157,16 @@ describe('cli', () => {
157
157
assert . strictEqual ( res . stdout , '' ) ;
158
158
assert . strictEqual ( res . stderr , '' ) ;
159
159
} ) ;
160
+
161
+ it ( 'should show callstacks for verbosity=DEBUG' , async ( ) => {
162
+ const res = await execa (
163
+ 'npx' ,
164
+ [ 'linkinator' , 'test/fixtures/basic' , '--verbosity' , 'DEBUG' ] ,
165
+ {
166
+ reject : false ,
167
+ }
168
+ ) ;
169
+ assert . strictEqual ( res . exitCode , 1 ) ;
170
+ assert . match ( res . stdout , / r e a s o n : g e t a d d r i n f o / ) ;
171
+ } ) ;
160
172
} ) ;
0 commit comments