@@ -165,14 +165,25 @@ describe('scan:eol e2e', () => {
165
165
doesNotThrow ( ( ) => JSON . parse ( stdout ) ) ;
166
166
} ) ;
167
167
168
- it ( 'correctly identifies Angular 17 as having a EOL date and remediations available' , async ( ) => {
168
+ it ( 'correctly identifies Bootstrap as having EOL status and remediation available when using the --json flag' , async ( ) => {
169
+ const cmd = `scan:eol --purls=${ simplePurls } --json` ;
170
+ const { stdout } = await run ( cmd ) ;
171
+
172
+ const json = JSON . parse ( stdout ) ;
173
+ const bootstrap = json . components . find ( ( component ) => component . purl . startsWith ( 'pkg:npm/bootstrap@' ) ) ;
174
+ strictEqual ( bootstrap ?. info . status , 'EOL' , 'Should match EOL count' ) ;
175
+ strictEqual ( bootstrap ?. info . nesAvailable , true , 'Should match remediation count' ) ;
176
+ } ) ;
177
+
178
+ it ( 'correctly identifies Angular 17 as having a EOL date when using --json flag' , async ( ) => {
169
179
const angular17Purls = path . resolve ( __dirname , '../fixtures/npm/angular-17.purls.json' ) ;
170
- const cmd = `scan:eol --purls=${ angular17Purls } ` ;
180
+ const cmd = `scan:eol --purls=${ angular17Purls } --json ` ;
171
181
const { stdout } = await run ( cmd ) ;
172
182
183
+ const json = JSON . parse ( stdout ) ;
184
+ const angular17 = json . components . find ( ( component ) => component . purl . startsWith ( 'pkg:npm/%40angular/core@' ) ) ;
173
185
// Match EOL count
174
- match ( stdout , / 1 ( .* ) E n d - o f - L i f e \( E O L \) / , 'Should show EOL count' ) ;
175
- match ( stdout , / 1 ( .* ) H e r o D e v s N E S R e m e d i a t i o n s A v a i l a b l e / , 'Should show remediation count' ) ;
186
+ strictEqual ( angular17 ?. info . status , 'EOL' , 'Should match EOL status' ) ;
176
187
} ) ;
177
188
178
189
describe ( 'web report URL' , ( ) => {
@@ -183,14 +194,22 @@ describe('scan:eol e2e', () => {
183
194
// Match the key text and scan ID pattern
184
195
match ( stdout , / V i e w y o u r f u l l E O L r e p o r t a t .* [ a - z A - Z 0 - 9 - ] + / , 'Should show web report text and scan ID' ) ;
185
196
} ) ;
197
+
198
+ it ( 'does not display web report URL when using --json flag' , async ( ) => {
199
+ const cmd = `scan:eol --purls=${ simplePurls } --json` ;
200
+ const { stdout } = await run ( cmd ) ;
201
+
202
+ // Verify URL text is not in output
203
+ doesNotMatch ( stdout , / V i e w y o u r f r e e E O L r e p o r t / , 'Should not show web report text in JSON output' ) ;
204
+ } ) ;
186
205
} ) ;
187
206
} ) ;
188
207
189
208
/**
190
209
* Directory scan tests
191
210
* Please see CONTRIBUTING.md before adding new tests to this section.
192
211
*/
193
- describe ( 'scan:eol e2e directory' , ( ) => {
212
+ describe ( 'with directory flag ' , ( ) => {
194
213
const __dirname = path . dirname ( fileURLToPath ( import . meta. url ) ) ;
195
214
const simpleDir = path . resolve ( __dirname , '../fixtures/npm/simple' ) ;
196
215
const upToDateDir = path . resolve ( __dirname , '../fixtures/npm/up-to-date' ) ;
0 commit comments