[vitest-pool-workers] Fix Workflow binding's script_name when it matches its own Worker name#10033
Conversation
🦋 Changeset detectedLatest commit: dbf9e1d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
wrangler
commit: |
|
Failed to automatically backport this PR's changes to Wrangler v3. Please manually create a PR targeting the Depending on your changes, running Notes:
|
e7a36a3 to
f4d51dc
Compare
7b1a2d8 to
ae0a9c5
Compare
LuisDuarte1
left a comment
There was a problem hiding this comment.
Approved from the workflows team.
|
I think the name is available under |
|
but if Pete's suggestion to strip out the name works, that'd be great as its much simpler |
I think we'd still need to know the Worker name in case it is actually pointing to a different Worker not itself? |
oh sorry fair enough - i guess check if it matches project.project.name, and strip it out if it does? |
Yes, I'll do it, however I'm not able to get the worker name through project.project.name. It actually returns nothing |
…name matches its own Worker name removing try catch since error gets thrown either way use userConfigPath instead of redirected one (#10005) Revert "use userConfigPath instead of redirected one (#10005)" This reverts commit 5c11fe7504a0b16a963c726cc63748426fd8bab6. fix deep import prettier run fix: make vitest-pool-workers not break if Workflow binding's script_name matches its own Worker name
3cdd607 to
dbf9e1d
Compare
Fixes WOR-760.
A user can define a Workflow binding where the
script_nameis the same as the name of the Worker on which the binding is defined. Although redundant, it should be supported.vitest-pool-workersbreaks because it does not use the user's Worker as the test entrypoint. It uses its own runner worker, which has a different name generated before execution. This leads to a mismatch between thescript_namein the binding and the Worker that will run.To fix this, the code now checks it a workflow binding's
script_namematches its own Worker's name. When it does,script_nameis removed, making it default to the current worker.