Skip to content
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

fix(@astrojs/vercel): improve file detection #7621

Merged
merged 1 commit into from
Jul 12, 2023

Conversation

ematipico
Copy link
Member

Changes

The file detection of the handler file needed to be corrected.

Testing

I improved the testing cases by adding an assertion for the contents inside the middleware file. I noticed that the snapshots are not always reliable.

Docs

N/A

@changeset-bot
Copy link

changeset-bot bot commented Jul 11, 2023

🦋 Changeset detected

Latest commit: dd3fe5e

The changes in this PR will be included in the next version bump.

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

@github-actions github-actions bot added the pkg: integration Related to any renderer integration (scope) label Jul 11, 2023
@ematipico
Copy link
Member Author

One more thing I noticed is, snapshot tests are very slow, even on my machine (MacBook M2). I wonder if there's a better testing library out there

if (existsSync(filePathEdgeMiddleware) + '.js' || existsSync(filePathEdgeMiddleware) + '.ts') {
if (existsSync(filePathEdgeMiddleware + '.js') || existsSync(filePathEdgeMiddleware + '.ts')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow I missed this too 🙈

packages/integrations/vercel/test/edge-middleware.test.js Outdated Show resolved Hide resolved
@bluwy
Copy link
Member

bluwy commented Jul 11, 2023

One more thing I noticed is, snapshot tests are very slow, even on my machine (MacBook M2). I wonder if there's a better testing library out there

chai-jest-snapshot is a little old and using an older version of jest-snapshot, which maybe attributes to the slowness. Maybe we could fork a more up-to-date version?

@ematipico ematipico force-pushed the fix/incorrect-resolution-vercel branch from dbdd42f to dd3fe5e Compare July 11, 2023 15:37
@ematipico ematipico merged commit 2ddf342 into main Jul 12, 2023
@ematipico ematipico deleted the fix/incorrect-resolution-vercel branch July 12, 2023 07:06
@astrobot-houston astrobot-houston mentioned this pull request Jul 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: integration Related to any renderer integration (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants