Skip to content

Commit

Permalink
URL encode project names in @cloudflare/vitest-pool-workers (#7084)
Browse files Browse the repository at this point in the history
* Fix #6954

* fix windows?

* replace chars with underscore

* Create soft-drinks-hug.md

* Update soft-drinks-hug.md

---------

Co-authored-by: Edmund Hung <[email protected]>
  • Loading branch information
penalosa and edmundhung authored Feb 19, 2025
1 parent b10483c commit 82a8937
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/soft-drinks-hug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cloudflare/vitest-pool-workers": patch
---

Support scoped names (e.g. `@scoped/durable-objects`) when using `runInDurableObject()`
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { defineWorkersProject } from "@cloudflare/vitest-pool-workers/config";

export default defineWorkersProject({
test: {
name: "@scoped/durable-objects",
poolOptions: {
workers: {
singleWorker: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/vitest-pool-workers/src/pool/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ interface Project {
const allProjects = new Map<string /* projectName */, Project>();

function getRunnerName(project: WorkspaceProject, testFile?: string) {
const name = `${WORKER_NAME_PREFIX}runner-${project.getName()}`;
const name = `${WORKER_NAME_PREFIX}runner-${project.getName().replace(/[^a-z0-9-]/gi, "_")}`;
if (testFile === undefined) {
return name;
}
Expand Down

0 comments on commit 82a8937

Please sign in to comment.