-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[miniflare] custom serialization for RegExp object #9454
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
[miniflare] custom serialization for RegExp object #9454
Conversation
🦋 Changeset detectedLatest commit: 2892b99 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 |
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.
Looks good to me 🤙
|
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/15445882788/npm-package-wrangler-9454Prereleases for other packages:
wget https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/15445882788/npm-package-cloudflare-workers-bindings-extension-9454 -O ./cloudflare-workers-bindings-extension.0.0.0-vdfd83e32e.vsix && code --install-extension ./cloudflare-workers-bindings-extension.0.0.0-vdfd83e32e.vsix
npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/15445882788/npm-package-create-cloudflare-9454 --no-auto-update
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/15445882788/npm-package-cloudflare-kv-asset-handler-9454
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/15445882788/npm-package-miniflare-9454
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/15445882788/npm-package-cloudflare-pages-shared-9454
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/15445882788/npm-package-cloudflare-unenv-preset-9454
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/15445882788/npm-package-cloudflare-vite-plugin-9454
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/15445882788/npm-package-cloudflare-vitest-pool-workers-9454
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/15445882788/npm-package-cloudflare-workers-editor-shared-9454
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/15445882788/npm-package-cloudflare-workers-shared-9454
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/15445882788/npm-package-cloudflare-workflows-shared-9454Note that these links will no longer work once the GitHub Actions artifact expires. |
petebacondarwin
left a comment
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.
Really nice PR - thanks
|
The CI/TEsts (macOS) job is failing on main so not related to this PR. Once that is fixed we should rebase. |
|
Thank you for approval! |
50c5a85 to
2892b99
Compare
|
Congratulations @Enchan1207, the maintainer of this repository has issued you a holobyte! Here it is: https://holopin.io/holobyte/cmbi49hp8485607jrvkbrbuou This badge can only be claimed by you, so make sure that your GitHub account is linked to your Holopin account. You can manage those preferences here: https://holopin.io/account. |
This reverts commit 9c30aec.
|
Sorry this should have been backported to v3 |
* feat: encode pattern when serialize RegExp object * test: check if test suites can be filtered by pattern includes non-ascii string * chore: remove unneeded comment * test: serialize RegExp object * docs: add changeset for vitest-pool-workers to describe fix
* feat: encode pattern when serialize RegExp object * test: check if test suites can be filtered by pattern includes non-ascii string * chore: remove unneeded comment * test: serialize RegExp object * docs: add changeset for vitest-pool-workers to describe fix
* fix(miniflare): api proxy preserve multiple Set-Cookie headers * [miniflare] custom serialization for RegExp object (#9454) * feat: encode pattern when serialize RegExp object * test: check if test suites can be filtered by pattern includes non-ascii string * chore: remove unneeded comment * test: serialize RegExp object * docs: add changeset for vitest-pool-workers to describe fix --------- Co-authored-by: Calvin Tsang <yuripave@gmail.com> Co-authored-by: Enchan <enchant0130@gmail.com> Co-authored-by: Victor Berchet <victor@suumit.com>
Summary
add custom serializer for
RegExpobject.Problem
vitest can filter test suites that contain non-ascii chars in its name.
but with
vitest-pool-workers, errors are reported:Cause
it caused by serialization process of
devalue.when option
-t(--testNamePatternto be exact) was specified, test pattern strings will be passed asRegExpobject (to metadata).metadatas for tests are passed as request header
MF-Vitest-Worker-Data, butdevalueoperatesRegExpobject as set of pattern and flags without any encoding.therefore, when non-ascii chars are included in
testNamePattern, it will be passed to request header directly.request header cannot contain any non-ascii chars, so the problems will be caused.
Solution
added custom reducer/revivers of
devaluethat encode/decode source strings ofRegExpobject as base64.