@@ -12,21 +12,34 @@ const codecept_run = `${runner} run`
1212const config_run_config = ( config , grep ) => `${ codecept_run } --config ${ codecept_dir } /${ config } ${ grep ? `--grep "${ grep } "` : '' } `
1313
1414describe ( 'CodeceptJS plugin' , function ( ) {
15- this . timeout ( 30000 )
15+ this . timeout ( 60000 )
1616
1717 before ( ( ) => {
1818 process . chdir ( codecept_dir )
1919 } )
2020
2121 it ( 'should initialize the coverage plugin and attempt coverage collection' , done => {
22- exec ( `${ config_run_config ( 'codecept.Playwright.coverage.js' , '@coverage' ) } --debug` , ( err , stdout , stderr ) => {
22+ const timeout = setTimeout ( ( ) => {
23+ done ( new Error ( 'Test timed out after 50 seconds' ) )
24+ } , 50000 )
25+
26+ exec ( `${ config_run_config ( 'codecept.Playwright.coverage.js' , '@coverage' ) } --debug` , { timeout : 45000 } , ( err , stdout , stderr ) => {
27+ clearTimeout ( timeout )
28+
2329 const output = stdout + stderr
2430 const lines = output . split ( '\n' )
25- // Check that the coverage plugin is loaded and starts attempting coverage collection
26- expect ( lines ) . toEqual ( expect . arrayContaining ( [ expect . stringContaining ( 'Plugins: screenshotOnFail, coverage' ) , expect . stringContaining ( 'writing output/coverage' ) ] ) )
27- // Test should pass regardless of whether coverage data is found (depends on external site)
28- // The test may fail due to network issues or browser problems, but the coverage plugin should still initialize
29- done ( )
31+
32+ try {
33+ // Check that the coverage plugin is loaded and starts attempting coverage collection
34+ expect ( lines ) . toEqual ( expect . arrayContaining ( [ expect . stringContaining ( 'Plugins: screenshotOnFail, coverage' ) , expect . stringContaining ( 'writing output/coverage' ) ] ) )
35+
36+ // Test should pass regardless of whether coverage data is found (depends on external site)
37+ // The test may fail due to network issues or browser problems, but the coverage plugin should still initialize
38+ done ( )
39+ } catch ( error ) {
40+ console . log ( 'Test output:' , output )
41+ done ( error )
42+ }
3043 } )
3144 } )
3245} )
0 commit comments