This application includes three test suites:
- Unit Tests: for testing individual components (except
+page
components) and library functions / classes in isolation. - Integration Tests: for testing
+page
components (which require a full browser context and a node server); uses a mock API server to provide deterministic test data. - End-to-end Tests: for smoke-tests to validate the full application stack against live production data.
See below to run each suite separately, or run all test suites sequentially with:
npm run test # use --skip-build flag to save time if you have already run `npm build`
Run once:
npm run test:unit
Watch for file changes:
npm run test:unit:watch
Pass additional options to vitest
after --
– e.g.,
npm run test:unit -- Blog
to only run tests that match "Blog"npm run test:unit -- --help
to see additionalvitest
options
See Unit test frameworks below for additional info.
npm run test:integration
- use
--skip-build
flag if you already have a current build (saves significant time) - pass additional options to
playwright
after--
– e.g.,npm run test:integration -- trading-view
to only run tests that match "trading-view"npm run test:integration -- --help
to see additionalplaywright
options
- runs tests in
tests/integration
folder (headlessly) and reports results - automatically runs
npm build
and starts a node preview server withnpm preview
- uses mock API data found in
tests/fixtures
See Integration and e2e test frameworks below for additional info.
npm run test:e2e
- see
test:integration
options above (supports the same options)
- runs tests in
tests/e2e
folder (headlessly) and reports results - automatically runs
npm build
and starts a node preview server withnpm preview
- uses real production backend API
See Integration and e2e test frameworks below for additional info.
- Vitest – overall testing framework; see guide, API and config docs for additional info.
- Testing Library – provides interface for inspecting and interacting with the DOM, using the Svelte Testing Library adapter.
- jest-dom – extends Jest with DOM-specific matchers.
- Playwright – overall testing framework; see docs and API reference for additional info.
- vite-plugin-simple-json-server
– used when running
integration
tests to serving mock API data found intests/fixtures
.