Cypress: Difference between revisions

From NixOS Wiki
imported>Pbek
Mention steam-run and cypress packages
 
Copyedit, add lead
Line 1: Line 1:
You cannot use cypress directly with npm. You can either run it with <code>steam-run</code> or install the <code>cypress</code> package.
[https://www.cypress.io/ Cypress] is a frontend testing framework for web applications.


For example, put this <code>shell.nix</code> in the directory with your cypress tests:
== NixOS ==
 
You cannot use Cypress directly with [[npm]] while running on [[NixOS]].<ref>https://github.com/cypress-io/cypress/issues/3530</ref> You can either run it with [[steam-run|<code>steam-run</code>]] or use the <code>cypress</code> package.
 
For example, put this <code>shell.nix</code> in the directory with your Cypress tests:


<syntaxHighlight lang=nix>
<syntaxHighlight lang=nix>
{ pkgs ? import <nixpkgs> {} }:
{ pkgs ? import <nixpkgs> {} }:
   pkgs.mkShell {
   pkgs.mkShell {
     nativeBuildInputs = with pkgs; [
     packages = with pkgs; [
       nodejs
       nodejs
       cypress
       cypress
Line 13: Line 17:
</syntaxHighlight>
</syntaxHighlight>


You can then just run <code>nix-shell --run "Cypress"</code> to open the Cypress UI and then select your project.
You can then run <code>nix-shell --run "Cypress"</code> to open the Cypress UI and select your project.
 
== References ==
 
<references />

Revision as of 05:41, 21 June 2024

Cypress is a frontend testing framework for web applications.

NixOS

You cannot use Cypress directly with npm while running on NixOS.[1] You can either run it with steam-run or use the cypress package.

For example, put this shell.nix in the directory with your Cypress tests:

{ pkgs ? import <nixpkgs> {} }:
  pkgs.mkShell {
    packages = with pkgs; [
      nodejs
      cypress
    ];
}

You can then run nix-shell --run "Cypress" to open the Cypress UI and select your project.

References