From 2a169377c892984d98d03d64a39a853260a5d942 Mon Sep 17 00:00:00 2001 From: Kiko Beats Date: Wed, 10 Sep 2025 00:39:49 +0200 Subject: [PATCH 1/2] chore(readability): avoid errors propagation --- packages/metascraper-readability/src/worker.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/metascraper-readability/src/worker.js b/packages/metascraper-readability/src/worker.js index bf4a53f90..d5fb5d8b0 100644 --- a/packages/metascraper-readability/src/worker.js +++ b/packages/metascraper-readability/src/worker.js @@ -13,7 +13,12 @@ const parseReader = reader => { const getDocument = ({ url, html }) => { const { Window } = require('happy-dom') - const window = new Window({ url }) + const window = new Window({ + url, + settings: { + errorCapture: 'processLevel' + } + }) const document = window.document document.write(html) return document From 67ce2b195728cd716f2dd46d5e2703622971423d Mon Sep 17 00:00:00 2001 From: Kiko Beats Date: Wed, 10 Sep 2025 00:59:21 +0200 Subject: [PATCH 2/2] test: disable while running tests --- packages/metascraper-readability/src/worker.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/metascraper-readability/src/worker.js b/packages/metascraper-readability/src/worker.js index d5fb5d8b0..d54a88913 100644 --- a/packages/metascraper-readability/src/worker.js +++ b/packages/metascraper-readability/src/worker.js @@ -11,13 +11,14 @@ const parseReader = reader => { } } +const errorCapture = + process.env.NODE_ENV === 'test' ? 'tryAndCatch' : 'processLevel' + const getDocument = ({ url, html }) => { const { Window } = require('happy-dom') const window = new Window({ url, - settings: { - errorCapture: 'processLevel' - } + settings: { errorCapture } }) const document = window.document document.write(html)