Skip to content

Commit

Permalink
Update codecoverage config (#1209)
Browse files Browse the repository at this point in the history
  • Loading branch information
silesky authored Jan 7, 2025
1 parent 32582be commit 22e6b16
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
13 changes: 9 additions & 4 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
env:
SEGMENT_CONTEXTS: 'snyk,npm,aws-credentials,ecr,npm-publish'
SEGMENT_BUILDKITE_IMAGE: 'analytics-next-ci-agent'
COVERAGE: true
steps:
- label: Log Environment
agents:
Expand Down Expand Up @@ -32,6 +33,9 @@ steps:
key: browser-lint-test
agents:
queue: v1
env:
SEGMENT_CODECOV_FLAGS: 'browser'
SEGMENT_CODECOV_ARGS: '--dir=./packages/browser/coverage'
commands:
- npm config set "//registry.npmjs.org/:_authToken" $${NPM_TOKEN}
- echo "--- Install dependencies"
Expand All @@ -48,9 +52,7 @@ steps:
agents:
queue: v1
env:
SEGMENT_CODECOV_FLAGS: 'browser'
SEGMENT_CODECOV_ARGS: '--dir=./packages/browser/coverage'
COVERAGE: true
COVERAGE: false
commands:
- npm config set "//registry.npmjs.org/:_authToken" $${NPM_TOKEN}
- echo "--- Install dependencies"
Expand All @@ -70,6 +72,8 @@ steps:
key: browser-integ
agents:
queue: v1
env:
COVERAGE: false
commands:
- echo "--- Install dependencies"
- PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 yarn install --immutable
Expand All @@ -89,7 +93,6 @@ steps:
env:
SEGMENT_CODECOV_FLAGS: 'core'
SEGMENT_CODECOV_ARGS: '--dir=./packages/core/coverage'
COVERAGE: true
agents:
queue: v1
commands:
Expand Down Expand Up @@ -163,6 +166,8 @@ steps:
key: destinations
agents:
queue: v1
env:
COVERAGE: false
commands:
- npm config set "//registry.npmjs.org/:_authToken" $${NPM_TOKEN}
- echo "--- Install dependencies"
Expand Down
18 changes: 7 additions & 11 deletions packages/browser/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,21 @@ test-unit: node_modules ## Runs unit tests
$(yarn_run) test
.PHONY: test-unit

test-coverage: node_modules ## Runs unit tests with coverage
$(yarn_run) test --coverage --forceExit
.PHONY: test-coverage

test-qa: build-browser ## Runs all QA tests in a single command
$(yarn_run) test --runTestsByPath qa/__tests__/*.test.ts --testPathIgnorePatterns qa/__tests__/destinations.test.ts --reporters="default" --reporters="<rootDir>/qa/lib/jest-reporter.js" ${args}
.PHONY: test-coverage
COVERAGE=false $(yarn_run) test --runTestsByPath qa/__tests__/*.test.ts --testPathIgnorePatterns qa/__tests__/destinations.test.ts --reporters="default" --reporters="<rootDir>/qa/lib/jest-reporter.js" ${args}
.PHONY: test-qa

test-qa-destinations: build-browser ## Runs Destination QA tests. options. DESTINATION=amplitude DEBUG=true
$(yarn_run) test --forceExit --runTestsByPath qa/__tests__/destinations.test.ts --reporters="default" --reporters="<rootDir>/qa/lib/jest-reporter.js" ${args}
.PHONY: test-coverage
COVERAGE=false $(yarn_run) test --forceExit --runTestsByPath qa/__tests__/destinations.test.ts --reporters="default" --reporters="<rootDir>/qa/lib/jest-reporter.js" ${args}
.PHONY: test-qa-destinations

test-integration: build ## Runs all integration tests in a single command
$(yarn_run) test --forceExit --runTestsByPath e2e-tests/**/*.test.ts ${args}
.PHONY: test-coverage
COVERAGE=false $(yarn_run) test --forceExit --runTestsByPath e2e-tests/**/*.test.ts ${args}
.PHONY: test-integration

test-perf: build ## Runs all integration tests in a single command
$(yarn_run) test --forceExit --runTestsByPath e2e-tests/performance/*.test.ts ${args}
.PHONY: test-coverage
.PHONY: test-perf

lint: node_modules ## Lints the source code
$(yarn_run) lint
Expand Down
8 changes: 5 additions & 3 deletions packages/config/src/jest/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ const createJestTSConfig = (
...(process.env.COVERAGE === 'true'
? {
collectCoverage: true,
coverageReporters: ['json'],
coverageReporters: ['json', 'text'],
collectCoverageFrom: [
'src/**/*.{js,jsx,ts,tsx}',
'!src/**/*.test.{js,jsx,ts,tsx}',
// Exclude test files "!src/**/index.{js,ts}",
// Exclude index files
'!src/**/__tests__/**',
'!**/test*/**',
'!**/e2e-tests/**',
'!**/qa/**',
],
coverageDirectory: '<rootDir>/coverage',
}
Expand Down

0 comments on commit 22e6b16

Please sign in to comment.