From 51849b084c47f3e580ec0c79a6825c817bc2af11 Mon Sep 17 00:00:00 2001 From: emdhruu <119742045+emdhruu@users.noreply.github.com> Date: Thu, 26 Dec 2024 21:18:59 +0530 Subject: [PATCH] Added coverage threshold for automated tests. --- CHANGELOG.md | 15 +++++++++++++++ jest.config.js | 18 +++++++++++++++++- package.json | 2 +- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 295f4a712df..5483290e416 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ # Changelog + All notable changes to this project will be documented in this file. The format is loosely based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). @@ -7,32 +8,46 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm You should update the version number in the [package.json](./package.json) according to the semantic versioning, then run `npm install`. +## 1.6.1 + +- Added coverage threshold for automated tests. + ## 1.6.0 + - Added 3D hero banner ## 1.5.1 + - Bumped to node 16, docusaurus 2.0.1, react 17.0.2 ## 1.5.0 + - Fetch list of repositories by topic with GitHub GraphQL API instead of hardcoded list. ## 1.4.0 + - Added pagination to Repositories Page. ## 1.3.0 + - Added Repositories Page. ## 1.2.3 + - Added snapshot unit tests for all React components. ## 1.2.2 + - Refactored and added unit tests for `build-posts-data.js`. ## 1.2.1 + - Refactored and added unit tests for `build-repo-data.js`. ## 1.2.0 + - Added image to Medium blog posts, parsing the `content:encoded` field of the RSS feed. ## 1.1.0 + - Switched source of Medium blog posts from Pixel Point widget to RSS feed. It shows: title, link, creator, date. diff --git a/jest.config.js b/jest.config.js index b66fd0168a5..075014c2aea 100644 --- a/jest.config.js +++ b/jest.config.js @@ -21,7 +21,23 @@ const config = { "\\.[jt]sx?$": "babel-jest", ".+\\.(css|styl|less|sass|scss)$": "jest-css-modules-transform" }, - transformIgnorePatterns: ["/node_modules/(?!(@babel/runtime)/)"] + transformIgnorePatterns: ["/node_modules/(?!(@babel/runtime)/)"], + + collectCoverage: true, + coverageThreshold: { + global: { + branches: 80, + functions: 80, + lines: 80, + statements: 80 + } + }, + collectCoverageFrom: [ + "src/**/*.{js,jsx,ts,tsx}", + "!src/**/*.test.{js,jsx,ts,tsx}", + "!src/**/__tests__/**" + ], + coverageDirectory: "./coverage" }; module.exports = config; diff --git a/package.json b/package.json index f38106b99aa..f27c7c77cef 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "deploy": "docusaurus deploy", "serve": "docusaurus serve", "clear": "docusaurus clear", - "test": "jest" + "test": "jest --coverage" }, "dependencies": { "@apollo/client": "^3.5.8",