Skip to content

Conversation

@stevensJourney
Copy link
Collaborator

@stevensJourney stevensJourney commented Feb 22, 2024

This PR adds automated tests for the Web SDK using Vitest and WebdriverIO.

Tests are performed in a browser environment due to the requirements for SharedWorker Navigator locks and WASM loading.

This PR uses an interesting TypeScript and Vite config to allow resolving web worker URIs to be compatible with Webpack and Vite. In the web SDK package: Vite will only resolve web worker URIs correctly if the file path ends with .ts while the URI should use .js in published packages (not using the source files directly).

The method used here is to use the @journeyapps/powersync-sdk-web package path alias as an import source for the **/*.test.ts files. This alias is then resolved in the Vite bundling step to the Javascript dist version of the src.

@stevensJourney stevensJourney marked this pull request as ready for review February 27, 2024 11:37
@stevensJourney stevensJourney merged commit 749dc80 into main Feb 27, 2024
@stevensJourney stevensJourney deleted the web-tests branch February 27, 2024 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants