diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index e4bcec6..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,653 +0,0 @@ -# https://circleci.com/docs/2.0/configuration-reference/ -version: 2.1 -orbs: - # https://github.com/cypress-io/circleci-orb - cypress: cypress-io/cypress@2.2.0 # used to run e2e tests - node: circleci/node@1.1.6 # used to publish new NPM version - win: circleci/windows@2 # run a test job on Windows - -jobs: - unit: - description: Checks the code formatting - executor: - name: node/default - tag: '12' - environment: - # we don't need Cypress to check code style - CYPRESS_INSTALL_BINARY: '0' - steps: - - checkout - - node/with-cache: - steps: - - run: - name: Install dependencies ๐Ÿ“ฆ - # installs NPM dependencies but skips Cypress - command: CYPRESS_INSTALL_BINARY=0 npm ci - - run: - name: Code style check ๐Ÿงน - command: npm run format:check - - run: - name: Types lint ๐Ÿงน - command: npm run types - -workflows: - build: - jobs: - - unit - - - cypress/install: - post-steps: - - run: npm run check:markdown - - - cypress/run: - name: component coverage - requires: - - cypress/install - # grab the workspace created by cypress/install job - attach-workspace: true - working_directory: examples/component - # the example has a few dependencies - # plus we need to play a trick to link the code coverage plugin - # outside the folder - build: | - pwd && \ - ls -la && \ - node -v && \ - npm install && \ - ls -la node_modules/code-coverage - command: '../../node_modules/.bin/cypress run --component' - # there are no jobs to follow this one - # so no need to save the workspace files (saves time) - no-workspace: true - post-steps: - # store the created coverage report folder - # you can click on it in the CircleCI UI - # to see live static HTML site - - store_artifacts: - path: examples/component/coverage - - run: - command: npm run coverage:report - working_directory: examples/component - - run: - name: Check code coverage ๐Ÿ“ˆ - command: npm run check - working_directory: examples/component - - - cypress/run: - name: frontend coverage - requires: - - cypress/install - # grab the workspace created by cypress/install job - attach-workspace: true - # we need to start the web application - start: npm start - # there are no jobs to follow this one - # so no need to save the workspace files (saves time) - no-workspace: true - post-steps: - # store the created coverage report folder - # you can click on it in the CircleCI UI - # to see live static HTML site - - store_artifacts: - path: coverage - # print code coverage summary to the terminal - # and make sure there the coverage is above certain limit - - run: npx nyc report --check-coverage true --lines 80 - # make sure second page (about.html) has its JavaScript counted and covered - - run: npx nyc report --check-coverage true --lines 100 --include cypress/about.js - # make sure unit tests are covered - - run: npx nyc report --check-coverage true --lines 100 --include cypress/unit.js - - - cypress/run: - name: backend coverage - requires: - - cypress/install - # grab the workspace created by cypress/install job - attach-workspace: true - working_directory: examples/backend - start: npm start - wait-on: 'http://localhost:3003' - command: '../../node_modules/.bin/cypress run' - - # there are no jobs to follow this one - # so no need to save the workspace files (saves time) - no-workspace: true - post-steps: - # store the created coverage report folder - # you can click on it in the CircleCI UI - # to see live static HTML site - - store_artifacts: - path: examples/backend/coverage - - run: - command: npm run coverage:report - working_directory: examples/backend - - run: - name: Check code coverage ๐Ÿ“ˆ - command: npm run check - working_directory: examples/backend - - - cypress/run: - name: merge coverage - executor: cypress/browsers-chrome99-ff97 - requires: - - cypress/install - # grab the workspace created by cypress/install job - attach-workspace: true - working_directory: examples/merge-coverage - command: 'npm run cy:run1 && npm run report && npm run cy:run2 && npm run report' - - # there are no jobs to follow this one - # so no need to save the workspace files (saves time) - no-workspace: true - post-steps: - - run: - command: npm run merge - working_directory: examples/merge-coverage - # store the created coverage report folder - # you can click on it in the CircleCI UI - # to see live static HTML site - - store_artifacts: - path: examples/merge-coverage/coverage - - run: - command: npm run report - working_directory: examples/merge-coverage - - run: - name: Check code coverage ๐Ÿ“ˆ - command: npm run check - working_directory: examples/merge-coverage - - - cypress/run: - name: fullstack coverage - requires: - - cypress/install - # grab the workspace created by cypress/install job - attach-workspace: true - working_directory: examples/fullstack - start: npm start - wait-on: 'http://localhost:3003' - command: '../../node_modules/.bin/cypress run' - - # there are no jobs to follow this one - # so no need to save the workspace files (saves time) - no-workspace: true - post-steps: - # store the created coverage report folder - # you can click on it in the CircleCI UI - # to see live static HTML site - - store_artifacts: - path: examples/backend/coverage - - run: - command: npm run report - working_directory: examples/fullstack - - run: - name: Check code coverage ๐Ÿ“ˆ - command: npm run check - working_directory: examples/fullstack - - - cypress/run: - attach-workspace: true - name: example-before-each-visit - requires: - - cypress/install - # there are no jobs to follow this one - # so no need to save the workspace files (saves time) - no-workspace: true - command: npx cypress run --project examples/before-each-visit - # store screenshots and videos - store_artifacts: true - post-steps: - - run: cat examples/before-each-visit/.nyc_output/out.json - # store the created coverage report folder - # you can click on it in the CircleCI UI - # to see live static HTML site - - store_artifacts: - path: examples/before-each-visit/coverage - # make sure the examples captures 100% of code - - run: - command: npx nyc report --check-coverage true --lines 100 - working_directory: examples/before-each-visit - - run: - name: Check code coverage ๐Ÿ“ˆ - command: | - ../../node_modules/.bin/check-coverage main.js - ../../node_modules/.bin/only-covered main.js - working_directory: examples/before-each-visit - - - cypress/run: - attach-workspace: true - name: example-before-all-visit - requires: - - cypress/install - # there are no jobs to follow this one - # so no need to save the workspace files (saves time) - no-workspace: true - command: npx cypress run --project examples/before-all-visit - # store screenshots and videos - store_artifacts: true - post-steps: - - run: cat examples/before-all-visit/.nyc_output/out.json - # store the created coverage report folder - # you can click on it in the CircleCI UI - # to see live static HTML site - - store_artifacts: - path: examples/before-all-visit/coverage - # make sure the examples captures 100% of code - - run: - command: npx nyc report --check-coverage true --lines 100 - working_directory: examples/before-all-visit - - run: - name: Check code coverage ๐Ÿ“ˆ - command: | - ../../node_modules/.bin/check-coverage main.js - ../../node_modules/.bin/only-covered main.js - working_directory: examples/before-all-visit - - # - cypress/run: - # attach-workspace: true - # name: example-docker-paths - # requires: - # - cypress/install - # # there are no jobs to follow this one - # # so no need to save the workspace files (saves time) - # no-workspace: true - # working_directory: examples/docker-paths - # command: '../../node_modules/.bin/cypress run' - # post-steps: - # # store the created coverage report folder - # # you can click on it in the CircleCI UI - # # to see live static HTML site - # - store_artifacts: - # path: examples/docker-paths/coverage - # - run: - # name: Check code coverage ๐Ÿ“ˆ - # command: | - # ../../node_modules/.bin/check-coverage main.js - # ../../node_modules/.bin/check-coverage second.js - # ../../node_modules/.bin/only-covered main.js second.js - # working_directory: examples/docker-paths - - - cypress/run: - attach-workspace: true - name: example-ts-example - requires: - - cypress/install - # there are no jobs to follow this one - # so no need to save the workspace files (saves time) - no-workspace: true - working_directory: examples/ts-example - start: npm start - wait-on: 'http://localhost:1234' - command: '../../node_modules/.bin/cypress run' - post-steps: - # store the created coverage report folder - # you can click on it in the CircleCI UI - # to see live static HTML site - - store_artifacts: - path: examples/ts-example/coverage - - run: - command: npm run coverage:check - working_directory: examples/ts-example - - run: - name: Check code coverage ๐Ÿ“ˆ - command: npm run check - working_directory: examples/ts-example - - - cypress/run: - attach-workspace: true - name: example-multiple-files - requires: - - cypress/install - # there are no jobs to follow this one - # so no need to save the workspace files (saves time) - no-workspace: true - working_directory: examples/multiple-files - start: npm start - wait-on: 'http://localhost:1234' - command: '../../node_modules/.bin/cypress run' - post-steps: - # store the created coverage report folder - # you can click on it in the CircleCI UI - # to see live static HTML site - - store_artifacts: - path: examples/multiple-files/coverage - - run: - name: Check code coverage ๐Ÿ“ˆ - command: npm run check - working_directory: examples/multiple-files - - - cypress/run: - attach-workspace: true - name: example-no-files - requires: - - cypress/install - # there are no jobs to follow this one - # so no need to save the workspace files (saves time) - no-workspace: true - working_directory: examples/no-files - start: npm start - wait-on: 'http://localhost:1234' - command: '../../node_modules/.bin/cypress run' - - # - cypress/run: - # attach-workspace: true - # name: example-use-webpack - # requires: - # - cypress/install - # # there are no jobs to follow this one - # # so no need to save the workspace files (saves time) - # no-workspace: true - # working_directory: examples/use-webpack - # build: npm run build - # start: npm start - # wait-on: 'http://localhost:5000' - # command: '../../node_modules/.bin/cypress run' - # # wrong path when using working_directory - # # https://github.com/cypress-io/circleci-orb/issues/265 - # # store screenshots and videos - # # store_artifacts: true - # post-steps: - # - store_artifacts: - # path: examples/use-webpack/cypress/videos - # - store_artifacts: - # path: examples/use-webpack/cypress/screenshots - # # store the created coverage report folder - # # you can click on it in the CircleCI UI - # # to see live static HTML site - # - store_artifacts: - # path: examples/use-webpack/coverage - # - run: - # name: Check code coverage ๐Ÿ“ˆ - # command: | - # ../../node_modules/.bin/check-coverage src/index.js - # ../../node_modules/.bin/check-coverage src/calc.js - # ../../node_modules/.bin/only-covered src/index.js src/calc.js - # working_directory: examples/use-webpack - - - cypress/run: - attach-workspace: true - name: example-same-folder - requires: - - cypress/install - # there are no jobs to follow this one - # so no need to save the workspace files (saves time) - no-workspace: true - command: npx cypress run --project examples/same-folder - # store screenshots and videos - store_artifacts: true - post-steps: - - run: cat examples/same-folder/.nyc_output/out.json - # store the created coverage report folder - # you can click on it in the CircleCI UI - # to see live static HTML site - - store_artifacts: - path: examples/same-folder/coverage - # make sure the examples captures 100% of code - - run: - command: npx nyc report --check-coverage true --lines 100 - working_directory: examples/same-folder - - run: - command: npx nyc report --check-coverage true --lines 100 --include unit-utils.js - working_directory: examples/same-folder - - run: - name: Check code coverage ๐Ÿ“ˆ - command: npm run check - working_directory: examples/same-folder - - - cypress/run: - attach-workspace: true - name: example-support-files - requires: - - cypress/install - # there are no jobs to follow this one - # so no need to save the workspace files (saves time) - no-workspace: true - start: npm start --prefix examples/support-files - wait-on: 'http://localhost:1234' - command: npx cypress run --project examples/support-files - # store screenshots and videos - store_artifacts: true - post-steps: - - run: cat examples/support-files/.nyc_output/out.json - # store the created coverage report folder - # you can click on it in the CircleCI UI - # to see live static HTML site - - store_artifacts: - path: examples/support-files/coverage - # make sure the examples captures 100% of code - - run: - command: npx nyc report --check-coverage true --lines 100 - working_directory: examples/support-files - - run: - name: Check code coverage ๐Ÿ“ˆ - command: npm run check - working_directory: examples/support-files - - - cypress/run: - attach-workspace: true - name: example-all-files - requires: - - cypress/install - # there are no jobs to follow this one - # so no need to save the workspace files (saves time) - no-workspace: true - start: npm start --prefix examples/all-files - wait-on: 'http://localhost:1234' - command: npx cypress run --project examples/all-files - # store screenshots and videos - store_artifacts: true - post-steps: - - run: cat examples/all-files/.nyc_output/out.json - - run: cat examples/all-files/coverage/coverage-final.json - # store the created coverage report folder - # you can click on it in the CircleCI UI - # to see live static HTML site - - store_artifacts: - path: examples/all-files/coverage - # make sure the examples captures 100% of code - - run: - command: npx nyc report --check-coverage true --lines 100 - working_directory: examples/all-files - - run: - name: Check code coverage ๐Ÿ“ˆ - # we will check the final coverage report - # to make sure it only has files we are interested in - # because there are files covered at 0 in the report - command: | - ../../node_modules/.bin/check-coverage main.js - ../../node_modules/.bin/check-coverage second.js - ../../node_modules/.bin/check-coverage not-covered.js - ../../node_modules/.bin/only-covered --from coverage/coverage-final.json main.js second.js not-covered.js - working_directory: examples/all-files - - - cypress/run: - attach-workspace: true - name: example-placeholders - requires: - - cypress/install - # there are no jobs to follow this one - # so no need to save the workspace files (saves time) - no-workspace: true - command: npx cypress run --project examples/placeholders - # store screenshots and videos - store_artifacts: true - post-steps: - - run: cat examples/placeholders/.nyc_output/out.json - - run: cat examples/placeholders/coverage/coverage-final.json - # store the created coverage report folder - # you can click on it in the CircleCI UI - # to see live static HTML site - - store_artifacts: - path: examples/placeholders/coverage - # make sure the examples captures 100% of code - - run: - command: npx nyc report --check-coverage true --lines 100 - working_directory: examples/placeholders - - run: - name: Check code coverage ๐Ÿ“ˆ - # we will check the final coverage report - # to make sure it only has files we are interested in - # because there are files covered at 0 in the report - command: npm run check - working_directory: examples/placeholders - - - cypress/run: - attach-workspace: true - name: example-exclude-files - requires: - - cypress/install - # there are no jobs to follow this one - # so no need to save the workspace files (saves time) - no-workspace: true - start: npm start --prefix examples/exclude-files - wait-on: 'http://localhost:1234' - command: npx cypress run --project examples/exclude-files - # store screenshots and videos - store_artifacts: true - post-steps: - - run: cat examples/exclude-files/.nyc_output/out.json - - run: cat examples/exclude-files/coverage/coverage-final.json - # store the created coverage report folder - # you can click on it in the CircleCI UI - # to see live static HTML site - - store_artifacts: - path: examples/exclude-files/coverage - # make sure the examples captures 100% of code - - run: - command: npx nyc report --check-coverage true --lines 100 - working_directory: examples/exclude-files - - run: - name: Check code coverage ๐Ÿ“ˆ - # we will check the final coverage report - # to make sure it only has files we are interested in - command: npm run check - working_directory: examples/exclude-files - - - cypress/run: - attach-workspace: true - name: example-use-plugins-and-support - requires: - - cypress/install - # there are no jobs to follow this one - # so no need to save the workspace files (saves time) - no-workspace: true - command: npx cypress run --project examples/use-plugins-and-support - # store screenshots and videos - store_artifacts: true - post-steps: - - run: cat examples/use-plugins-and-support/.nyc_output/out.json - # store the created coverage report folder - # you can click on it in the CircleCI UI - # to see live static HTML site - - store_artifacts: - path: examples/use-plugins-and-support/coverage - # make sure the examples captures 100% of code - - run: - command: npx nyc report --check-coverage true --lines 100 - working_directory: examples/use-plugins-and-support - - run: - name: Check code coverage ๐Ÿ“ˆ - command: npm run check - working_directory: examples/use-plugins-and-support - - - cypress/run: - attach-workspace: true - name: example-one-spec - requires: - - cypress/install - # there are no jobs to follow this one - # so no need to save the workspace files (saves time) - no-workspace: true - command: npx cypress run --project examples/one-spec - # store screenshots and videos - store_artifacts: true - post-steps: - - run: cat examples/one-spec/.nyc_output/out.json - - run: cat examples/one-spec/coverage/coverage-summary.json - # store the created coverage report folder - # you can click on it in the CircleCI UI - # to see live static HTML site - - store_artifacts: - path: examples/one-spec/coverage - # make sure the examples captures 100% of code - - run: - command: npx nyc report --check-coverage true --lines 100 - working_directory: examples/one-spec - - run: - name: Check code coverage ๐Ÿ“ˆ - command: npm run check - working_directory: examples/one-spec - - - cypress/run: - attach-workspace: true - name: example-unit-tests-js - requires: - - cypress/install - # there are no jobs to follow this one - # so no need to save the workspace files (saves time) - no-workspace: true - command: npx cypress run --project examples/unit-tests-js - # store screenshots and videos - store_artifacts: true - post-steps: - - run: cat examples/unit-tests-js/.nyc_output/out.json - - run: cat examples/unit-tests-js/coverage/coverage-summary.json - # store the created coverage report folder - # you can click on it in the CircleCI UI - # to see live static HTML site - - store_artifacts: - path: examples/unit-tests-js/coverage - # make sure the examples captures 100% of code - - run: - command: npx nyc report --check-coverage true --lines 100 - working_directory: examples/unit-tests-js - - run: - name: Check code coverage ๐Ÿ“ˆ - command: npm run check - working_directory: examples/unit-tests-js - - - cypress/run: - attach-workspace: true - name: example-unit-tests-ts - requires: - - cypress/install - # there are no jobs to follow this one - # so no need to save the workspace files (saves time) - no-workspace: true - command: npx cypress run --project examples/unit-tests-ts - # TODO: fix the TS code coverage - - - cypress/run: - name: Windows test - executor: - # executor comes from the "windows" orb - name: win/default - shell: bash.exe - no-workspace: true - start: npm run start:windows --prefix examples/all-files - wait-on: 'http://localhost:1234' - command: npx cypress run --project examples/all-files - # store screenshots and videos - store_artifacts: true - post-steps: - - run: cat examples/all-files/.nyc_output/out.json - - run: cat examples/all-files/coverage/coverage-final.json - # store the created coverage report folder - # you can click on it in the CircleCI UI - # to see live static HTML site - - store_artifacts: - path: examples/all-files/coverage - # make sure the examples captures 100% of code - - run: - command: npx nyc report --check-coverage true --lines 100 - working_directory: examples/all-files - - run: - name: Check code coverage ๐Ÿ“ˆ - # we will check the final coverage report - # to make sure it only has files we are interested in - # because there are files covered at 0 in the report - command: | - ../../node_modules/.bin/check-coverage main.js - ../../node_modules/.bin/check-coverage second.js - ../../node_modules/.bin/check-coverage not-covered.js - ../../node_modules/.bin/only-covered --from coverage/coverage-final.json main.js second.js not-covered.js - working_directory: examples/all-files diff --git a/README.md b/README.md index f8084c8..9cce476 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# @bahmutov/cypress-code-coverage ![cypress version](https://img.shields.io/badge/cypress-12.8.1-brightgreen) [![CircleCI](https://circleci.com/gh/bahmutov/cypress-code-coverage/tree/main.svg?style=svg)](https://circleci.com/gh/bahmutov/cypress-code-coverage/tree/main) [![ci](https://github.com/bahmutov/cypress-code-coverage/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/bahmutov/cypress-code-coverage/actions/workflows/ci.yml) +# @bahmutov/cypress-code-coverage ![cypress version](https://img.shields.io/badge/cypress-12.8.1-brightgreen) [![ci](https://github.com/bahmutov/cypress-code-coverage/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/bahmutov/cypress-code-coverage/actions/workflows/ci.yml) > My version of [Cypress code coverage plugin](https://github.com/cypress-io/code-coverage)