You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: CONTRIBUTING.md
+6
Original file line number
Diff line number
Diff line change
@@ -176,6 +176,12 @@ Any tests for `astro build` output should use the main `mocha` tests rather than
176
176
177
177
If a test needs to validate what happens on the page after it's loading in the browser, that's a perfect use for E2E dev server tests, i.e. to verify that hot-module reloading works in `astro dev` or that components were client hydrated and are interactive.
178
178
179
+
#### Creating tests
180
+
181
+
When creating new tests, it's best to reference other existing test files and replicate the same setup. Some other tips include:
182
+
183
+
- When re-using a fixture multiple times with different configurations, you should also configure unique `outDir`, `build.client`, and `build.server` values so the build output runtime isn't cached and shared by ESM between test runs.
// Cloudflare env is only available per request. This isn't feasible for code that access env vars
65
+
// in a global way, so we shim their access as `process.env.*`. This is not the recommended way for users to access environment variables. But we'll add this for compatibility for chosen variables. Mainly to support `@astrojs/db`
66
+
vite.define={
67
+
'process.env': 'process.env',
68
+
...vite.define,
69
+
};
70
+
}
71
+
// we thought that vite config inside `if (target === 'server')` would not apply for client
72
+
// but it seems like the same `vite` reference is used for both
73
+
// so we need to reset the previous conflicting setting
74
+
// in the future we should look into a more robust solution
0 commit comments