Principle:Nightwatchjs Nightwatch Component Test Execution
| Knowledge Sources | |
|---|---|
| Domains | Testing, Component_Testing, CLI |
| Last Updated | 2026-02-12 00:00 GMT |
Overview
A specialized test execution mode that starts a development server, renders components in isolation, and runs component-level tests via a CLI flag.
Description
Component Test Execution extends the standard test execution pipeline with an additional component-specific phase: starting a development server (Vite or Webpack) that bundles and serves individual components. The --component CLI flag activates this mode, switching the test runner from navigating to URLs to rendering components in the browser via the dev server.
Usage
Use this execution mode when running component tests. Always include the --component flag to differentiate from E2E test execution.
Theoretical Basis
The component test execution pipeline extends the standard pipeline:
- Start dev server (Vite/Webpack) to bundle components
- Parse CLI arguments with --component flag
- Initialize browser session
- For each test: Render component via plugin → Execute test → Collect results
- Stop dev server and report results