Registry / testing / jest-teamcity-reporter

jest-teamcity-reporter

JSON →
library0.9.0jsnpmunverified

Jest TeamCity Reporter is a utility package designed to integrate JavaScript Jest test results directly into TeamCity CI builds. Currently at version 0.9.0, it processes Jest's test output and formats it into TeamCity service messages, enabling TeamCity to display test statistics, failures, and test coverage information directly within its UI. Releases appear to be driven by feature additions (like coverage reporting introduced in 0.8.0, and TC10 support in 0.9.0) and bug fixes, with a moderate and stable cadence rather than rapid-fire development. Key differentiators include its seamless integration with TeamCity's native reporting capabilities, providing a rich testing experience directly within the CI dashboard. Its automatic activation based on the `TEAMCITY_VERSION` environment variable is also a significant feature, ensuring it only runs within a TeamCity environment, preventing local execution interference or requiring manual toggles. This makes it a highly specialized and focused tool, ideal for development teams leveraging Jest for their JavaScript testing and TeamCity for their continuous integration pipelines, streamlining the visibility of test outcomes and code quality metrics.

npm install jest-teamcity-reporter
INSTALL
IMPORT
SIG · JEST-TEAMCITY-REPO
J
jest-teamcity-reporter
testingjavascriptv0.9.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

jest-teamcity-reporter
// In your package.json: "jest": { "testResultsProcessor": "jest-teamcity-reporter" }
import { reporter } from 'jest-teamcity-reporter';
The primary way to enable this reporter is by configuring it as a `testResultsProcessor` string path in your Jest configuration (either `package.json` or `jest.config.js`). It automatically processes test results when enabled this way.
Default Export Function
const processResults = require('jest-teamcity-reporter'); // or for ESM: import processResults from 'jest-teamcity-reporter';
import { TeamcityReporter } from 'jest-teamcity-reporter';
For advanced use cases, such as chaining with other custom test result processors or programmatic invocation, you can directly import the default exported function. This function expects Jest's `AggregatedResult` object as an argument.
TEAMCITY_VERSION (Environment Variable)
export TEAMCITY_VERSION="your_version"
jest --teamcity-version 10.0
While not a code import, the presence of the `TEAMCITY_VERSION` environment variable is crucial for the reporter's activation. It will be silently disabled if this variable is not set, which is a frequent source of user confusion. Set it in your CI environment or locally for testing.

This quickstart demonstrates how to install and configure `jest-teamcity-reporter` in your `package.json` for a Jest project. It includes a basic test suite and explains how to run tests, simulating the necessary TeamCity environment variable for reporter activation, and shows an example with coverage.

{ "name": "my-jest-project", "version": "1.0.0", "scripts": { "test": "jest --coverage" // Added --coverage to demonstrate latest features }, "devDependencies": { "jest": "^29.0.0", "jest-teamcity-reporter": "0.9.0" }, "jest": { "testResultsProcessor": "jest-teamcity-reporter" } } // example.test.js describe('Arithmetic Operations', () => { test('should correctly add two numbers', () => { expect(1 + 2).toBe(3); }); test('should handle multiplication', () => { expect(2 * 3).toBe(6); }); test('should report a failure when expected', () => { // This test is intentionally designed to fail to show failure reporting in TeamCity // expect(5).toBe(10); expect(5).not.toBe(10); // Changed to pass for a successful quickstart run demonstration }); // function for coverage demonstration function coveredFunction(a, b) { if (a > b) return a - b; return a + b; } test('should cover a function', () => { expect(coveredFunction(5, 3)).toBe(2); expect(coveredFunction(2, 4)).toBe(6); }); }); // To run locally and simulate the TeamCity environment: // 1. Install dependencies: npm install // 2. Set the environment variable: export TEAMCITY_VERSION="10.0" // 3. Run tests: npm test // 4. To disable for local runs: unset TEAMCITY_VERSION
Debug
Known issues
breakingThe command-line interface (CLI) option `--teamcity` for activating the reporter was removed in version 0.5.0. Jest no longer supports custom CLI options for reporters.
fix
Remove the `--teamcity` flag from your Jest command. Configure the reporter by adding `"testResultsProcessor": "jest-teamcity-reporter"` to your Jest configuration within `package.json` or `jest.config.js`.
affects: >=0.5.0
gotchaThe reporter is only active and outputs TeamCity service messages when the `TEAMCITY_VERSION` environment variable is present. It will be silently disabled if this variable is not set.
fix
Ensure `TEAMCITY_VERSION` is set in your TeamCity build configuration. For local testing, temporarily set the variable (e.g., `export TEAMCITY_VERSION="10.0"` in your shell) before running Jest.
affects: >=0.5.0
breakingVersions of `jest-teamcity-reporter` prior to 0.3.0 did not officially support Jest versions 18 and above, potentially leading to incorrect reporting or errors.
fix
Upgrade to `jest-teamcity-reporter` version 0.3.0 or higher to ensure compatibility with Jest 18+. Always verify reporter compatibility with your specific Jest version.
affects: <0.3.0
gotchaCoverage statistics reporting to TeamCity was introduced in version 0.8.0 and further refined for TeamCity 10 (TC10) in version 0.9.0. Older versions will not report coverage.
fix
To get Jest test coverage reported in TeamCity, upgrade to `jest-teamcity-reporter` version 0.8.0 or newer. For full TC10 coverage features, use version 0.9.0 or later.
affects: <0.8.0
Errors
Common errors & fixes
Jest test results are not showing up in TeamCity's 'Tests' tab, or the reporter appears inactive.
The `TEAMCITY_VERSION` environment variable is not set in the build environment, or the `testResultsProcessor` is incorrectly configured.
fix
Verify that `TEAMCITY_VERSION` is defined in your TeamCity build configuration. Confirm that your `package.json` (or `jest.config.js`) contains `"jest": { "testResultsProcessor": "jest-teamcity-reporter" }`.
Error: Unknown option '--teamcity' when running Jest.
Attempting to use the deprecated `--teamcity` CLI option, which was removed in `jest-teamcity-reporter` version 0.5.0 as Jest no longer supports custom reporter options via CLI.
fix
Remove the `--teamcity` flag from your Jest command. Configure the reporter solely via the `testResultsProcessor` property in your Jest configuration.
Upgrade
Version history
0.9.0latest on npm
Audit
Dependencies
jestrequiredThis package acts as a Jest `testResultsProcessor`, requiring Jest to be installed as a peer or dev dependency for its functionality.
Agent activity
4 hits · last 30 days
node
4
Resources
jest-teamcity-reporter — npm install jest-teamcity-reporter · libregistry