{"repo":"bahmutov/next-and-cypress-example","free":true,"listed":false,"github":"https://github.com/bahmutov/next-and-cypress-example","clone":"git clone https://github.com/bahmutov/next-and-cypress-example.git","description":"Next.js example instrumented for code coverage from Cypress tests","language":"JavaScript","stars":138,"topics":["cypress-io","cypress-example","nextjs","nextjs-example","code-coverage","cypress-code-coverage-example"],"license":null,"category":"saas-starters-boilerplates","readme_excerpt":"next.js and Cypress example [![renovate-app badge][renovate-badge]][renovate-app] Next.js example instrumented for code coverage from Cypress tests Install and run This starts the application at localhost:3000 and opens Cypress test runner. Click on the spec file to run the end-to-end tests. Coverage The tests are instrumented following the instructions in Cypress code coverage guide. In particular, the front-end is instrumented using .babelrc file like When you run tests, the code coverage report is saved in coverage folder. There are reports in several formats, but open the HTML one for human-readable report. To fetch the server-side code coverage, the @cypress/code-coverage plugin needs an endpoint. This endpoint is implemented in pages/api/ coverage .js file following the Next.js API convention. This endpoint just returns the existing global coverage object or null Cypress plugin requests the right endpoint using the environment variable from cypress.json file On CI after the tests finish, we store the coverage reports. We also run a script to check if the coverage dropped below 100% See more - Cypress code coverage guide Small print Author: Gleb Bahmutov &lt;gleb.bahmutov@gmail.com&gt; &copy; 2019 @bahmutov glebbahmutov.com blog License: MIT - do anything with the code, but don't blame me if it does not work. Support: if you find any problems with this module, email / tweet / open issue on Github MIT License Copyright (c) 2019 Gleb Bahmutov &lt;gleb.bahmutov@gmail.com&gt","default_branch":null,"files":null,"tree":[],"storefront":"/r/bahmutov","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/bahmutov/next-and-cypress-example/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}