diff --git a/.changeset/lovely-birds-kick.md b/.changeset/lovely-birds-kick.md new file mode 100644 index 000000000..f1bf2a4c3 --- /dev/null +++ b/.changeset/lovely-birds-kick.md @@ -0,0 +1,7 @@ +--- +'@powersync/common': minor +'@powersync/react-native': minor +'@powersync/web': minor +--- + +Revert `event-iterator` externalization in `@powersync/common` rollup config. This now bundles `event-iterator` again in `@powersync/common`'s non Node.js export. diff --git a/.changeset/slow-birds-breathe.md b/.changeset/slow-birds-breathe.md new file mode 100644 index 000000000..a7bd63010 --- /dev/null +++ b/.changeset/slow-birds-breathe.md @@ -0,0 +1,13 @@ +--- +'@powersync/web': minor +--- + +Fixes regression introduced in `@powersync/web@1.28.1`. Vite users don't need to include `event-iterator` in included optimized dependencies. + +vite.config.js + +```diff +include: [ +- '@powersync/web > event-iterator' +] +``` diff --git a/demos/example-vite/e2e/customers.test.js b/demos/example-vite/e2e/customers.test.js new file mode 100644 index 000000000..23f7be8fa --- /dev/null +++ b/demos/example-vite/e2e/customers.test.js @@ -0,0 +1,27 @@ +import { describe, expect, it, vi } from 'vitest'; +import { setupTestDOM } from './test-setup.js'; + +describe('Customer List E2E', () => { + it('should display the inserted customer "Fred" in the HTML list', async () => { + // Set up the DOM structure for testing + setupTestDOM(); + + // Import the main script which will execute and populate the DOM + await import('../src/index.js'); + + // Trigger DOMContentLoaded if needed (script listens for this) + if (document.readyState === 'complete' || document.readyState === 'interactive') { + document.dispatchEvent(new Event('DOMContentLoaded')); + } + + // Wait for the customer list to appear and contain "Fred" using vi.waitFor + await vi.waitFor(() => { + const customersList = document.getElementById('customers-list'); + expect(customersList).not.toBeNull(); + + const listItems = customersList.querySelectorAll('li'); + const customerNames = Array.from(listItems).map((li) => li.textContent); + expect(customerNames).toContain('Fred'); + }); + }); +}); diff --git a/demos/example-vite/e2e/test-setup.js b/demos/example-vite/e2e/test-setup.js new file mode 100644 index 000000000..24d01c504 --- /dev/null +++ b/demos/example-vite/e2e/test-setup.js @@ -0,0 +1,12 @@ +/** + * Test setup: Creates the DOM structure needed for tests + * This mimics the structure in index.html + */ +export function setupTestDOM() { + // Set up the HTML structure to match index.html + document.body.innerHTML = ` +