-
Notifications
You must be signed in to change notification settings - Fork 709
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
startWorker tests #6124
startWorker tests #6124
Conversation
🦋 Changeset detectedLatest commit: 883cb9d The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
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/9695127283/npm-package-wrangler-6124 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/6124/npm-package-wrangler-6124 Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9695127283/npm-package-wrangler-6124 dev path/to/script.js Additional artifacts:npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9695127283/npm-package-create-cloudflare-6124 --no-auto-update npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9695127283/npm-package-cloudflare-kv-asset-handler-6124 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9695127283/npm-package-miniflare-6124 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9695127283/npm-package-cloudflare-pages-shared-6124 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9695127283/npm-package-cloudflare-vitest-pool-workers-6124 Note that these links will no longer work once the GitHub Actions artifact expires.
Please ensure constraints are pinned, and |
86f68bb
to
3cb2867
Compare
packages/wrangler/src/__tests__/api/startDevWorker/LocalRuntimeController.test.ts
Outdated
Show resolved
Hide resolved
this.latest = input; | ||
this.emitConfigUpdateEvent(this.latest); | ||
this.emitConfigUpdateEvent(this.config); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a bug fix? If so what is it fixing? Is there a relevant test that would fail if this got reverted?
What is the difference between this.latest
and this.config
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was just an unused property of the startWorker programmatic interface only (not wrangler_dev or unstable_dev). this.latest
was used instead and internally where it mattered. Now there is a use-case for both latest and config – renamed to latestInput and latestConfig in another PR. There are tests in this PR that use the worker.config
(which is a getter for this ConfigController.latestConfig) value and will fail if it is not set
@@ -51,7 60,7 @@ export interface StartDevWorkerOptions { | |||
* This is the `main` property of a wrangler.toml. | |||
* You can specify a file path or provide the contents directly. | |||
*/ | |||
entrypoint: FilePath; | |||
entrypoint?: FilePath; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does it mean for a worker to have no entry-point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed offline, it means you will have to have a main
field in your config file. There is existing runtime code to check one of the possible ways to provide an entrypoint is actually provided and throws if not. The existing code was a bit too hairy to create a static type union but will be possible in the future as more deadcode paths are removed.
81cdea5
to
fc14b36
Compare
51fd6b9
to
1cc48ea
Compare
c1b4e9f
to
cb5ccb7
Compare
- `child_process.kill()` doesn't really work on Windows. Using `kill-tree` library instead - `killAllWranglerDev()` helper could mess up parallel tests since it kills all wrangler/workerd processes regardless of whether they are part of the current test - `shellac` library has issues on Windows when running background tasks. Using simple `execSync` and `spawn` functions instead - tightened up the timeouts a bit to avoid long running false negatives - reworked the helpers to use a class `WranglerE2ETestHelper` rather than the `e2eTest` extension.
by rewriting dev-env fixture tests as e2e tests without fakes
cb5ccb7
to
883cb9d
Compare
What this PR solves / how to test
This PR rewrites the fixtures/dev-env tests as e2e tests. Whereas the former were written when only the ProxyController had been implemented and therefore faked all other events, these new tests assume a full implementation.
The steps in each test are identical but have been rewritten for e2e usage. Notable difference: the script contents is written to disk instead of passing it via config because
config.entrypoint.contents
has been descoped for now.Author has addressed the following