File tree 1 file changed +16
-1
lines changed 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 () => {
67
67
'svelte-test-transitions-no-styles-csp/index.html'
68
68
) ;
69
69
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
+ } ;
70
84
const page = await browser . newPage ( ) ;
71
85
try {
72
86
await page . goto ( 'file://' + absolutePath ) ;
@@ -77,9 +91,10 @@ describe('svelte-style-csp', async () => {
77
91
await page . click ( 'input' ) ;
78
92
} catch ( err ) {
79
93
// Transitions should fail with strict CSP
94
+ await browser . close ( ) ;
80
95
assert . throws ( err ) ;
81
96
}
82
- await browser . close ( ) ;
97
+ killBrowser ( ) ;
83
98
} ) ;
84
99
} ) ;
85
100
} ) ;
You can’t perform that action at this time.
0 commit comments