tslint-teamcity-reporter
A TSLint formatter/reporter for use in TeamCity which groups by files using TeamCity Test Suite
Note: v3.0.0 is completely rewritten to keep it more maintainable
(borrowing from eslint-teamcity and tslint internal tests),
and will be a breaking change to your configuration and output.
Changes
- From the CLI, the formatter can now be specified as
-t ./node_modules/tslint-teamcity-reporter/index.js
- The lint errors reported as tests are now grouped by file
- This means that on the top-level, you only see failed files, not individual errors
- The individual errors are now displayed as error output for each file
- This means that the 'failed test count' will drop significantly, please take into account in your overall metrics
- If you liked the old approach better, please let me know in a ticket, and I can add it back as an option
- Warnings are now treated as such, will show up in the logs and at the bottom of a failed test
Installation
yarn add tslint-teamcity-reporter
npm i -D tslint-teamcity-reporter
Usage
Use it with:
TSLint CLI
tslint files/**/*.ts -t ./node_modules/tslint-teamcity-reporter/index.js
grunt-tslint
grunt.initConfig({
tslint: {
options: {
formatter: 'tslint-teamcity-reporter'
},
files: {
src: ['**/*.ts']
}
}
});
grunt.loadNpmTasks('tslint-teamcity-reporter');
grunt.registerTask('default', ['tslint']);
Configuration
There are several ways that you can configure tslint-teamcity.
You don't have to configure anything by default, you just have the option to if you would like.
Settings are looked for in the following priority:
1. From your package.json
If you have a package.json file in the current directory, you can add an extra "eslint-teamcity" property to it:
{
"tslint-teamcity": {
"report-name": "My TSLint Violations",
"error-statistics-name": "My TSLint Error Count",
"warning-statistics-name": "My TSLint Warning Count"
}
}
2. ENV variables
export TSLINT_TEAMCITY_REPORT_NAME="My Formatting Problems"
export TSLINT_TEAMCITY_ERROR_STATISTICS_NAME="My Error Count"
export TSLINT_TEAMCITY_WARNING_STATISTICS_NAME="My Warning Count"
You can also output your current settings to the log if you set:
export TSLINT_TEAMCITY_DISPLAY_CONFIG=true
Building
In order to build tslint-teamcity-reporter, ensure that you have Git
and Node.js installed.
Clone a copy of the repo:
git clone https://github.com/ThaNarie/tslint-teamcity-reporter.git
Change to the tslint-teamcity-reporter directory:
cd tslint-teamcity-reporter
Install dev dependencies:
yarn
Use one of the following main scripts:
yarn build
yarn dev
yarn test
yarn test:dev
yarn lint
When installing this module, it adds a pre-commit hook, that runs lint and prettier commands
before committing, so you can be sure that everything checks out.
Contribute
View CONTRIBUTING.md
LICENSE
Thanks to eslint-teamcity, jshint-teamcity and tslint.
MIT © Tha Narie