Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix --test-scheduled with custom builds & --x-dev-env #7164

Merged
merged 3 commits into from
Nov 5, 2024

Conversation

penalosa
Copy link
Contributor

@penalosa penalosa commented Nov 4, 2024

Fixes #7152

Correctly pass the --test-scheduled flag in BundleController when using a custom build. Previously the types for bundleWorker() allowed arguments not to be passed—this PR changes that to require an explicit undefined to be passed, which should prevent this type of regression happening again.


  • Tests
    • TODO (before merge)
    • Tests included
    • Tests not necessary because:
  • E2E Tests CI Job required? (Use "e2e" label or ask maintainer to run separately)
    • I don't know
    • Required
    • Not required because:
  • Public documentation
    • TODO (before merge)
    • Cloudflare docs PR(s):
    • Documentation not necessary because: bugfix

@penalosa penalosa requested review from a team as code owners November 4, 2024 13:55
Copy link

changeset-bot bot commented Nov 4, 2024

🦋 Changeset detected

Latest commit: 3306824

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
wrangler Patch
@cloudflare/vitest-pool-workers Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@workers-devprod workers-devprod added the e2e Run e2e tests on a PR label Nov 4, 2024
@@ -424,10 +422,7 @@ export async function bundleWorker(
...define,
},
}),
loader: {
...COMMON_ESBUILD_OPTIONS.loader,
...(loader || {}),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The loader option wasn't used anywhere, so I removed it

@@ -321,6 +322,17 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
props.compatibilityDate ?? config.compatibility_date,
props.compatibilityFlags ?? config.compatibility_flags
),
plugins: [logBuildOutput(nodejsCompatMode)],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a separate fix to unify versions & deploy messaging

@@ -133,6 +133,20 @@ export class BundlerController extends Controller<BundlerControllerEventMap> {
config.compatibilityDate,
config.compatibilityFlags
),
testScheduled: config.dev.testScheduled,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the actual fix for the reported issue

Copy link
Contributor

github-actions bot commented Nov 4, 2024

A wrangler prerelease is available for testing. You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11681256447/npm-package-wrangler-7164

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/7164/npm-package-wrangler-7164

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11681256447/npm-package-wrangler-7164 dev path/to/script.js
Additional artifacts:
npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11681256447/npm-package-create-cloudflare-7164 --no-auto-update
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11681256447/npm-package-cloudflare-kv-asset-handler-7164
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11681256447/npm-package-miniflare-7164
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11681256447/npm-package-cloudflare-pages-shared-7164
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11681256447/npm-package-cloudflare-vitest-pool-workers-7164
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11681256447/npm-package-cloudflare-workers-editor-shared-7164
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11681256447/npm-package-cloudflare-workers-shared-7164
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11681256447/npm-package-cloudflare-workflows-shared-7164

Note that these links will no longer work once the GitHub Actions artifact expires.


[email protected] includes the following runtime dependencies:

Package Constraint Resolved
miniflare workspace:* 3.20241022.0
workerd 1.20241022.0 1.20241022.0
workerd --version 1.20241022.0 2024-10-22

Please ensure constraints are pinned, and miniflare/workerd minor versions match.

@MattIPv4
Copy link

MattIPv4 commented Nov 4, 2024

👋 Just confirming that following my repro steps in the issue, /__scheduled works as expected with this preview version, and the warning is also no longer showing!

@penalosa penalosa added the start-dev-worker Relating to the startDevWorker API label Nov 4, 2024
@penalosa penalosa force-pushed the penalosa/fix-test-scheduled-custom-build branch from 33b42f6 to 3306824 Compare November 5, 2024 09:29
@@ -110,6 +110,7 @@ describe("defineNavigatorUserAgent is respected", () => {
exports: [],
},
path.resolve("dist"),
// @ts-expect-error Ignore the requirement for passing undefined values
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Just wanted to avoid @ts-expect-error. This might also make the test clearer which options the tests really cares.

{
  // Extracted from the original options
  ...defaultBundleOptions,
  defineNavigatorUserAgent: false,
}

@edmundhung edmundhung merged commit 1bd4885 into main Nov 5, 2024
21 of 22 checks passed
@edmundhung edmundhung deleted the penalosa/fix-test-scheduled-custom-build branch November 5, 2024 11:09
@workers-devprod workers-devprod mentioned this pull request Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e2e Run e2e tests on a PR start-dev-worker Relating to the startDevWorker API
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

🐛 BUG: --test-scheduled w/ custom build does not work from 3.80.0 onward
5 participants