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.
TypeScript apifyautomationcrawlercrawlingheadlessheadless-chromejavascriptnodejsnpmplaywrightpuppeteerscraperscrapingtypescriptweb-crawlerweb-crawlingweb-scraping
Add test for autoscaledpool.abort()
Ondra Urband25281d5511e
diff --git a/test/autoscaling/autoscaled_pool.js b/test/autoscaling/autoscaled_pool.jsindex c42180134..19b42f0d9 100644--- a/test/autoscaling/autoscaled_pool.js+++ b/test/autoscaling/autoscaled_pool.js@@ -323,6 +323,26 @@ describe('AutoscaledPool', () => {pool._autoscale(() => {});expect(pool.desiredConcurrency).to.be.eql(2);});++ it('should abort', async () => {+ let finished = false;+ let aborted = false;+ const pool = new AutoscaledPool({+ runTaskFunction: () => {+ if (!aborted) {+ return (async () => {+ await pool.abort();+ aborted = true;+ })();+ }+ return null;+ },+ isFinishedFunction: () => { finished = true; },+ isTaskReadyFunction: () => !aborted,+ });+ await pool.run();+ expect(finished).to.be.eql(false);+ });});/* eslint-enable no-underscore-dangle */