Registry / devops / teamcity-cucumber-formatter

teamcity-cucumber-formatter

JSON →
library1.0.4jsnpmunverified

A custom formatter for @cucumber/cucumber that outputs TeamCity service messages, enabling integration with JetBrains TeamCity CI for test reporting, artifact publishing, and screenshot linking. Current stable version is 1.0.4. Maintained actively with support for Cucumber >=7 and Node.js 12+. Supports both ESM and CJS via CLI or config file. Differentiates by providing native TeamCity reporting without additional plugins, supporting runtime artifact publishing and screenshot attachment for failed tests.

npm install teamcity-cucumber-formatter
INSTALL
IMPORT
SIG · TEAMCITY-CUCUMBER-
T
teamcity-cucumber-formatter
devopsjavascriptv1.0.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

teamcity-cucumber-formatter
import { resolve } from 'path'; const formatterPath = resolve('node_modules', 'teamcity-cucumber-formatter', 'dist', 'teamcity-cucumber-formatter.js')
require('teamcity-cucumber-formatter')
With Cucumber >=10, you must provide the full path to the bundled JS file; direct module name no longer works.
teamcity-cucumber-formatter (Cucumber 7-9)
--format ./node_modules/teamcity-cucumber-formatter
--format teamcity-cucumber-formatter
For Cucumber v7 to v9, use the relative path to the module; the module name alone is not sufficient.
teamcity-cucumber-formatter (config file)
format: ['./node_modules/teamcity-cucumber-formatter']
format: ['teamcity-cucumber-formatter']
Same as CLI – must use full path for Cucumber 7-9.

Installs the formatter and runs Cucumber with the TeamCity formatter for both legacy and modern Cucumber versions.

npm install --save-dev teamcity-cucumber-formatter # For Cucumber v7-9: cucumber-js --format ./node_modules/teamcity-cucumber-formatter # For Cucumber v10+: cucumber-js --format "file://$PWD/node_modules/teamcity-cucumber-formatter/dist/teamcity-cucumber-formatter.js"
Debug
Known issues
breakingCucumber v10 changed how formatters are loaded; the module name string no longer works. Must provide a file URL to the .js file.
fix
Use pathToFileURL as described in README for Cucumber >=10.
affects: >=1.0.0
deprecatedUsage with Cucumber <7 is not supported; peer dependency requires @cucumber/cucumber >=7.
fix
Upgrade Cucumber to v7 or later.
affects: >=1.0.0
gotchaWhen using the formatter in a config file with Cucumber v7-9, the format path must be absolute or relative to project root; a bare module name will fail silently.
fix
Use `path.resolve('node_modules', 'teamcity-cucumber-formatter')`.
affects: >=1.0.0
gotchaScreenshot environment variables must be set before Cucumber runs; using afterAll hooks may not work because formatter processes at end of run.
fix
Set TEAMCITY_CUCUMBER_* env vars in CI pipeline or before launching Cucumber.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: formatters is not iterable
Using a simple module name string with Cucumber v10+ instead of a file URL.
fix
Use pathToFileURL to convert the .js file path to a file URL string.
Error: Cannot find module 'teamcity-cucumber-formatter'
Using the module name directly in format option for Cucumber v7-9 without a path prefix.
fix
Prefix with './node_modules/teamcity-cucumber-formatter'.
Warning: No teamcity service messages found - formatter may not be loaded.
The formatter was not invoked because the format option was incorrectly specified.
fix
Double-check the format path and ensure it points to the correct module entry file.
Upgrade
Version history
1.0.4latest on npm
Audit
Dependencies
@cucumber/cucumberrequiredPeer dependency – required as formatter uses Cucumber's formatter API.
Agent activity
7 hits · last 30 days
node
6
Amazon
1
Resources
teamcity-cucumber-formatter — npm install teamcity-cucumber-formatter · libregistry