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
test: serve the requestsFromUrl lists locally in the throttling warning test (#4188)
Mikhail Koviazinfc525f1c0c45
diff --git a/packages/basic-crawler/test/throttling_request_manager.test.ts b/packages/basic-crawler/test/throttling_request_manager.test.tsindex 92494a6e7..c52902c2b 100644--- a/packages/basic-crawler/test/throttling_request_manager.test.ts+++ b/packages/basic-crawler/test/throttling_request_manager.test.ts@@ -15,6 +15,7 @@ import {} from '@crawlee/core';import { sleep } from '@crawlee/utils';import { FileSystemStorageBackend } from '@crawlee/fs-storage';+import { BaseHttpClient } from '@crawlee/http-client';describe('ThrottlingRequestManager', () => {beforeEach(() => {@@ -244,8 +245,15 @@ describe('ThrottlingRequestManager', () => {vitest.spyOn(logger, 'child').mockReturnValue(logger);const warning = vitest.spyOn(logger, 'warning').mockImplementation(() => {});+ // The inner queue downloads the lists, so serve them locally: whatever a live host returns (an empty+ // list, an error) would be logged through the same spied logger.+ const httpClient = Object.assign(Object.create(BaseHttpClient.prototype) as BaseHttpClient, {+ sendRequest: vitest.fn(async () => new Response('https://example.com/1\nhttps://example.com/2')),+ stream: vitest.fn(async () => new Response()),+ });+const manager = new ThrottlingRequestManager({- inner: await createQueue(),+ inner: await RequestQueue.open({ name: 'inner-queue' }, { httpClient }),domains: ['example.com'],});