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.

test: fix migration test #2

Szymon Marczakefe0ae52047c
diff --git a/test/e2e/migration/actor/main.js b/test/e2e/migration/actor/main.js
index 057ca2896..9aa1963f1 100644
--- a/test/e2e/migration/actor/main.js
+++ b/test/e2e/migration/actor/main.js
@@ -1,4 +1,4 @@
-import { Worker, isMainThread } from 'worker_threads';
+import { Worker, workerData } from 'worker_threads';
import { URL } from 'url';
import { once } from 'events';
import { Actor } from 'apify';
@@ -14,16 +14,20 @@ const mainOptions = {
const thisFile = new URL(import.meta.url);
-if (isMainThread) {
- const firstRun = new Worker(thisFile);
+if (workerData !== '#actor') {
+ const firstRun = new Worker(thisFile, {
+ workerData: '#actor',
+ });
const [firstExitCode] = await once(firstRun, 'exit');
- const secondRun = new Worker(thisFile);
+ const secondRun = new Worker(thisFile, {
+ workerData: '#actor',
+ });
const [secondExitCode] = await once(secondRun, 'exit');
- if (firstRun !== 0 || secondRun !== 0) {
+ if (firstExitCode !== 0 || secondExitCode !== 0) {
throw new Error(`Unexpected exit code:\nfirst run: ${firstExitCode}\nsecond run: ${secondExitCode}`);
}
} else {