diff options
Diffstat (limited to 'nixpkgs/pkgs/development/web/cypress/cypress-example-kitchensink/default.nix')
-rw-r--r-- | nixpkgs/pkgs/development/web/cypress/cypress-example-kitchensink/default.nix | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/web/cypress/cypress-example-kitchensink/default.nix b/nixpkgs/pkgs/development/web/cypress/cypress-example-kitchensink/default.nix new file mode 100644 index 000000000000..86fec8950002 --- /dev/null +++ b/nixpkgs/pkgs/development/web/cypress/cypress-example-kitchensink/default.nix @@ -0,0 +1,59 @@ +{ callPackage +, cypress +, nodejs-12_x +, # FIXME: duplicated from ./regen-nix. node2nix should expose this + nodePackages +, xorg +, pkgs +, stdenv +, +}: + +let + fromNode2nix = import ./cypress-example-kitchensink.nix { + inherit pkgs; + }; + + nodeDependencies = fromNode2nix.shell.nodeDependencies.overrideAttrs (o: { + CYPRESS_INSTALL_BINARY = "0"; + PUPPETEER_SKIP_DOWNLOAD = "1"; + }); + + fontConfigEtc = ( + pkgs.nixos { config.fonts.fontconfig.enable = true; } + ).config.environment.etc.fonts.source; + +in +stdenv.mkDerivation { + name = "cypress-example-kitchensink"; + src = callPackage ./src.nix { }; + passthru.fc = fontConfigEtc; + nativeBuildInputs = [ + cypress + nodejs-12_x + xorg.xorgserver + nodePackages.jsonplaceholder + ]; + FONTCONFIG_PATH = fontConfigEtc; + postPatch = '' + # Use our own offline backend. 15011 means js0n ;) + sed -e 's^https://jsonplaceholder.cypress.io^http://localhost:15011^g' -i $(find . -type f) + ''; + buildPhase = '' + ln -s ${nodeDependencies}/lib/node_modules ./node_modules + PATH="${nodeDependencies}/bin:$PATH" + runHook preBuild + PORT=15011 jsonplaceholder & + # assumption: jsonplaceholder start far quicker than cypress run + + export CYPRESS_RUN_BINARY=${cypress}/bin/Cypress + export HOME=$PWD/home + mkdir $HOME + npm run test + runHook postBuild + ''; + installPhase = '' + mkdir $out + cp -r cypress/videos $out/ + ''; +} |