-
-
Notifications
You must be signed in to change notification settings - Fork 156
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
playground/vue/__tests__/vue.spec.ts > hmr > should reload when relies file changed
test is flaky
#485
Labels
Comments
It was previously only unstable on windows, and running it again sometimes passed. I've tried to investigate, but there's no error on local. 😓 |
I got the following output with this patch when the test failed. patchdiff --git a/packages/plugin-vue/src/main.ts b/packages/plugin-vue/src/main.ts
index eddcfff..b511c72 100644
--- a/packages/plugin-vue/src/main.ts
+++ b/packages/plugin-vue/src/main.ts
@@ -150,6 +150,7 @@ export async function transformMain(
)
output.push(
`import.meta.hot.on('file-changed', ({ file }) => {`,
+ normalizePath(filename).endsWith('Hmr.vue') ? ` console.log('file-changed', file)` : '',
` __VUE_HMR_RUNTIME__.CHANGED_FILE = file`,
`})`,
)
diff --git a/playground/vue/__tests__/vue.spec.ts b/playground/vue/__tests__/vue.spec.ts
index 988efa7..0a5e872 100644
--- a/playground/vue/__tests__/vue.spec.ts
+++ b/playground/vue/__tests__/vue.spec.ts
@@ -207,14 +207,20 @@ describe('hmr', () => {
})
test('should reload when relies file changed', async () => {
- // rerender
- editFile('Hmr.vue', (code) => code.replace('HMR', 'HMR updated'))
- await untilUpdated(() => page.textContent('h2.hmr'), 'HMR updated')
- await untilUpdated(() => page.textContent('.hmr-number'), '100')
-
- // reload
- editFile('lib.js', (code) => code.replace('100', '200'))
- await untilUpdated(() => page.textContent('.hmr-number'), '200')
+ browserLogs.length = 0
+ try {
+ // rerender
+ editFile('Hmr.vue', (code) => code.replace('HMR', 'HMR updated'))
+ await untilUpdated(() => page.textContent('h2.hmr'), 'HMR updated')
+ await untilUpdated(() => page.textContent('.hmr-number'), '100')
+
+ // reload
+ editFile('lib.js', (code) => code.replace('100', '200'))
+ await untilUpdated(() => page.textContent('.hmr-number'), '200')
+ } catch (e) {
+ console.log('browserLogs', browserLogs)
+ throw e
+ }
})
test('global hmr for some scenarios', async () => {
|
9 tasks
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
This test has been failing many times.
vite-plugin-vue/playground/vue/__tests__/vue.spec.ts
Lines 209 to 218 in 388403f
The text was updated successfully, but these errors were encountered: