-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
test: test server.origin
#17886
test: test server.origin
#17886
Conversation
Run & review this pull request in StackBlitz Codeflow. |
server: { | ||
// This option caused issues with HMR, | ||
// although it should not affect the build | ||
origin: 'http://localhost:8080', | ||
}, |
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.
Technically this is testing server.origin
, but this relies on rather redundant prepend/strip base manipulation, which is going to removed in #17886.
playground/backend-integration/__tests__/backend-integration.spec.ts
Outdated
Show resolved
Hide resolved
playground/backend-integration/__tests__/backend-integration.spec.ts
Outdated
Show resolved
Hide resolved
await vi.waitFor(() => | ||
page | ||
.locator('.asset-reference.outside-root .asset-preview') | ||
.evaluate((el: HTMLImageElement) => el.naturalWidth > 0), | ||
) |
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.
Shouldn't this use expect
so that it throws if the image is not shown yet? Not familiar with waitFor
, but I thought it would retry only when it throws
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.
Oh, good catch. I meant to use waitUntil
https://vitest.dev/api/vi.html#vi-waituntil
Description
This PR adds a test case for
server.origin
(introduced long time ago in #5104). The playground here doesn't actually have a separate server, so it doesn't really make sense, but this confirms that url asset is served withserver.origin
prefix as intended.I also made a PR on sapphi-red/vite-setup-catalogue#39 to update an example to show case the actual usage with backend.