Skip to content

Latest commit

 

History

History
100 lines (67 loc) · 3.31 KB

tests.md

File metadata and controls

100 lines (67 loc) · 3.31 KB

Tests

This application includes three test suites:

  1. Unit Tests: for testing individual components (except +page components) and library functions / classes in isolation.
  2. 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.
  3. 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`

Running Tests

Unit Tests

Run once:

npm run test:unit

Watch for file changes:

npm run test:unit:watch

Options:

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 additional vitest options

See Unit test frameworks below for additional info.

Integration tests

npm run test:integration

Options:

  • 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 additional playwright options

This command does the following:

  • runs tests in tests/integration folder (headlessly) and reports results
  • automatically runs npm build and starts a node preview server with npm preview
  • uses mock API data found in tests/fixtures

See Integration and e2e test frameworks below for additional info.

End-to-end tests

npm run test:e2e

Options:

  • see test:integration options above (supports the same options)

This command does the following:

  • runs tests in tests/e2e folder (headlessly) and reports results
  • automatically runs npm build and starts a node preview server with npm preview
  • uses real production backend API

See Integration and e2e test frameworks below for additional info.

Test Frameworks

Unit test frameworks

Integration and e2e test frameworks