Update package version to 1.0.7 and modify entry points in package.json; remove TEAMCITY.md documentation file.
This commit is contained in:
110
docs/TEAMCITY.md
110
docs/TEAMCITY.md
@@ -1,110 +0,0 @@
|
|||||||
# TeamCity Test Integration
|
|
||||||
|
|
||||||
This project includes TeamCity test reporting integration using the `TeamcityReporter` class.
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
### In TeamCity CI
|
|
||||||
|
|
||||||
When running tests in TeamCity, use the `test:teamcity` script:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bun run test:teamcity
|
|
||||||
```
|
|
||||||
|
|
||||||
This will automatically detect the TeamCity environment (via `TEAMCITY_VERSION` env variable) and output test results in TeamCity's service message format.
|
|
||||||
|
|
||||||
### Local Development
|
|
||||||
|
|
||||||
For local testing, simply use:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bun test
|
|
||||||
```
|
|
||||||
|
|
||||||
The TeamCity reporter will be disabled automatically when not running in TeamCity.
|
|
||||||
|
|
||||||
## How It Works
|
|
||||||
|
|
||||||
The integration uses a TAP (Test Anything Protocol) to TeamCity converter:
|
|
||||||
|
|
||||||
1. **TAP Reporter**: Bun's built-in TAP reporter outputs test results in TAP format
|
|
||||||
2. **Converter**: `scripts/test-tap-teamcity.ts` parses TAP output and converts it to TeamCity service messages
|
|
||||||
3. **TeamcityReporter**: `tests/TeamcityReporter.ts` formats and outputs TeamCity service messages
|
|
||||||
|
|
||||||
## TeamCity Service Messages
|
|
||||||
|
|
||||||
The reporter outputs the following TeamCity service messages:
|
|
||||||
|
|
||||||
- `##teamcity[testSuiteStarted name='...']` - When a test suite starts
|
|
||||||
- `##teamcity[testSuiteFinished name='...']` - When a test suite ends
|
|
||||||
- `##teamcity[testStarted name='...']` - When a test starts
|
|
||||||
- `##teamcity[testFinished name='...']` - When a test completes successfully
|
|
||||||
- `##teamcity[testFailed name='...' message='...' details='...']` - When a test fails
|
|
||||||
- `##teamcity[testIgnored name='...']` - When a test is skipped
|
|
||||||
|
|
||||||
## Special Character Escaping
|
|
||||||
|
|
||||||
The reporter properly escapes special characters according to [TeamCity's specification](https://www.jetbrains.com/help/teamcity/service-messages.html#Escaped+values):
|
|
||||||
|
|
||||||
- `|` → `||`
|
|
||||||
- `'` → `|'`
|
|
||||||
- `\n` → `|n`
|
|
||||||
- `\r` → `|r`
|
|
||||||
- `[` → `|[`
|
|
||||||
- `]` → `|]`
|
|
||||||
|
|
||||||
## Available Test Scripts
|
|
||||||
|
|
||||||
| Script | Description |
|
|
||||||
|--------|-------------|
|
|
||||||
| `bun test` | Run tests normally (local development) |
|
|
||||||
| `bun test --watch` | Run tests in watch mode |
|
|
||||||
| `bun run test:teamcity` | Run tests with TeamCity reporting |
|
|
||||||
| `bun run ci-test` | Alias for `test:teamcity` (used in CI) |
|
|
||||||
|
|
||||||
## TeamCity Build Configuration
|
|
||||||
|
|
||||||
Add this build step to your TeamCity build configuration:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Install dependencies
|
|
||||||
bun install
|
|
||||||
|
|
||||||
# Run tests with TeamCity reporting
|
|
||||||
bun run ci-test
|
|
||||||
```
|
|
||||||
|
|
||||||
## Files
|
|
||||||
|
|
||||||
- `tests/TeamcityReporter.ts` - TeamCity service message formatter
|
|
||||||
- `scripts/test-tap-teamcity.ts` - TAP to TeamCity converter
|
|
||||||
- `scripts/test-teamcity.ts` - Alternative direct output parser (not currently used)
|
|
||||||
- `tests/setup.ts` - Test setup utilities
|
|
||||||
|
|
||||||
## Testing the Integration
|
|
||||||
|
|
||||||
To test TeamCity reporting locally:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Simulate TeamCity environment
|
|
||||||
export TEAMCITY_VERSION="2024.1"
|
|
||||||
bun run test:teamcity
|
|
||||||
|
|
||||||
# Unset when done
|
|
||||||
unset TEAMCITY_VERSION
|
|
||||||
```
|
|
||||||
|
|
||||||
You should see output like:
|
|
||||||
|
|
||||||
```
|
|
||||||
##teamcity[testSuiteStarted name='HashMap']
|
|
||||||
##teamcity[testStarted name='HashMap > constructor > should create an empty map with default capacity']
|
|
||||||
##teamcity[testFinished name='HashMap > constructor > should create an empty map with default capacity']
|
|
||||||
...
|
|
||||||
##teamcity[testSuiteFinished name='HashMap']
|
|
||||||
```
|
|
||||||
|
|
||||||
12
package.json
12
package.json
@@ -1,17 +1,17 @@
|
|||||||
{
|
{
|
||||||
"name": "@techniker-me/hash-map",
|
"name": "@techniker-me/hash-map",
|
||||||
"version": "1.0.6",
|
"version": "1.0.8",
|
||||||
"description": "A robust HashMap implementation following OOP SOLID principles",
|
"description": "A robust HashMap implementation following OOP SOLID principles",
|
||||||
"module": "src/index.ts",
|
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "src/index.ts",
|
"main": "browser/index.ts",
|
||||||
|
"module": "node/index.js",
|
||||||
"types": "types/index.d.ts",
|
"types": "types/index.d.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"node": "./node/index.js",
|
"node": "node/index.js",
|
||||||
"browser": "./browser/index.js"
|
"browser": "browser/index.js"
|
||||||
},
|
},
|
||||||
"./types": "./types/index.d.ts"
|
"./types": "types/index.d.ts"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"node",
|
"node",
|
||||||
|
|||||||
Reference in New Issue
Block a user