Skip to content

Commit

Permalink
test: harden partialAccept test (#441)
Browse files Browse the repository at this point in the history
  • Loading branch information
rixo committed Sep 17, 2022
1 parent f66c1ba commit 223ebdd
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
6 changes: 6 additions & 0 deletions packages/e2e-tests/hmr/__tests__/hmr.spec.ts
Expand Up @@ -146,6 +146,12 @@ if (!isBuild) {
await updateModuleContext((content) => content.replace('y = 1', 'y = 2'));
expect(await getText(`#hmr-with-context`)).toContain('x=0 y=2 slot=2');
expect(await getText(`#hmr-without-context`)).toContain('x=0 y=2 slot=');
expect(browserLogs).toEqual(
expect.arrayContaining([expect.stringMatching(/hot updated:.*UsingNamed.svelte/)])
);
expect(browserLogs).not.toEqual(
expect.arrayContaining([expect.stringMatching(/hot updated:.*UsingOnlyDefault.svelte/)])
);
});

test('should work with emitCss: false in vite config', async () => {
Expand Down
@@ -1,6 +1,7 @@
<script>
import ModuleContext, { y } from './ModuleContext.svelte';
import UsingNamed from './UsingNamed.svelte';
import UsingOnlyDefault from './UsingOnlyDefault.svelte';
</script>

<ModuleContext id="hmr-with-context">{y}</ModuleContext>
<ModuleContext id="hmr-without-context" />
<UsingNamed />
<UsingOnlyDefault />
@@ -0,0 +1,5 @@
<script>
import ModuleContext, { y } from './ModuleContext.svelte';
</script>

<ModuleContext id="hmr-with-context">{y}</ModuleContext>
@@ -0,0 +1,5 @@
<script>
import ModuleContext from './ModuleContext.svelte';
</script>

<ModuleContext id="hmr-without-context" />

0 comments on commit 223ebdd

Please sign in to comment.