-
Notifications
You must be signed in to change notification settings - Fork 123
Migrate tests to vitest and configure miniflare integration #676
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
Draft
AaronDDM
wants to merge
13
commits into
main
Choose a base branch
from
cursor/migrate-tests-to-vitest-and-configure-miniflare-integration-1910
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Migrate tests to vitest and configure miniflare integration #676
AaronDDM
wants to merge
13
commits into
main
from
cursor/migrate-tests-to-vitest-and-configure-miniflare-integration-1910
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit updates the GitHub Actions workflow to use the latest versions of actions/checkout and actions/setup-node. It also migrates the testing framework from Jest to Vitest, which includes updating relevant dependencies and configurations. Co-authored-by: aaron.d <aaron.d@nylas.com>
|
Cursor Agent can help with this pull request. Just |
…n in vitest.config.ts
…and Cloudflare Workers testing. Updated job matrix to include test types and conditional steps for linting and testing based on the environment.
…ks, allowing all jobs to complete regardless of failures.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #676 +/- ##
==========================================
+ Coverage 96.42% 96.79% +0.36%
==========================================
Files 37 38 +1
Lines 812 2342 +1530
Branches 72 299 +227
==========================================
+ Hits 783 2267 +1484
- Misses 26 73 +47
+ Partials 3 2 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This commit updates the Vitest configuration to use Cloudflare Workers settings and improves the global fetch mock for API testing. It also removes the outdated GitHub Actions workflow and the script for converting tests to Vitest, streamlining the testing process. Additionally, the setup for Miniflare tests has been enhanced to better simulate the Cloudflare Workers environment.
5c0740d to
8708401
Compare
This commit updates the Vitest configuration to exclude Node.js-specific tests incompatible with the Workers environment. It also refines the fetch wrapper to intelligently detect the environment, using native Web APIs in Workers and falling back to node-fetch in Node.js. Additionally, several test files have been updated to replace deprecated lifecycle methods with their modern counterparts, improving overall test consistency and readability.
This commit updates the fetch wrapper to utilize dynamic imports for compatibility with CommonJS (CJS) builds. It modifies the environment detection logic to use global objects directly, ensuring proper functionality in both Workers and Node.js environments. Additionally, type exports have been adjusted to provide clearer type aliases for Web API types.
…ility This commit modifies the fetchWrapper-workers test suite to remove the conditional skipping of tests based on the environment. It enhances header checks to be case-insensitive and updates body handling to account for differences between Workers and Node.js. Additionally, the test for global Web APIs has been renamed for clarity, ensuring better compatibility and readability across environments.
This commit enhances the formatting of the fetchWrapper-workers test suite by standardizing the alignment of header checks and removing unnecessary blank lines. These changes improve the overall readability of the tests while maintaining their functionality across different environments.
This commit introduces a new 'lint' job in the GitHub Actions workflow to run lint and Prettier checks separately from the test jobs. The linting steps include setting up Node.js, installing dependencies, and executing lint checks, improving the clarity and organization of the CI process. Additionally, the previous lint checks have been removed from the test job to streamline the workflow.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR migrates the test suite from Jest to Vitest and integrates Cloudflare Workers (Miniflare) testing into the CI pipeline.
Key Changes:
@cloudflare/vitest-pool-workers) to ensure compatibility with Workers environments.pull-request.ymlworkflow now runs tests for both Node.js and Cloudflare Workers, ensuring comprehensive coverage across target platforms.This change modernizes the testing infrastructure and expands test coverage to critical Cloudflare Workers environments.
License
I confirm that this contribution is made under the terms of the MIT license and that I have the authority necessary to make this contribution on behalf of its copyright owner.