diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 60cd2316b..f5acdb609 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -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: @@ -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" @@ -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" @@ -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 @@ -89,7 +93,6 @@ steps: env: SEGMENT_CODECOV_FLAGS: 'core' SEGMENT_CODECOV_ARGS: '--dir=./packages/core/coverage' - COVERAGE: true agents: queue: v1 commands: @@ -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" diff --git a/packages/browser/Makefile b/packages/browser/Makefile index e38f53bc4..af62a83d3 100644 --- a/packages/browser/Makefile +++ b/packages/browser/Makefile @@ -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="/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="/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="/qa/lib/jest-reporter.js" ${args} -.PHONY: test-coverage + COVERAGE=false $(yarn_run) test --forceExit --runTestsByPath qa/__tests__/destinations.test.ts --reporters="default" --reporters="/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 diff --git a/packages/config/src/jest/config.js b/packages/config/src/jest/config.js index 00c53331c..7212aa868 100644 --- a/packages/config/src/jest/config.js +++ b/packages/config/src/jest/config.js @@ -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: '/coverage', }