Skip to content

test: use polling for hmr tests in vite-ssr suite, otherwise they som… #384

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

Merged
merged 1 commit into from
Jul 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,17 @@ if (!isBuild) {
'<div id="hmr-test">foo</div>\n<!-- HMR-TEMPLATE-INJECT -->'
)
);
expect(await getText(`#hmr-test`)).toBe('foo');
await untilMatches(() => getText(`#hmr-test`), 'foo', '#hmr-test contains text foo');
});
test('should apply style update', async () => {
expect(await getColor(`h1`)).toBe('green');
await updateApp((content) => content.replace('color: green', 'color: red'));
expect(await getColor(`h1`)).toBe('red');
await untilMatches(() => getColor('h1'), 'red', 'h1 has color red');
});
test('should not preserve state of updated props', async () => {
expect(await getText(`#foo`)).toBe('foo');
await updateApp((content) => content.replace("foo = 'foo'", "foo = 'bar'"));
expect(await getText(`#foo`)).toBe('bar');
await untilMatches(() => getText(`#foo`), 'bar', '#foo contains text bar');
});
});
}
6 changes: 3 additions & 3 deletions packages/e2e-tests/vite-ssr/__tests__/vite-ssr.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@ if (!isBuild) {
'<div id="hmr-test">foo</div>\n<!-- HMR-TEMPLATE-INJECT -->'
)
);
expect(await getText(`#hmr-test`)).toBe('foo');
await untilMatches(() => getText(`#hmr-test`), 'foo', '#hmr-test contains text foo');
});
test('should apply style update', async () => {
expect(await getColor(`h1`)).toBe('green');
await updateApp((content) => content.replace('color: green', 'color: red'));
expect(await getColor(`h1`)).toBe('red');
await untilMatches(() => getColor('h1'), 'red', 'h1 has color red');
});
test('should not preserve state of updated props', async () => {
expect(await getText(`#foo`)).toBe('foo');
await updateApp((content) => content.replace("foo = 'foo'", "foo = 'bar'"));
expect(await getText(`#foo`)).toBe('bar');
await untilMatches(() => getText(`#foo`), 'bar', '#foo contains text bar');
});
});
}