Principle:Nightwatchjs Nightwatch Component Environment Configuration
| Knowledge Sources | |
|---|---|
| Domains | Testing, Component_Testing, Configuration |
| Last Updated | 2026-02-12 00:00 GMT |
Overview
A configuration pattern that registers component testing plugins and configures the development server for isolated component rendering.
Description
Component Environment Configuration bridges the testing framework with a development server (Vite or Webpack) that compiles and serves individual components to the browser. The configuration specifies which plugins to load and how the dev server should behave (auto-start, port, etc.). This differs from E2E configuration because components need to be bundled and served rather than accessed at a URL.
Usage
Configure the component testing environment after installing the plugin and before writing component tests. The configuration goes in nightwatch.conf.js.
Theoretical Basis
The configuration connects three systems:
- Test framework (Nightwatch) orchestrates test execution
- Plugin (e.g., @nightwatch/react) provides render/mount
- Dev server (Vite/Webpack) bundles and serves components