File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,20 @@ describe('svelte-style-csp', async () => {
6767 'svelte-test-transitions-no-styles-csp/index.html'
6868 ) ;
6969 const browser = await puppeteer . launch ( { headless : headless_browser } ) ;
70+ const process = browser . process ( ) ;
71+ const killBrowser = ( retries = 5 ) => {
72+ if ( retries === 0 ) {
73+ return ; // exit condition
74+ }
75+ if ( process && process . pid && process . kill && ! process . killed ) {
76+ setTimeout ( ( ) => {
77+ if ( ! process . kill ( 'SIGKILL' ) ) {
78+ retries -- ;
79+ killBrowser ( retries ) ;
80+ }
81+ } , 200 ) ;
82+ }
83+ } ;
7084 const page = await browser . newPage ( ) ;
7185 try {
7286 await page . goto ( 'file://' + absolutePath ) ;
@@ -77,9 +91,10 @@ describe('svelte-style-csp', async () => {
7791 await page . click ( 'input' ) ;
7892 } catch ( err ) {
7993 // Transitions should fail with strict CSP
94+ await browser . close ( ) ;
8095 assert . throws ( err ) ;
8196 }
82- await browser . close ( ) ;
97+ killBrowser ( ) ;
8398 } ) ;
8499 } ) ;
85100} ) ;
You can’t perform that action at this time.
0 commit comments