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.

chore(ci): exit E2E tests only once actually done (#3252)

Jindřich Bär3ed0568b5eb2
diff --git a/test/e2e/run.mjs b/test/e2e/run.mjs
index 579981c80..ae3784d36 100644
--- a/test/e2e/run.mjs
+++ b/test/e2e/run.mjs
@@ -109,7 +109,7 @@ async function run() {
console.log(`${colors.red('[fatal]')} test ${colors.yellow(`[${dir.name}]`)} failed with error: ${err}`);
});
- worker.on('exit', async (code) => {
+ const exitHandler = async (code) => {
if (code === SKIPPED_TEST_CLOSE_CODE) {
console.log(`Test ${colors.yellow(`[${dir.name}]`)} was skipped`);
return;
@@ -139,9 +139,17 @@ async function run() {
}
if (status === 'failure') failure = true;
+ };
+
+ worker.on('exit', async (exitCode) => {
+ try {
+ await exitHandler(exitCode);
+ } finally {
+ worker.emit('done');
+ }
});
- await once(worker, 'exit');
+ await once(worker, 'done');
}
}