Skip to content

Latest commit

 

History

History
114 lines (72 loc) · 2.12 KB

File metadata and controls

114 lines (72 loc) · 2.12 KB

Testing & Validation

This guide covers running tests and validating code quality in Small Dev Talk.

Test Types

Small Dev Talk uses four types of automated testing:

  1. Unit Tests (Jest) — Test individual functions and modules
  2. E2E Tests (Cypress) — Test complete user workflows
  3. Linting — Verify code quality and style
  4. Markdown Validation — Ensure documentation quality

Unit Testing with Jest

Jest tests are in src/scripts/index.test.js.

Run all tests:

npm run test

Run with verbose output:

npm run test:verbose

Run specific test file:

npm run test -- src/scripts/index.test.js

End-to-End Testing with Cypress

Cypress tests are in cypress/e2e/.

Open Cypress Test Runner:

npm run cypress

Run E2E tests headless (CI mode):

npm run e2e:headless

This starts the dev server, waits for it, then runs tests.

Code Quality

ESLint (JavaScript Linting)

Check and auto-fix code quality issues:

npm run eslint              # Auto-fix
npm run eslint:check        # Check only

Configuration: eslint.config.js

Prettier (Code Formatting)

Format all code consistently:

npm run prettier            # Format all files
npm run prettier:check      # Check only

Configuration: .prettierrc

Markdownlint (Markdown Validation)

Lint all markdown files:

npm run lint:markdown

Configuration: .markdownlint.json

Full Validation Pipeline

Run all quality checks together:

npm run validate

This runs:

  1. Prettier formatting
  2. ESLint code quality
  3. Jest unit tests
  4. Cypress E2E tests
  5. Markdownlint validation

Continuous Integration

GitHub Actions workflows in this repository:

  • Run Prettier, ESLint, Jest, and Cypress on pushes and pull requests
  • Run Markdownlint on markdown-only changes
  • Run CodeQL analysis on pushes and pull requests

Related Documentation