@@ -2502,12 +2502,6 @@ describe('utils', () => {
25022502 let globStub = sinon . stub ( glob , 'sync' )
25032503 globStub . withArgs ( 'cypress/e2e/foo*.js' )
25042504 . returns ( [ 'cypress/e2e/foo_1.js' ] ) ;
2505- // globStub.withArgs(`cypress/e2e/**/*.+(${constant.specFileTypes.join('|')})`)
2506- // .returns([
2507- // 'cypress/e2e/foo_1.js',
2508- // 'cypress/e2e/foo_2.js',
2509- // 'cypress/e2e/bar_1.js'
2510- // ]);
25112505 let bsConfig = {
25122506 run_settings : {
25132507 cypressTestSuiteType : 'CYPRESS_V10_AND_ABOVE_TYPE' ,
@@ -2528,7 +2522,7 @@ describe('utils', () => {
25282522 glob . sync . restore ( ) ;
25292523 } ) ;
25302524
2531- it ( 'should return under default folder if cypress v >= 10 and error while reading config file' , ( ) => {
2525+ it ( 'should return files under default e2e folder if cypress v >= 10 and error while reading config file' , ( ) => {
25322526 let globStub = sinon . stub ( glob , 'sync' )
25332527 globStub . withArgs ( `cypress/e2e/**/*.+(${ constant . specFileTypes . join ( '|' ) } )` )
25342528 . returns ( [
@@ -2554,6 +2548,37 @@ describe('utils', () => {
25542548 } )
25552549 glob . sync . restore ( ) ;
25562550 } ) ;
2551+
2552+ it ( 'should return files under integration folder if cypress v >= 10, no spec arg in bstack.json and error while reading config file and no files under cypress/e2e' , ( ) => {
2553+ let globStub = sinon . stub ( glob , 'sync' )
2554+ globStub . withArgs ( `cypress/e2e/**/*.+(${ constant . specFileTypes . join ( '|' ) } )` )
2555+ . returns ( [ ] ) ;
2556+ globStub . withArgs ( `cypress/integration/**/*.+(${ constant . specFileTypes . join ( '|' ) } )` )
2557+ . returns ( [
2558+ 'cypress/integration/foo_1.js' ,
2559+ 'cypress/integration/foo_2.js' ,
2560+ 'cypress/integration/bar_1.js'
2561+ ] ) ;
2562+ let bsConfig = {
2563+ run_settings : {
2564+ cypressTestSuiteType : 'CYPRESS_V10_AND_ABOVE_TYPE' ,
2565+ cypressProjectDir : 'cypressProjectDir' ,
2566+ exclude : 'exclude' ,
2567+ } ,
2568+ } ;
2569+
2570+ const result = utils . getNumberOfSpecFiles ( bsConfig , { } , null ) ;
2571+ expect ( result . length ) . to . eql ( 3 ) ;
2572+ expect ( result [ 0 ] . endsWith ( 'cypress/integration/foo_1.js' ) ) . to . eql ( true ) ;
2573+ expect ( result [ 1 ] . endsWith ( 'cypress/integration/foo_2.js' ) ) . to . eql ( true ) ;
2574+ expect ( result [ 2 ] . endsWith ( 'cypress/integration/bar_1.js' ) ) . to . eql ( true ) ;
2575+ sinon . assert . calledWithExactly ( globStub , `cypress/e2e/**/*.+(${ constant . specFileTypes . join ( '|' ) } )` , {
2576+ cwd : 'cypressProjectDir' ,
2577+ matchBase : true ,
2578+ ignore : 'exclude' ,
2579+ } )
2580+ glob . sync . restore ( ) ;
2581+ } ) ;
25572582 } ) ;
25582583
25592584 describe ( 'warnSpecLimit' , ( ) => {
0 commit comments