1
1
/// <reference types="cypress" />
2
2
3
3
describe ( 'Article' , ( ) => {
4
- let subjects = Cypress . env ( 'test_subjects' )
5
- ? Cypress . env ( 'test_subjects' ) . split ( ',' ) . filter ( s => s . trim ( ) !== '' )
4
+ let subjects = Cypress . env ( 'test_subjects' )
5
+ ? Cypress . env ( 'test_subjects' )
6
+ . split ( ',' )
7
+ . filter ( ( s ) => s . trim ( ) !== '' )
6
8
: [ ] ;
7
9
let validationStrategy = null ;
8
10
@@ -221,7 +223,9 @@ describe('Article', () => {
221
223
// In fallback mode, if we have no subjects, that might be expected
222
224
if ( subjects . length === 0 ) {
223
225
cy . log ( 'ℹ️ No subjects to test in fallback mode' ) ;
224
- cy . log ( ' This indicates no test subjects were provided to the runner' ) ;
226
+ cy . log (
227
+ ' This indicates no test subjects were provided to the runner'
228
+ ) ;
225
229
} else {
226
230
cy . log ( `✅ Testing ${ subjects . length } subjects in fallback mode` ) ;
227
231
}
@@ -233,13 +237,19 @@ describe('Article', () => {
233
237
234
238
// Don't fail if this is expected (cache hit scenario)
235
239
const testSubjectsData = Cypress . env ( 'test_subjects_data' ) ;
236
- if ( testSubjectsData && testSubjectsData !== '[]' && testSubjectsData !== '' ) {
240
+ if (
241
+ testSubjectsData &&
242
+ testSubjectsData !== '[]' &&
243
+ testSubjectsData !== ''
244
+ ) {
237
245
cy . log ( '✅ Cache optimization active - this is expected' ) ;
238
246
cy . log ( 'ℹ️ Test subjects data is available, all files cached' ) ;
239
247
} else {
240
248
cy . log ( '⚠️ No test subjects data available' ) ;
241
249
cy . log ( ' This may indicate no files were provided to test' ) ;
242
- cy . log ( ' This is not necessarily an error - may be expected for some runs' ) ;
250
+ cy . log (
251
+ ' This is not necessarily an error - may be expected for some runs'
252
+ ) ;
243
253
}
244
254
} else {
245
255
cy . log ( `✅ Ready to test ${ subjects . length } pages` ) ;
@@ -252,18 +262,24 @@ describe('Article', () => {
252
262
// Check for truly problematic scenarios
253
263
if ( ! validationStrategy && subjects . length === 0 ) {
254
264
const testSubjectsData = Cypress . env ( 'test_subjects_data' ) ;
255
- if ( ! testSubjectsData || testSubjectsData === '' || testSubjectsData === '[]' ) {
265
+ if (
266
+ ! testSubjectsData ||
267
+ testSubjectsData === '' ||
268
+ testSubjectsData === '[]'
269
+ ) {
256
270
cy . log ( '❌ Critical setup issue detected:' ) ;
257
271
cy . log ( ' • No validation strategy' ) ;
258
272
cy . log ( ' • No test subjects' ) ;
259
273
cy . log ( ' • No test subjects data' ) ;
260
274
cy . log ( ' This indicates a fundamental configuration problem' ) ;
261
-
275
+
262
276
// Only fail in this truly problematic case
263
- throw new Error ( 'Critical test setup failure: No strategy, subjects, or data available' ) ;
277
+ throw new Error (
278
+ 'Critical test setup failure: No strategy, subjects, or data available'
279
+ ) ;
264
280
}
265
281
}
266
-
282
+
267
283
// Always pass if we get to this point - the setup is valid
268
284
cy . log ( '✅ Test setup validation completed successfully' ) ;
269
285
} ) ;
0 commit comments