Skip to content

test: repair E2E test infrastructure for pnpm + crawlee v4#3805

Merged
janbuchar merged 5 commits into
v4from
fix/e2e-crawlee-utils-import
Jul 2, 2026
Merged

test: repair E2E test infrastructure for pnpm + crawlee v4#3805
janbuchar merged 5 commits into
v4from
fix/e2e-crawlee-utils-import

Conversation

@janbuchar

@janbuchar janbuchar commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Fixes the E2E test harness, which was crashing at startup and never actually running tests.

Changes

  • Declare crawlee + all e2e-imported @crawlee/* packages as root devDeps so in-process (LOCAL/MEMORY) actor imports resolve under pnpm.
  • copyPackages: rewrite workspace:*file: and copy transitive deps, so pushed PLATFORM actors build with npm.
  • Swap yarn/npx for pnpm/pnpm exec (storage-local install, camoufox fetch) to satisfy the packageManager/devEngines gate.
  • Pin apify to the v4 SDK (root override + actors → next-v4); the 3.x SDK is runtime-incompatible with @crawlee/core@4.

Result

Harness now runs; MEMORY passes 19 tests. Remaining failures are not infra:

  • LOCAL: @apify/storage-local doesn't implement the v4 StorageClient interface (createRequestQueueClient etc.) — needs a v4-compatible storage-local or dropping the job.
  • MEMORY: genuine v4 API/behavior regressions (crawler.log.setLevel, contextPipelineBuilder, assorted assertions).

@janbuchar janbuchar added adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. labels Jul 1, 2026
janbuchar added 4 commits July 1, 2026 15:43
The published apify SDK depends on the 3.x line of @crawlee/*, but the
e2e tests run it against the local 4.x workspace packages. Its runtime
Crawlee-version guard tripped for the in-process LOCAL/MEMORY runs
("Detected incompatible Crawlee version"). Override apify's @crawlee/core,
@crawlee/types and @crawlee/utils to the workspace versions, mirroring the
per-actor overrides.apify used for PLATFORM tests.
apify@3.x is not runtime compatible with @crawlee/core@4 (it iterates
Configuration.INTEGER_VARS, which was removed in v4), causing
"TypeError: Configuration.INTEGER_VARS is not iterable". Pin the root
apify to the v4 beta and point the e2e actors at the next-v4 dist-tag so
both the in-process (LOCAL/MEMORY) harness and the pushed PLATFORM actors
run the matching v4 SDK.
@janbuchar janbuchar changed the title fix: Add @crawlee/utils to root package dependencies to fix E2E tests fix(e2e): repair E2E test infrastructure for pnpm + crawlee v4 Jul 1, 2026
@janbuchar
janbuchar requested review from B4nan and barjin July 1, 2026 14:43
@janbuchar
janbuchar marked this pull request as ready for review July 1, 2026 14:43
@B4nan B4nan changed the title fix(e2e): repair E2E test infrastructure for pnpm + crawlee v4 test: repair E2E test infrastructure for pnpm + crawlee v4 Jul 1, 2026
@B4nan

B4nan commented Jul 1, 2026

Copy link
Copy Markdown
Member

btw the new @crawlee/fs-storage package is not published to npm (i guess lerna not being able to publish because of OIDC). we'll need to publish it manually and set up OIDC afterward for CI to work. not sure if you have permissions to deal with this, i can do it myself if not.

@barjin barjin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thank you @janbuchar !

I also got a brainwave while reading this ⬇️

Comment thread test/e2e/tools.mjs
// npm (used when building the actor on the platform) does not understand pnpm's
// `workspace:` protocol, so rewrite internal `@crawlee/*` deps to sibling `file:`
// references and make sure those packages get copied as well.
for (const depGroup of ['dependencies', 'optionalDependencies', 'peerDependencies']) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering whether we could use pnpm deploy (docs) when building the e2e actors somehow.

We could essentially save ourselves all this setup with something like

pnpm deploy --filter=test-cheerio-default dist

which generates dist folder with the test-cheerio-default workspace package contents + injects node_modules with the right versions of workspace packages etc. This can then be directly copied into the Docker image.

Granted, this relies on some preconditions (e.g., the e2e tests are workspace packages), but these can be imo done dynamically with less code.

Anyway, not a blocker rn, but maybe a way we can let Claude explore later on?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds amazing. The e2e setup is far away from great, and now this PR makes things worse (more code for the same functionality). I would love to get rid of this complexity.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@janbuchar
janbuchar merged commit 56f1dfd into v4 Jul 2, 2026
10 of 13 checks passed
@janbuchar
janbuchar deleted the fix/e2e-crawlee-utils-import branch July 2, 2026 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants