From 26db0cf1b8d5d9b6b0c42a8d9c569bb6de8ccfd3 Mon Sep 17 00:00:00 2001 From: marcos parajua Date: Mon, 29 Apr 2024 16:07:04 +0200 Subject: [PATCH 01/11] add config --- package.json | 2 +- src/app.ts | 1 + src/index.ts | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 37cbc7a..fc51fd5 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.js", "type": "module", "scripts": { - "start": "cross-env NODE_ENV=prod node dist/index.js", + "start:prod": "cross-env NODE_ENV=prod node dist/index.js", "start:dev": "cross-env DEBUG=W7E* NODE_ENV=dev PORT=3400 node --watch --env-file=.env dist/index.js", "start:mon": "cross-env DEBUG=W7E* NODE_ENV=dev PORT=3400 nodemon dist/index.js", "build": "tsc", diff --git a/src/app.ts b/src/app.ts index e69de29..8b13789 100644 --- a/src/app.ts +++ b/src/app.ts @@ -0,0 +1 @@ + diff --git a/src/index.ts b/src/index.ts index e69de29..8b13789 100644 --- a/src/index.ts +++ b/src/index.ts @@ -0,0 +1 @@ + From 86e0b9d2fcccbabcec12314b8d473a90f8fa869b Mon Sep 17 00:00:00 2001 From: marcos parajua Date: Mon, 29 Apr 2024 16:08:45 +0200 Subject: [PATCH 02/11] add config --- readme.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 readme.md diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..e8a5541 --- /dev/null +++ b/readme.md @@ -0,0 +1,13 @@ +En breve descripción, el proyecto es una aplicación de libros en la que los usuarios inscritos como administradores gestionan un listado “fijo” (esto es, a modo de inventario solo actualizable por el administrador). Los usuarios que accedan como usuarios logueados pueden añadir textos breves con imágenes y el resto de usuarios puedan ver el contenido en calidad de invitados. + +A continuación un listado completo de componentes empezando con el backend. + +Entidades. Mi modelo de datos consta de usuarios, libros y publicaciones. Los usuarios de tipo administrador podrán cada uno gestionar una cantidad indefinida de libros. Del mismo modo, los usuarios de tipo usuario podrán gestionar sus propias publicaciones de cantidad indefinida. Los usuarios de tipo invitado podrán visualizar el contenido. +Esquemas. Los esquemas de Joi sirven para la validación. Determinan el tipo de datos que se espera recibir en el input y si este es requerido u opcional. +Repositorios. Manejan las operaciones de base de datos mediante el uso de Prisma. Definen un objeto “select” que especifica los campos a consumir de la base de datos. Será necesario definir primero un repositorio genérico y después uno específico por cada entidad para poner en práctica la inversión de dependencias. Definen los métodos del CRUD. +Controladores. Al igual que con los repos, convendrá definir primero un controlador genérico y posteriormente los específicos a cada recurso para manejar la operaciones del CRUD. Aquí se implementará la validación descrita en el esquema. +Servicio de autentificación. Necesitaremos definir otro servicio para las tareas de autenticación que definirá el contenido válido del “payload”, hasheará contraseñas, comparará contraseñas y retornará tokens de autenticación. +Interceptor de autorización. Crearemos un middleware para manejar las labores de autorización y autenticación como verificar que la cabecera de autorización comienza con el convencional ‘Bearer’ y contiene el token, comprobar si el usuario es administrador. +Interceptor de errores. También vamos a definir una clase que extienda el interfaz de errores de typescript a fin de personalizar nuestra propia tirada de errores. +Interceptor de archivos. Necesitaremos un middleware para interceptar la subida de archivos y manjearla de manera acorde mediante Multer y Cloudinary. +Routers. Necesitaremos enrutadores para libros y artículos así como el de usuarios con los métodos para registro y logueado. From 5e2e81e2942b6554894d9caac00acb3b81d66022 Mon Sep 17 00:00:00 2001 From: marcos parajua Date: Mon, 29 Apr 2024 16:15:32 +0200 Subject: [PATCH 03/11] add config --- .github/workflows/sonar.yml | 99 +++---------------------------------- 1 file changed, 8 insertions(+), 91 deletions(-) diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml index 13193e2..0013c83 100644 --- a/.github/workflows/sonar.yml +++ b/.github/workflows/sonar.yml @@ -1,107 +1,24 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -# This workflow helps you trigger a SonarCloud analysis of your code and populates -# GitHub Code Scanning alerts with the vulnerabilities found. -# Free for open source project. - -# 1. Login to SonarCloud.io using your GitHub account - -# 2. Import your project on SonarCloud -# * Add your GitHub organization first, then add your repository as a new project. -# * Please note that many languages are eligible for automatic analysis, -# which means that the analysis will start automatically without the need to set up GitHub Actions. -# * This behavior can be changed in Administration > Analysis Method. -# -# 3. Follow the SonarCloud in-product tutorial -# * a. Copy/paste the Project Key and the Organization Key into the args parameter below -# (You'll find this information in SonarCloud. Click on "Information" at the bottom left) -# -# * b. Generate a new token and add it to your Github repository's secrets using the name SONAR_TOKEN -# (On SonarCloud, click on your avatar on top-right > My account > Security -# or go directly to https://sonarcloud.io/account/security/) - -# Feel free to take a look at our documentation (https://docs.sonarcloud.io/getting-started/github/) -# or reach out to our community forum if you need some help (https://community.sonarsource.com/c/help/sc/9) - -name: SonarCloud Analysis - +name: Build on: push: - branches: ['main'] + branches: + - main pull_request: types: [opened, synchronize, reopened] - workflow_dispatch: - -permissions: - pull-requests: read # allows SonarCloud to decorate PRs with analysis results - jobs: - SonarCloud_Demo1: - name: SonarCloud Demo1 + sonarcloud: + name: SonarCloud runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - - name: Install modules + - name: Install module run: npm ci - name: Testing coverage - run: npm run test:prod #Change for a valid npm script - working-directory: projects/demo1 # The directory containing the source code + run: npm run test:prod - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_DEMO1 }} # Generate a token on Sonarcloud.io, add it to the secrets of this repo with the name SONAR_TOKEN (Settings > Secrets > Actions > add new repository secret) - with: - projectBaseDir: projects/demo1 # The directory containing the source code - # Additional arguments for the sonarcloud scanner - # args: - # Unique keys of your project and organization. You can find them in SonarCloud > Information (bottom-left menu) - # mandatory - # -Dsonar.projectKey=isdi-coders-2023_Bubbles-202307-mad - # -Dsonar.organization=isdi-coders-2023 - # Comma-separated paths to directories containing main source files. - #-Dsonar.sources= # optional, default is project base directory - # When you need the analysis to take place in a directory other than the one from which it was launched - #-Dsonar.projectBaseDir= # optional, default is . - # Comma-separated paths to directories containing test source files. - #-Dsonar.tests= # optional. For more info about Code Coverage, please refer to https://docs.sonarcloud.io/enriching/test-coverage/overview/ - # Adds more detail to both client and server-side analysis logs, activating DEBUG mode for the scanner, and adding client-side environment variables and system properties to the server-side log of analysis report processing. - #-Dsonar.verbose= # optional, default is false - SonarCloud_Pokemon: - name: SonarCloud Pokemon - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - - name: Install modules - run: npm ci - - name: Testing coverage - run: npm run test:prod #Change for a valid npm script - working-directory: projects/pokemon # The directory containing the source code - - name: SonarCloud Scan - uses: SonarSource/sonarcloud-github-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_POKEMON }} # Generate a token on Sonarcloud.io, add it to the secrets of this repo with the name SONAR_TOKEN (Settings > Secrets > Actions > add new repository secret) - with: - projectBaseDir: projects/pokemon # The directory containing the source code - # Additional arguments for the sonarcloud scanner - # args: - # Unique keys of your project and organization. You can find them in SonarCloud > Information (bottom-left menu) - # mandatory - # -Dsonar.projectKey=isdi-coders-2023_Bubbles-202307-mad - # -Dsonar.organization=isdi-coders-2023 - # Comma-separated paths to directories containing main source files. - #-Dsonar.sources= # optional, default is project base directory - # When you need the analysis to take place in a directory other than the one from which it was launched - #-Dsonar.projectBaseDir= # optional, default is . - # Comma-separated paths to directories containing test source files. - #-Dsonar.tests= # optional. For more info about Code Coverage, please refer to https://docs.sonarcloud.io/enriching/test-coverage/overview/ - # Adds more detail to both client and server-side analysis logs, activating DEBUG mode for the scanner, and adding client-side environment variables and system properties to the server-side log of analysis report processing. - #-Dsonar.verbose= # optional, default is false + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} From e8764473d398ca71b840ac005651a7e5b23167c9 Mon Sep 17 00:00:00 2001 From: marcos parajua Date: Mon, 29 Apr 2024 16:21:55 +0200 Subject: [PATCH 04/11] add config --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index fc51fd5..f8e5c8d 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "dev": "tsc -w", "test": "jest", "test:dev": "cross-env NODE_ENV=test jest --watchAll --coverage", + "test:prod": "jest --coverage", "lint": "eslint . --ext .ts" }, "keywords": [], From 9cd97fabfd12615ece8c08f472f020c1a55527ba Mon Sep 17 00:00:00 2001 From: marcos parajua Date: Mon, 29 Apr 2024 16:42:39 +0200 Subject: [PATCH 05/11] config sonar --- package.json | 2 +- sonar-project.properties | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 sonar-project.properties diff --git a/package.json b/package.json index f8e5c8d..4efff3e 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "dev": "tsc -w", "test": "jest", "test:dev": "cross-env NODE_ENV=test jest --watchAll --coverage", - "test:prod": "jest --coverage", + "test:prod": "jest --passWithNoTests --coverage", "lint": "eslint . --ext .ts" }, "keywords": [], diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..541cf37 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,13 @@ +sonar.projectKey=isdi-coders-2023_Marcos-Parajua-Final-Project-202402-Mad-Back +sonar.organization=isdi-coders-2023 + +# This is the name and version displayed in the SonarCloud UI. +#sonar.projectName=Marcos-Parajua-Final-Project-202402-Mad-Back +#sonar.projectVersion=1.0 + + +# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. +#sonar.sources=. + +# Encoding of the source code. Default is default system encoding +#sonar.sourceEncoding=UTF-8 From 1260f359003dedf6fd3e69cf965e940cd40595dd Mon Sep 17 00:00:00 2001 From: marcos parajua Date: Mon, 29 Apr 2024 16:49:55 +0200 Subject: [PATCH 06/11] config sonar --- .github/workflows/{sonar.yml => build.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{sonar.yml => build.yml} (100%) diff --git a/.github/workflows/sonar.yml b/.github/workflows/build.yml similarity index 100% rename from .github/workflows/sonar.yml rename to .github/workflows/build.yml From 931b5c1a1df7c08af2158ba00239e8448b559dad Mon Sep 17 00:00:00 2001 From: marcos parajua Date: Mon, 29 Apr 2024 16:55:10 +0200 Subject: [PATCH 07/11] fix indent size --- jest.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/jest.config.js b/jest.config.js index 57fa375..4aa32b7 100644 --- a/jest.config.js +++ b/jest.config.js @@ -147,4 +147,5 @@ const config = { // Whether to use watchman for file crawling // watchman: true, }; + export default config; From 3d70a2210a3e9c4bbf23e8c1a9402174f835a241 Mon Sep 17 00:00:00 2001 From: marcos parajua Date: Mon, 29 Apr 2024 17:01:35 +0200 Subject: [PATCH 08/11] fix indent size --- jest.config.js | 114 +------------------------------------------------ 1 file changed, 1 insertion(+), 113 deletions(-) diff --git a/jest.config.js b/jest.config.js index 4aa32b7..c6979b4 100644 --- a/jest.config.js +++ b/jest.config.js @@ -29,123 +29,11 @@ const config = { ], // Indicates which provider should be used to instrument code for coverage coverageProvider: 'v8', - // A list of reporter names that Jest uses when writing coverage reports - // coverageReporters: [ - // "json", - // "text", - // "lcov", - // "clover" - // ], - // An object that configures minimum threshold enforcement for coverage results - // coverageThreshold: undefined, - // A path to a custom dependency extractor - // dependencyExtractor: undefined, - // Make calling deprecated APIs throw helpful error messages - // errorOnDeprecated: false, - // The default configuration for fake timers - // fakeTimers: { - // "enableGlobally": false - // }, - // Force coverage collection from ignored files using an array of glob patterns - // forceCoverageMatch: [], - // A path to a module which exports an async function that is triggered once before all test suites - // globalSetup: undefined, - // A path to a module which exports an async function that is triggered once after all test suites - // globalTeardown: undefined, - // A set of global variables that need to be available in all test environments - // globals: {}, - // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers. - // maxWorkers: "50%", - // An array of directory names to be searched recursively up from the requiring module's location - // moduleDirectories: [ - // "node_modules" - // ], - // An array of file extensions your modules use - // moduleFileExtensions: [ - // "js", - // "mjs", - // "cjs", - // "jsx", - // "ts", - // "tsx", - // "json", - // "node" - // ], - // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module - // moduleNameMapper: {}, - // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader - // modulePathIgnorePatterns: [], - // Activates notifications for test results - // notify: false, - // An enum that specifies notification mode. Requires { notify: true } - // notifyMode: "failure-change", // A preset that is used as a base for Jest's configuration preset: 'ts-jest', testPathIgnorePatterns: ['dist'], - // Run tests from one or more projects - // projects: undefined, - // Use this configuration option to add custom reporters to Jest - // reporters: undefined, - // Automatically reset mock state before every test - // resetMocks: false, - // Reset the module registry before running each individual test - // resetModules: false, - // A path to a custom resolver + // Use a custom resolver for TypeScript and web compatibility resolver: 'jest-ts-webcompat-resolver', - // Automatically restore mock state and implementation before every test - // restoreMocks: false, - // The root directory that Jest should scan for tests and modules within - // rootDir: undefined, - // A list of paths to directories that Jest should use to search for files in - // roots: [ - // "" - // ], - // Allows you to use a custom runner instead of Jest's default test runner - // runner: "jest-runner", - // The paths to modules that run some code to configure or set up the testing environment before each test - // setupFiles: [], - // A list of paths to modules that run some code to configure or set up the testing framework before each test - // setupFilesAfterEnv: [], - // The number of seconds after which a test is considered as slow and reported as such in the results. - // slowTestThreshold: 5, - // A list of paths to snapshot serializer modules Jest should use for snapshot testing - // snapshotSerializers: [], - // The test environment that will be used for testing - // testEnvironment: "jest-environment-node", - // Options that will be passed to the testEnvironment - // testEnvironmentOptions: {}, - // Adds a location field to test results - // testLocationInResults: false, - // The glob patterns Jest uses to detect test files - // testMatch: [ - // "**/__tests__/**/*.[jt]s?(x)", - // "**/?(*.)+(spec|test).[tj]s?(x)" - // ], - // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped - // testPathIgnorePatterns: [ - // "\\\\node_modules\\\\" - // ], - // The regexp pattern or array of patterns that Jest uses to detect test files - // testRegex: [], - // This option allows the use of a custom results processor - // testResultsProcessor: undefined, - // This option allows use of a custom test runner - // testRunner: "jest-circus/runner", - // A map from regular expressions to paths to transformers - // transform: undefined, - // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation - // transformIgnorePatterns: [ - // "\\\\node_modules\\\\", - // "\\.pnp\\.[^\\\\]+$" - // ], - // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them - // unmockedModulePathPatterns: undefined, - // Indicates whether each individual test should be reported during the run - // verbose: undefined, - // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode - // watchPathIgnorePatterns: [], - // Whether to use watchman for file crawling - // watchman: true, }; export default config; From c464ed9a9d39fe2c4167b61100b657563ba78dc7 Mon Sep 17 00:00:00 2001 From: marcos parajua Date: Mon, 29 Apr 2024 17:08:37 +0200 Subject: [PATCH 09/11] indent size audit problem --- jest.config.js | 116 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 113 insertions(+), 3 deletions(-) diff --git a/jest.config.js b/jest.config.js index c6979b4..dbe2751 100644 --- a/jest.config.js +++ b/jest.config.js @@ -23,17 +23,127 @@ const config = { 'entities', 'interface', 'tools', - 'type', '_mock', // "\\\\node_modules\\\\" ], // Indicates which provider should be used to instrument code for coverage coverageProvider: 'v8', + // A list of reporter names that Jest uses when writing coverage reports + // coverageReporters: [ + // "json", + // "text", + // "lcov", + // "clover" + // ], + // An object that configures minimum threshold enforcement for coverage results + // coverageThreshold: undefined, + // A path to a custom dependency extractor + // dependencyExtractor: undefined, + // Make calling deprecated APIs throw helpful error messages + // errorOnDeprecated: false, + // The default configuration for fake timers + // fakeTimers: { + // "enableGlobally": false + // }, + // Force coverage collection from ignored files using an array of glob patterns + // forceCoverageMatch: [], + // A path to a module which exports an async function that is triggered once before all test suites + // globalSetup: undefined, + // A path to a module which exports an async function that is triggered once after all test suites + // globalTeardown: undefined, + // A set of global variables that need to be available in all test environments + // globals: {}, + // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers. + // maxWorkers: "50%", + // An array of directory names to be searched recursively up from the requiring module's location + // moduleDirectories: [ + // "node_modules" + // ], + // An array of file extensions your modules use + // moduleFileExtensions: [ + // "js", + // "mjs", + // "cjs", + // "jsx", + // "ts", + // "tsx", + // "json", + // "node" + // ], + // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module + // moduleNameMapper: {}, + // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader + // modulePathIgnorePatterns: [], + // Activates notifications for test results + // notify: false, + // An enum that specifies notification mode. Requires { notify: true } + // notifyMode: "failure-change", // A preset that is used as a base for Jest's configuration preset: 'ts-jest', testPathIgnorePatterns: ['dist'], - // Use a custom resolver for TypeScript and web compatibility + // Run tests from one or more projects + // projects: undefined, + // Use this configuration option to add custom reporters to Jest + // reporters: undefined, + // Automatically reset mock state before every test + // resetMocks: false, + // Reset the module registry before running each individual test + // resetModules: false, + // A path to a custom resolver resolver: 'jest-ts-webcompat-resolver', + // Automatically restore mock state and implementation before every test + // restoreMocks: false, + // The root directory that Jest should scan for tests and modules within + // rootDir: undefined, + // A list of paths to directories that Jest should use to search for files in + // roots: [ + // "" + // ], + // Allows you to use a custom runner instead of Jest's default test runner + // runner: "jest-runner", + // The paths to modules that run some code to configure or set up the testing environment before each test + // setupFiles: [], + // A list of paths to modules that run some code to configure or set up the testing framework before each test + // setupFilesAfterEnv: [], + // The number of seconds after which a test is considered as slow and reported as such in the results. + // slowTestThreshold: 5, + // A list of paths to snapshot serializer modules Jest should use for snapshot testing + // snapshotSerializers: [], + // The test environment that will be used for testing + // testEnvironment: "jest-environment-node", + // Options that will be passed to the testEnvironment + // testEnvironmentOptions: {}, + // Adds a location field to test results + // testLocationInResults: false, + // The glob patterns Jest uses to detect test files + // testMatch: [ + // "**/__tests__/**/*.[jt]s?(x)", + // "**/?(*.)+(spec|test).[tj]s?(x)" + // ], + // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped + // testPathIgnorePatterns: [ + // "\\\\node_modules\\\\" + // ], + // The regexp pattern or array of patterns that Jest uses to detect test files + // testRegex: [], + // This option allows the use of a custom results processor + // testResultsProcessor: undefined, + // This option allows use of a custom test runner + // testRunner: "jest-circus/runner", + // A map from regular expressions to paths to transformers + // transform: undefined, + // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation + // transformIgnorePatterns: [ + // "\\\\node_modules\\\\", + // "\\.pnp\\.[^\\\\]+$" + // ], + // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them + // unmockedModulePathPatterns: undefined, + // Indicates whether each individual test should be reported during the run + // verbose: undefined, + // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode + // watchPathIgnorePatterns: [], + // Whether to use watchman for file crawling + // watchman: true, }; - export default config; From eee96398ed26c6cf3ea3a38c7fe0ed946634958c Mon Sep 17 00:00:00 2001 From: marcos parajua Date: Mon, 29 Apr 2024 17:18:55 +0200 Subject: [PATCH 10/11] indent size fix --- jest.config.js | 132 ------------------------------------------------- 1 file changed, 132 deletions(-) diff --git a/jest.config.js b/jest.config.js index dbe2751..1eb2e0f 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,149 +1,17 @@ -/** - * For a detailed explanation regarding each configuration property, visit: - * https://jestjs.io/docs/configuration - */ const config = { - // All imported modules in your tests should be mocked automatically - // automock: false, - // Stop running tests after `n` failures - // bail: 0, - // The directory where Jest should store its cached dependency information - // cacheDirectory: "C:\\Users\\alejandro\\AppData\\Local\\Temp\\jest", - // Automatically clear mock calls, instances, contexts and results before every test - // clearMocks: false, - // Indicates whether the coverage information should be collected while executing the test collectCoverage: true, - // An array of glob patterns indicating a set of files for which coverage information should be collected collectCoverageFrom: ['src/**/*.{ts,tsx}'], - // The directory where Jest should output its coverage files coverageDirectory: 'coverage', - // An array of regexp pattern strings used to skip coverage collection coveragePathIgnorePatterns: [ 'index.ts', 'entities', 'interface', 'tools', '_mock', - // "\\\\node_modules\\\\" ], - // Indicates which provider should be used to instrument code for coverage coverageProvider: 'v8', - // A list of reporter names that Jest uses when writing coverage reports - // coverageReporters: [ - // "json", - // "text", - // "lcov", - // "clover" - // ], - // An object that configures minimum threshold enforcement for coverage results - // coverageThreshold: undefined, - // A path to a custom dependency extractor - // dependencyExtractor: undefined, - // Make calling deprecated APIs throw helpful error messages - // errorOnDeprecated: false, - // The default configuration for fake timers - // fakeTimers: { - // "enableGlobally": false - // }, - // Force coverage collection from ignored files using an array of glob patterns - // forceCoverageMatch: [], - // A path to a module which exports an async function that is triggered once before all test suites - // globalSetup: undefined, - // A path to a module which exports an async function that is triggered once after all test suites - // globalTeardown: undefined, - // A set of global variables that need to be available in all test environments - // globals: {}, - // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers. - // maxWorkers: "50%", - // An array of directory names to be searched recursively up from the requiring module's location - // moduleDirectories: [ - // "node_modules" - // ], - // An array of file extensions your modules use - // moduleFileExtensions: [ - // "js", - // "mjs", - // "cjs", - // "jsx", - // "ts", - // "tsx", - // "json", - // "node" - // ], - // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module - // moduleNameMapper: {}, - // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader - // modulePathIgnorePatterns: [], - // Activates notifications for test results - // notify: false, - // An enum that specifies notification mode. Requires { notify: true } - // notifyMode: "failure-change", - // A preset that is used as a base for Jest's configuration preset: 'ts-jest', testPathIgnorePatterns: ['dist'], - // Run tests from one or more projects - // projects: undefined, - // Use this configuration option to add custom reporters to Jest - // reporters: undefined, - // Automatically reset mock state before every test - // resetMocks: false, - // Reset the module registry before running each individual test - // resetModules: false, - // A path to a custom resolver resolver: 'jest-ts-webcompat-resolver', - // Automatically restore mock state and implementation before every test - // restoreMocks: false, - // The root directory that Jest should scan for tests and modules within - // rootDir: undefined, - // A list of paths to directories that Jest should use to search for files in - // roots: [ - // "" - // ], - // Allows you to use a custom runner instead of Jest's default test runner - // runner: "jest-runner", - // The paths to modules that run some code to configure or set up the testing environment before each test - // setupFiles: [], - // A list of paths to modules that run some code to configure or set up the testing framework before each test - // setupFilesAfterEnv: [], - // The number of seconds after which a test is considered as slow and reported as such in the results. - // slowTestThreshold: 5, - // A list of paths to snapshot serializer modules Jest should use for snapshot testing - // snapshotSerializers: [], - // The test environment that will be used for testing - // testEnvironment: "jest-environment-node", - // Options that will be passed to the testEnvironment - // testEnvironmentOptions: {}, - // Adds a location field to test results - // testLocationInResults: false, - // The glob patterns Jest uses to detect test files - // testMatch: [ - // "**/__tests__/**/*.[jt]s?(x)", - // "**/?(*.)+(spec|test).[tj]s?(x)" - // ], - // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped - // testPathIgnorePatterns: [ - // "\\\\node_modules\\\\" - // ], - // The regexp pattern or array of patterns that Jest uses to detect test files - // testRegex: [], - // This option allows the use of a custom results processor - // testResultsProcessor: undefined, - // This option allows use of a custom test runner - // testRunner: "jest-circus/runner", - // A map from regular expressions to paths to transformers - // transform: undefined, - // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation - // transformIgnorePatterns: [ - // "\\\\node_modules\\\\", - // "\\.pnp\\.[^\\\\]+$" - // ], - // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them - // unmockedModulePathPatterns: undefined, - // Indicates whether each individual test should be reported during the run - // verbose: undefined, - // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode - // watchPathIgnorePatterns: [], - // Whether to use watchman for file crawling - // watchman: true, }; export default config; From 85778a9e5c484949c9e2a8280fea49f9b1c27b75 Mon Sep 17 00:00:00 2001 From: marcos parajua Date: Mon, 29 Apr 2024 17:25:31 +0200 Subject: [PATCH 11/11] fix sonar yamel discrepancy --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0013c83..e0b3dbd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ jobs: with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - name: Install module - run: npm ci + run: npm i - name: Testing coverage run: npm run test:prod - name: SonarCloud Scan