-
Notifications
You must be signed in to change notification settings - Fork 8
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: ensure proper resolve condition set for vitest env #81
Conversation
🦋 Changeset detectedLatest commit: f195752 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 |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #81 +/- ##
==========================================
- Coverage 86.60% 86.00% -0.61%
==========================================
Files 9 9
Lines 545 550 +5
Branches 138 141 +3
==========================================
+ Hits 472 473 +1
- Misses 64 68 +4
Partials 9 9
☔ View full report in Codecov by Sentry. |
954b3de
to
f195752
Compare
@DylanPiercey Ok, so how do I use this workaround? I updated to 3.0.1, and the following still gives me
It doesn't matter what is in the template, even a blank file. |
@vwong can you ensure you're on the latest version of everything and that the vitest cache is cleared at |
Ah dang I think I see the issue. It's that you're using comments to define the test environment. My work around only works if the environment is configured in your vite/vitest config. |
Ah yes of course, now the change makes more sense. So, to handle a mix of |
@vwong you can also use the vitest.workspace.ts import marko from "@marko/vite";
import { defineWorkspace } from "vitest/config";
export default defineWorkspace([
{
test: {
name: "server",
environment: "node",
include: ["src/**/{*.,}test.server.ts"],
},
plugins: [marko()],
},
{
test: {
name: "browser",
environment: "jsdom",
include: ["src/**/{*.,}test.browser.ts"],
},
plugins: [marko()],
},
]); |
Thanks, works a charm now! |
Description
Ensure
browser
export condition is configured when intest
mode and targeting a dom environment.Motivation and Context
Workaround for vitest-dev/vitest#2603 which causes the incorrect Marko runtime to be loaded in the brower env for that test runner.
Checklist: