diff --git a/README.md b/README.md index feec511..849c842 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,8 @@ The test object in the report includes the following [CTRF properties](https://c | `name` | String | Required | The name of the test. | | `status` | String | Required | The outcome of the test. One of: `passed`, `failed`, `skipped`, `pending`, `other`. | | `duration` | Number | Required | The time taken for the test execution, in milliseconds. | +| `message` | String | Optional | The failure message if the test failed. | +| `trace` | String | Optional | The stack trace captured if the test failed. | ## Support Us diff --git a/package-lock.json b/package-lock.json index 66b9b09..bc6f0d2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,13 +1,13 @@ { "name": "newman-reporter-ctrf-json", - "version": "0.0.4", + "version": "0.0.5", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "newman-reporter-ctrf-json", - "version": "0.0.4", - "license": "ISC", + "version": "0.0.5", + "license": "MIT", "devDependencies": { "@types/newman": "^5.3.5", "@types/node": "^20.8.10", diff --git a/package.json b/package.json index 6730e25..476044b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "newman-reporter-ctrf-json", - "version": "0.0.4", - "description": "", + "version": "0.0.5", + "description": "Create a common JSON test report for Postman Newman tests", "main": "dist/index.js", "scripts": { "build": "tsc", @@ -15,8 +15,9 @@ "dist/", "README.md" ], - "author": "", - "license": "ISC", + "repository": "github:ctrf-io/newman-reporter-ctrf-json", + "author": "Matthew Thomas", + "license": "MIT", "devDependencies": { "@types/newman": "^5.3.5", "@types/node": "^20.8.10", diff --git a/src/generate-report.ts b/src/generate-report.ts index b86d992..6735baa 100644 --- a/src/generate-report.ts +++ b/src/generate-report.ts @@ -1,6 +1,7 @@ import * as fs from 'fs' import { type EventEmitter } from 'events' import { + type CtrfTest, type CtrfEnvironment, type CtrfReport, type CtrfTestState, @@ -127,7 +128,7 @@ class GenerateCtrfReport { execution.assertions.forEach((assertion) => { this.ctrfReport.results.summary.tests += 1 - const testResult = { + const testResult: CtrfTest = { name: assertion.assertion, status: assertion.error != null @@ -137,6 +138,8 @@ class GenerateCtrfReport { } if (assertion.error != null) { + testResult.message = assertion.error.message + testResult.trace = assertion.error.stack this.ctrfReport.results.summary.failed += 1 } else { this.ctrfReport.results.summary.passed += 1