Skip to content

Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.

Exiting tests when there unhandled promise rejection

Marek Trunkatd5ef33dd5359
diff --git a/test/_helper.js b/test/_helper.js
index 89d5cbb76..ffe786caa 100644
--- a/test/_helper.js
+++ b/test/_helper.js
@@ -8,9 +8,10 @@ export const LOCAL_STORAGE_DIR = path.join(__dirname, '..', 'tmp', 'local-emulat
// Log unhandled rejections.
process.on('unhandledRejection', (err) => {
console.log('---------------------------------------------------------------------');
- console.log('------------- WARNING: Unhandled promise rejection !!!! -------------');
+ console.log('- ERROR: Killing tests because of unhandled promise rejection !!!!! -');
console.log('---------------------------------------------------------------------');
console.log(err);
+ process.exit(1);
});
// Immediately ensure that local emulation dir exists.