@testream/mocha-reporter 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,14 @@
1
- import * as Mocha from 'mocha';
1
+ import * as Mocha from "mocha";
2
2
  /**
3
3
  * Testream Mocha Reporter
4
4
  * Wraps mocha-ctrf-json-reporter to generate CTRF reports and upload them to Testream
5
5
  */
6
6
  export declare class TestreamMochaReporter extends Mocha.reporters.Base {
7
- private config;
7
+ private readonly config;
8
+ private readonly ctrfReporterInstance;
8
9
  private readonly outputDir;
9
10
  private readonly outputFile;
11
+ private readonly snippets;
10
12
  constructor(runner: Mocha.Runner, options: Mocha.MochaOptions);
11
13
  /**
12
14
  * Mocha calls done(failures, fn) when a reporter defines it — Mocha will
@@ -21,6 +23,7 @@ export declare class TestreamMochaReporter extends Mocha.reporters.Base {
21
23
  * Read CTRF report from file
22
24
  */
23
25
  private readCTRFReport;
26
+ private writeCTRFReport;
24
27
  /**
25
28
  * Upload report to Testream API
26
29
  */
@@ -0,0 +1,11 @@
1
+ import type { CTRFReport } from "@jira-test-manager/shared-types";
2
+ interface MochaRunnableLike {
3
+ body?: string;
4
+ fullTitle(): string;
5
+ }
6
+ export interface MochaSnippetCollector {
7
+ add(test: MochaRunnableLike): void;
8
+ applyToReport(report: CTRFReport): void;
9
+ }
10
+ export declare function createMochaSnippetCollector(maxChars?: number): MochaSnippetCollector;
11
+ export {};
package/dist/types.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * Re-export CTRF types from shared-types package
3
3
  */
4
- export type { CTRFReport, CTRFTest, CTRFSummary, CTRFResults, CTRFAttachment, CTRFStep, } from '@jira-test-manager/shared-types';
4
+ export type { CTRFReport, CTRFTest, CTRFSummary, CTRFResults, CTRFAttachment, CTRFStep, } from "@jira-test-manager/shared-types";
5
5
  /**
6
6
  * Re-export API types from shared-types package
7
7
  */
8
- export type { IngestResponse, ApiErrorResponse, UploadResult, CIContext, } from '@jira-test-manager/shared-types';
8
+ export type { IngestResponse, ApiErrorResponse, UploadResult, CIContext, } from "@jira-test-manager/shared-types";
9
9
  /**
10
10
  * Reporter Configuration Options
11
11
  */
@@ -1,5 +1,5 @@
1
- import { UploadResult } from './types';
2
- import { UploadTestRunOptions } from '@jira-test-manager/shared-types';
1
+ import { UploadResult } from "./types";
2
+ import { UploadTestRunOptions } from "@jira-test-manager/shared-types";
3
3
  /**
4
4
  * Upload CTRF report to Testream API
5
5
  */
package/package.json CHANGED
@@ -1,17 +1,18 @@
1
1
  {
2
2
  "name": "@testream/mocha-reporter",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Mocha reporter to upload test results to Testream",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "scripts": {
8
- "build": "npm run build:bundle && npm run build:types",
8
+ "clean": "rm -rf dist",
9
+ "build": "npm run clean && npm run build:bundle && npm run build:types",
9
10
  "build:bundle": "ncc build src/index.ts -o dist --minify",
10
11
  "build:types": "tsc --declaration --emitDeclarationOnly --outDir dist",
11
12
  "format": "prettier --write '**/*.ts'",
12
13
  "lint": "eslint src/**/*.ts",
13
14
  "prepublishOnly": "npm run build",
14
- "test": "echo \"No tests yet\" && exit 0",
15
+ "test": "vitest run",
15
16
  "all": "npm run format && npm run lint && npm run build"
16
17
  },
17
18
  "repository": {
@@ -49,7 +50,8 @@
49
50
  "eslint": "^8.56.0",
50
51
  "mocha": "^10.0.0",
51
52
  "prettier": "^3.1.1",
52
- "typescript": "^5.3.3"
53
+ "typescript": "^5.3.3",
54
+ "vitest": "^3.0.0"
53
55
  },
54
56
  "engines": {
55
57
  "node": ">=18.0.0"