Skip to content

Testing

Commands

bash
# Run all tests
npm test

# Watch mode
npm run test:watch

# With coverage report
npm run test:coverage

# Unit tests only
npm run test:unit

# Integration tests
npm run test:integration

# E2E tests (requires build)
npm run test:e2e

Coverage reports are generated in coverage/:

  • coverage/index.html — browsable HTML
  • coverage/lcov.info — LCOV for IDE integration

Test Suite

The suite is run by Vitest 4 (123 test files, 1603 tests, all passing). Coverage uses the v8 provider.

AreaWhat's Covered
SharedError normalization, all shared constants, codec/container mapping, validation helpers, type contracts, logger, IPC channel registry, estimation
MainCLI entry, window lifecycle, encoder probing, queue semantics, process utilities, image/video preview generation, media binary resolution, power actions, preview cache
Main CLICLI subcommand parsing, option handling, conversion/compress subcommands, utility functions, integration tests
Main IPCPer-channel IPC handlers, event broadcasting, error wrapping, system handlers
Main transcodersAll three cores, hardware-acceleration flag building, ffprobe mapping, factory dispatch, transcoder interface contract
Player / Queue / TimelineRawvideo frame decoding, audio pipe, buffering, queue transfer, waveform extraction, thumbnail montage generation
PreloadFull electronAPI bridge surface, every IPC method
Renderer componentsRendering, interactions, error states, accessibility for all shared UI components
Renderer hooksConversion orchestration, error handling, form validation, media task lifecycle, RTL direction, keyboard shortcuts
Renderer pagesFull page flows: form state, validation, IPC invocation, settings persistence, about/update
Renderer storesZustand store state transitions and persistence
Renderer utilsFormatting helpers, preview cache, easter egg dates, batch options, queue reorder logic
Renderer app / miscApp shell routing, color palette, session cleanup, keyboard shortcuts
IntegrationFull pipeline: Error -> formatError -> store -> display -> clear

Test Setup

The test environment (src/test-setup.ts) provides:

  • Mocked useTranslation from react-i18next with English key mapping and interpolation
  • Mocked electronAPI on globalThis covering all IPC methods
  • Registers @testing-library/jest-dom/vitest matchers

E2E Tests

Playwright-based end-to-end tests live in e2e/ (node environment, 60s timeouts) and are gated behind the E2E env var or CI:

FileWhat's Covered
e2e/cli.spec.tsCLI mode: --help/-h, subcommands, legacy flat syntax, global flags
e2e/specs/shell.spec.tsApp shell: window title, electronAPI presence, all nav routes, drawer navigation, window controls
e2e/specs/convert.spec.tsConvert page: file selection, output auto-suggestion, codec/bitrate/scale/pixel/transcoder options, conversion with progress
e2e/specs/batch.spec.tsBatch queue: empty state, add files, queue events, live progress, cancel all, status filter, drag reorder
e2e/specs/audio-extract.spec.tsAudio extraction: video selection with audio streams, codec/bitrate changes, extraction with success toast
e2e/specs/image-compress.spec.tsImage compression: dropzone, image selection, format/quality/scale changes, compression with success toast
e2e/specs/media-info.spec.tsMedia info: video analysis (streams, codec details), image analysis (EXIF data)
e2e/specs/settings.spec.tsSettings: theme cards, theme switching, always-on-top, hwaccel mode persistence
e2e/specs/logs.spec.tsLogs: emit entries, level filtering, clear all, download with toast
e2e/specs/video-cut.spec.tsVideo cut: timeline + waveform + thumbnails, duration/end-time toggle, cut with progress, cancel
e2e/specs/real-convert.spec.tsTier B (real): actual FFmpeg conversion without mocks (gated behind E2E_REAL=1)

Released under the MIT License.