File tree Expand file tree Collapse file tree 2 files changed +23
-17
lines changed
packages/rrweb/test/record Expand file tree Collapse file tree 2 files changed +23
-17
lines changed Original file line number Diff line number Diff line change @@ -40,14 +40,13 @@ jobs:
4040 - name : Run tests
4141 run : PUPPETEER_HEADLESS=true xvfb-run --server-args="-screen 0 1920x1080x24" pnpm test
4242
43- # TODO: Re-enable after pnpm migration is merged to main
44- # - name: Check bundle sizes
45- # uses: preactjs/compressed-size-action@v2
46- # with:
47- # install-script: "pnpm install --frozen-lockfile"
48- # build-script: "build:all"
49- # compression: "none"
50- # pattern: "**/dist/*.{js,cjs,mjs,css}"
43+ - name : Check bundle sizes
44+ uses : preactjs/compressed-size-action@v2
45+ with :
46+ install-script : " pnpm install --frozen-lockfile"
47+ build-script : " build:all"
48+ compression : " none"
49+ pattern : " **/dist/*.{js,cjs,mjs,css}"
5150
5251 - name : Upload diff images to GitHub
5352 uses : actions/upload-artifact@v4
Original file line number Diff line number Diff line change @@ -46,21 +46,28 @@ type ExtraOptions = {
4646async function injectRecordScript (
4747 frame : puppeteer . Frame ,
4848 options ?: ExtraOptions ,
49+ retryCount = 0 ,
4950) {
51+ const MAX_RETRIES = 5 ;
5052 try {
5153 await frame . addScriptTag ( {
5254 path : path . resolve ( __dirname , '../../dist/rrweb.umd.cjs' ) ,
5355 } ) ;
5456 } catch ( e ) {
55- // we get this error: `Protocol error (DOM.resolveNode): Node with given id does not belong to the document`
56- // then the page wasn't loaded yet and we try again
57- if (
58- ! e . message . includes ( 'DOM.resolveNode' ) ||
59- ! e . message . includes ( 'DOM.describeNode' )
60- )
61- throw e ;
62- await injectRecordScript ( frame , options ) ;
63- return ;
57+ const retryableErrors = [
58+ 'DOM.resolveNode' ,
59+ 'DOM.describeNode' ,
60+ 'Execution context was destroyed' ,
61+ ] ;
62+ const isRetryable = retryableErrors . some ( ( error ) =>
63+ e . message . includes ( error ) ,
64+ ) ;
65+ if ( isRetryable && retryCount < MAX_RETRIES ) {
66+ await new Promise ( ( resolve ) => setTimeout ( resolve , 50 ) ) ;
67+ await injectRecordScript ( frame , options , retryCount + 1 ) ;
68+ return ;
69+ }
70+ throw e ;
6471 }
6572 options = options || { } ;
6673 await frame . evaluate ( ( options ) => {
You can’t perform that action at this time.
0 commit comments