cypress-dark is a utility package for Cypress that provides customizable dark themes for the Cypress Test Runner UI. It is currently stable at version `1.8.3`, with the last significant update occurring in late 2021. The package's release cadence appears to be infrequent, primarily addressing bug fixes or compatibility issues with Cypress rather than consistently introducing new features. Its key differentiators include offering several pre-defined themes, such as 'dark' and 'halloween', and a unique feature to programmatically force the application under test into dark mode by stubbing `window.matchMedia`. This functionality is highly useful for thoroughly testing applications that implement `prefers-color-scheme` logic. It integrates directly into the `cypress/support/index.js` file for straightforward activation within your Cypress project setup.
npm install cypress-darkVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to install `cypress-dark`, apply a theme to the Cypress Test Runner via `cypress/support/index.js`, and optionally configure `cypress.json` to force the application under test into dark mode for testing responsive themes.
If encountering issues with newer Cypress versions, inspect the Cypress runner's DOM for changes and consider applying custom CSS overrides in your `cypress/support/index.js` or forking the project. Compatibility is not guaranteed for recent Cypress releases.
Ensure your development environment uses Node.js version 6 or higher. It is recommended to use an actively maintained LTS Node.js version.
For long-term projects or critical applications, consider evaluating the stability with your specific Cypress version or being prepared to maintain custom styling solutions if `cypress-dark` ceases to meet requirements.
Ensure the package is installed as a dev dependency (`npm install --save-dev cypress-dark`) and that the `require()` statement in your support file correctly references `'cypress-dark'` or `'cypress-dark/src/halloween'`.
Move all `require('cypress-dark')` statements to `cypress/support/index.js` or a file that is imported by it. This file is executed in Node.js before your tests run in the browser.Verify that `require('cypress-dark')` is at the very top of your `cypress/support/index.js` file to ensure it's loaded first. Check your browser's developer tools for any conflicting CSS rules. If using a very recent Cypress version, the package may require manual CSS adjustments or overrides to function fully.