workers-sdk icon indicating copy to clipboard operation
workers-sdk copied to clipboard

chore: convert file registry to class and add tests

Open andyjessop opened this issue 1 year ago • 2 comments

What this PR solves / how to test

Fixes #000.

This adds unit tests to the file-based registry. In order to do that, it converts the file to a class so that it can be easily re-instantiated in each test.

There are no logic changes to the source code - this is just a re-org.

Author has addressed the following

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

andyjessop avatar Oct 10 '24 14:10 andyjessop

🦋 Changeset detected

Latest commit: e5fea7a06d2e906929ec7e488f7ea0efd6347aac

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

changeset-bot[bot] avatar Oct 10 '24 14:10 changeset-bot[bot]

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/12137470953/npm-package-wrangler-6939

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

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

Or you can use npx with this latest build directly:

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

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.20241106.1
workerd 1.20241106.1 1.20241106.1
workerd --version 1.20241106.1 2024-11-06

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

github-actions[bot] avatar Oct 10 '24 14:10 github-actions[bot]

I'm feeling a lot less confident about this PR now, as it seems like there is some inherent flakiness that moving to a class somehow brings out. We now have the package tests passing on Windows, but failing on Linux and Mac.

My inclination is to close this PR for now, given the recent increase in stability after moving to the file-based registry by default.

andyjessop avatar Dec 03 '24 10:12 andyjessop