From 59c223c9a8369299a81af0036f842c10f172768e Mon Sep 17 00:00:00 2001 From: mairess Date: Tue, 23 Apr 2024 18:32:37 -0300 Subject: [PATCH 01/16] chore: add workflow --- .github/workflows/main.yml | 37 +++++++++++++++++++++++++++++++++++++ README.md | 6 +++--- 2 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..6d1eade --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,37 @@ +# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs + +name: Node.js CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [16.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm ci + - run: npm run build --if-present + - run: npm run test:coverage + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4.0.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + slug: mairess/project-store-manager diff --git a/README.md b/README.md index 41e9fc8..60ff418 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@
-| Statements | Branches | Functions | Lines | -| --------------------------- | ----------------------- | ------------------------- | -------------------- | -| ![Statements](https://img.shields.io/badge/Coverage-100%25-brightgreen.svg) | ![Branches](https://img.shields.io/badge/Coverage-100%25-brightgreen.svg) | ![Functions](https://img.shields.io/badge/Coverage-100%25-brightgreen.svg) | ![Lines](https://img.shields.io/badge/Coverage-100%25-brightgreen.svg) | + + +
From 083abfe784cc50f64177b11611deddb867b097a1 Mon Sep 17 00:00:00 2001 From: mairess Date: Tue, 23 Apr 2024 18:42:38 -0300 Subject: [PATCH 02/16] chore: add package.json to tests --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6d1eade..21e9629 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -26,6 +26,7 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: 'npm' + - run: ls -al - run: npm ci - run: npm run build --if-present - run: npm run test:coverage From d56fe75bbafdc85612b367e154720b42a1603970 Mon Sep 17 00:00:00 2001 From: mairess Date: Tue, 23 Apr 2024 18:43:05 -0300 Subject: [PATCH 03/16] chore: add package.json to tests --- __tests__/package.json | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 __tests__/package.json diff --git a/__tests__/package.json b/__tests__/package.json new file mode 100644 index 0000000..242a682 --- /dev/null +++ b/__tests__/package.json @@ -0,0 +1,30 @@ +{ + "name": "sd-0x-store-manager-tests", + "version": "1.0.0", + "description": "Projeto Store Manager - Testes", + "author": "Trybe", + "license": "ISC", + "engines": { + "node": ">=16.0.0", + "npm": ">=7.0.0" + }, + "scripts": { + "cy": "cypress run", + "cy:open": "cypress open --e2e --browser electron", + "lint": "eslint --no-error-on-unmatched-pattern .", + "test": "CY_CLI=true cypress run -r spec -s \"**/*$REQ*\"" + }, + "devDependencies": { + "@stryker-mutator/core": "6.4.2", + "@stryker-mutator/mocha-runner": "6.4.2", + "@testing-library/cypress": "9.0.0", + "cypress": "12.6.0", + "cypress-multi-reporters": "1.6.3", + "eslint-config-trybe-backend": "2.1.0", + "eslint-plugin-cypress": "^2.13.2", + "mochawesome": "7.1.3", + "mochawesome-merge": "4.3.0", + "mochawesome-report-generator": "6.2.0", + "mysql2": "2.3.0" + } + } \ No newline at end of file From 50f8ba730f93f840bf99823c25b01ade6ecc9631 Mon Sep 17 00:00:00 2001 From: mairess Date: Tue, 23 Apr 2024 18:49:12 -0300 Subject: [PATCH 04/16] chore: add mocha test script --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 21e9629..1c2fdce 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,7 +29,7 @@ jobs: - run: ls -al - run: npm ci - run: npm run build --if-present - - run: npm run test:coverage + - run: npm run test:mocha - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v4.0.1 From 4e184ceccd8a5b90b8caae5a6604919cb58f2b47 Mon Sep 17 00:00:00 2001 From: mairess Date: Tue, 23 Apr 2024 19:29:43 -0300 Subject: [PATCH 05/16] chore: change directory when runnig action --- .github/workflows/main.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1c2fdce..0146609 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -26,11 +26,11 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: 'npm' - - run: ls -al - - run: npm ci - - run: npm run build --if-present - - run: npm run test:mocha - + - name: Install dependencies and run tests + run: | + cd backend + npm ci + npm run test:mocha - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v4.0.1 with: From 26e59bbb15aec764e3a1c3490c768a1e3f82f6d5 Mon Sep 17 00:00:00 2001 From: mairess Date: Tue, 23 Apr 2024 19:31:10 -0300 Subject: [PATCH 06/16] chore: change test script --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0146609..eacd15b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -30,7 +30,7 @@ jobs: run: | cd backend npm ci - npm run test:mocha + npm run test:coverage - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v4.0.1 with: From 05efe208e60891bc9c207e604def82cd022661c5 Mon Sep 17 00:00:00 2001 From: mairess Date: Tue, 23 Apr 2024 19:42:18 -0300 Subject: [PATCH 07/16] chore: change test script --- backend/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/package.json b/backend/package.json index a595eef..9847d6a 100644 --- a/backend/package.json +++ b/backend/package.json @@ -11,7 +11,7 @@ "start": "node .", "dev": "nodemon --inspect=0.0.0.0:9229 .", "test:mocha": "mocha", - "test:coverage": "nyc mocha", + "test:coverage": "nyc --reporter=html --reporter=text npm run test:mocha", "test:mutation": "stryker run", "lint": "eslint --no-error-on-unmatched-pattern ." }, From 1b11bf29ec7834846b78e8522b949ca5a248230e Mon Sep 17 00:00:00 2001 From: mairess Date: Wed, 24 Apr 2024 16:34:01 -0300 Subject: [PATCH 08/16] chore(workflow): add path to coverage file --- .github/workflows/main.yml | 1 + backend/package.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index eacd15b..f27f7f7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -35,4 +35,5 @@ jobs: uses: codecov/codecov-action@v4.0.1 with: token: ${{ secrets.CODECOV_TOKEN }} + files: "backend/coverage/coverage-summary.json" slug: mairess/project-store-manager diff --git a/backend/package.json b/backend/package.json index 9847d6a..a595eef 100644 --- a/backend/package.json +++ b/backend/package.json @@ -11,7 +11,7 @@ "start": "node .", "dev": "nodemon --inspect=0.0.0.0:9229 .", "test:mocha": "mocha", - "test:coverage": "nyc --reporter=html --reporter=text npm run test:mocha", + "test:coverage": "nyc mocha", "test:mutation": "stryker run", "lint": "eslint --no-error-on-unmatched-pattern ." }, From b5e3957774971676b4e7e97749fc6a09ab6bebd5 Mon Sep 17 00:00:00 2001 From: mairess Date: Wed, 24 Apr 2024 16:49:08 -0300 Subject: [PATCH 09/16] chore: change coverage script --- backend/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/package.json b/backend/package.json index a595eef..2ac8950 100644 --- a/backend/package.json +++ b/backend/package.json @@ -11,7 +11,7 @@ "start": "node .", "dev": "nodemon --inspect=0.0.0.0:9229 .", "test:mocha": "mocha", - "test:coverage": "nyc mocha", + "test:coverage": "nyc --reporter=html --reporter=text mocha", "test:mutation": "stryker run", "lint": "eslint --no-error-on-unmatched-pattern ." }, From 7abb20a2d788be2a640616d386aae232e5db4aa1 Mon Sep 17 00:00:00 2001 From: mairess Date: Wed, 24 Apr 2024 16:56:41 -0300 Subject: [PATCH 10/16] rollback: coverage script --- backend/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/package.json b/backend/package.json index 2ac8950..a595eef 100644 --- a/backend/package.json +++ b/backend/package.json @@ -11,7 +11,7 @@ "start": "node .", "dev": "nodemon --inspect=0.0.0.0:9229 .", "test:mocha": "mocha", - "test:coverage": "nyc --reporter=html --reporter=text mocha", + "test:coverage": "nyc mocha", "test:mutation": "stryker run", "lint": "eslint --no-error-on-unmatched-pattern ." }, From a145cdd3387cfc19bd960d7d1c78c3506f02d7cb Mon Sep 17 00:00:00 2001 From: mairess Date: Wed, 24 Apr 2024 17:33:21 -0300 Subject: [PATCH 11/16] chore(workflow): change file path --- .github/workflows/main.yml | 2 +- backend/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f27f7f7..04d453a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -35,5 +35,5 @@ jobs: uses: codecov/codecov-action@v4.0.1 with: token: ${{ secrets.CODECOV_TOKEN }} - files: "backend/coverage/coverage-summary.json" + files: backend/coverage slug: mairess/project-store-manager diff --git a/backend/package.json b/backend/package.json index a595eef..2ac8950 100644 --- a/backend/package.json +++ b/backend/package.json @@ -11,7 +11,7 @@ "start": "node .", "dev": "nodemon --inspect=0.0.0.0:9229 .", "test:mocha": "mocha", - "test:coverage": "nyc mocha", + "test:coverage": "nyc --reporter=html --reporter=text mocha", "test:mutation": "stryker run", "lint": "eslint --no-error-on-unmatched-pattern ." }, From e3a31f6a440d8bbe0fd17fc1f121eea874eff163 Mon Sep 17 00:00:00 2001 From: mairess Date: Wed, 24 Apr 2024 17:35:07 -0300 Subject: [PATCH 12/16] chore(workflow): rollback file path --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 04d453a..6dd8701 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -35,5 +35,5 @@ jobs: uses: codecov/codecov-action@v4.0.1 with: token: ${{ secrets.CODECOV_TOKEN }} - files: backend/coverage + files: backend/coverage/coverage-summary.json slug: mairess/project-store-manager From a78965fa503ee83397adece020ad1a2bc80c5113 Mon Sep 17 00:00:00 2001 From: mairess Date: Wed, 24 Apr 2024 17:36:52 -0300 Subject: [PATCH 13/16] chore(workflow): file path add double quotes --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6dd8701..f27f7f7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -35,5 +35,5 @@ jobs: uses: codecov/codecov-action@v4.0.1 with: token: ${{ secrets.CODECOV_TOKEN }} - files: backend/coverage/coverage-summary.json + files: "backend/coverage/coverage-summary.json" slug: mairess/project-store-manager From 706c4e95e58d5d0f5f4796195724860b34a6be19 Mon Sep 17 00:00:00 2001 From: mairess Date: Wed, 24 Apr 2024 17:38:27 -0300 Subject: [PATCH 14/16] chore: change coverage script --- backend/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/package.json b/backend/package.json index 2ac8950..a595eef 100644 --- a/backend/package.json +++ b/backend/package.json @@ -11,7 +11,7 @@ "start": "node .", "dev": "nodemon --inspect=0.0.0.0:9229 .", "test:mocha": "mocha", - "test:coverage": "nyc --reporter=html --reporter=text mocha", + "test:coverage": "nyc mocha", "test:mutation": "stryker run", "lint": "eslint --no-error-on-unmatched-pattern ." }, From 08759d02d05f136f67d9fdcf5b0d181b20e3bb23 Mon Sep 17 00:00:00 2001 From: mairess Date: Wed, 24 Apr 2024 17:51:40 -0300 Subject: [PATCH 15/16] chore: change coverage script, add report-dir --- backend/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/package.json b/backend/package.json index a595eef..9b77561 100644 --- a/backend/package.json +++ b/backend/package.json @@ -11,7 +11,7 @@ "start": "node .", "dev": "nodemon --inspect=0.0.0.0:9229 .", "test:mocha": "mocha", - "test:coverage": "nyc mocha", + "test:coverage": "nyc --report-dir=./coverage mocha", "test:mutation": "stryker run", "lint": "eslint --no-error-on-unmatched-pattern ." }, From c2f147cc01a0a9c9ba9d0895c35bca45adb9c460 Mon Sep 17 00:00:00 2001 From: mairess Date: Wed, 24 Apr 2024 17:56:07 -0300 Subject: [PATCH 16/16] chore: remove double quote from codecov action --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f27f7f7..6dd8701 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -35,5 +35,5 @@ jobs: uses: codecov/codecov-action@v4.0.1 with: token: ${{ secrets.CODECOV_TOKEN }} - files: "backend/coverage/coverage-summary.json" + files: backend/coverage/coverage-summary.json slug: mairess/project-store-manager