Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

chore: added jest coverage setup (#4871)

SagarRajput-7c7668b9a78ee
diff --git a/.github/workflows/jest-coverage-changes.yml b/.github/workflows/jest-coverage-changes.yml
new file mode 100644
index 0000000000..56d4cf1b70
--- /dev/null
+++ b/.github/workflows/jest-coverage-changes.yml
@@ -0,0 +1,31 @@
+name: Jest Coverage - changed files
+
+on:
+ pull_request:
+ branches: develop
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ with:
+ ref: "refs/heads/develop"
+ token: ${{ secrets.GITHUB_TOKEN }} # Provide the GitHub token for authentication
+
+ - name: Fetch branch
+ run: git fetch origin ${{ github.event.pull_request.head.ref }}
+
+ - run: |
+ git checkout ${{ github.event.pull_request.head.sha }}
+
+ - uses: actions/setup-node@v4
+ with:
+ node-version: lts/*
+
+ - name: Install dependencies
+ run: cd frontend && npm install -g yarn && yarn
+
+ - name: npm run test:changedsince
+ run: cd frontend && npm run i18n:generate-hash && npm run test:changedsince
diff --git a/frontend/jest.config.ts b/frontend/jest.config.ts
index 7b52ca5cf6..8737901922 100644
--- a/frontend/jest.config.ts
+++ b/frontend/jest.config.ts
@@ -35,6 +35,14 @@ const config: Config.InitialOptions = {
browsers: ['chromium', 'firefox', 'webkit'],
},
},
+ coverageThreshold: {
+ global: {
+ statements: 80,
+ branches: 65,
+ functions: 80,
+ lines: 80,
+ },
+ },
};
export default config;
diff --git a/frontend/package.json b/frontend/package.json
index 6040b2e3f0..86a7a80328 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -21,7 +21,9 @@
"playwright:codegen:local": "playwright codegen http://localhost:3301",
"playwright:codegen:local:auth": "yarn playwright:codegen:local --load-storage=tests/auth.json",
"husky:configure": "cd .. && husky install frontend/.husky && cd frontend && chmod ug+x .husky/*",
- "commitlint": "commitlint --edit $1"
+ "commitlint": "commitlint --edit $1",
+ "test": "jest --coverage",
+ "test:changedsince": "jest --changedSince=develop --coverage --silent"
},
"engines": {
"node": ">=16.15.0"