@sprucelabs/jest-json-reporter
Advanced tools
Comparing version 1.0.1 to 2.0.0
@@ -1,13 +0,33 @@ | ||
import { Reporter, Test, TestResult } from '@jest/reporters'; | ||
import { AggregatedResult, Context, Reporter, Test, TestResult } from '@jest/reporters'; | ||
export declare type Milliseconds = number; | ||
declare type Status = 'passed' | 'failed' | 'skipped' | 'pending' | 'todo' | 'disabled'; | ||
declare type CallSite = { | ||
column: number; | ||
line: number; | ||
}; | ||
export declare type AssertionResult = { | ||
ancestorTitles: Array<string>; | ||
duration?: Milliseconds | null; | ||
failureDetails: Array<unknown>; | ||
failureMessages: Array<string>; | ||
fullName: string; | ||
invocations?: number; | ||
location?: CallSite | null; | ||
numPassingAsserts: number; | ||
status: Status; | ||
title: string; | ||
}; | ||
export declare const START_DIVIDER = "***************************START_JSON_DIVIDER***************************"; | ||
export declare const END_DIVIDER = "***************************END_JSON_DIVIDER***************************"; | ||
export default class SheetsReporter implements Reporter { | ||
onTestFileResult: undefined; | ||
onTestCaseResult: undefined; | ||
onTestFileStart: undefined; | ||
onRunStart(): void; | ||
onRunComplete(): void; | ||
getLastError(): void; | ||
onTestResult(_: Test, testResult: TestResult): void; | ||
onTestFileResult(test: Test, testResult: TestResult, aggregatedResult: AggregatedResult): void; | ||
onRunStart(results: AggregatedResult): void; | ||
onRunComplete(contexts: Set<Context>, results: AggregatedResult): void; | ||
onTestCaseResult(test: Test, testCaseResult: AssertionResult): void; | ||
onTestFileStart(test: Test): void; | ||
getLastError(): undefined; | ||
onTestResult(test: Test, testResult: TestResult): void; | ||
private render; | ||
onTestStart(test: Test): void; | ||
} | ||
export {}; |
@@ -7,19 +7,35 @@ "use strict"; | ||
class SheetsReporter { | ||
constructor() { | ||
this.onTestFileResult = undefined; | ||
this.onTestCaseResult = undefined; | ||
this.onTestFileStart = undefined; | ||
onTestFileResult(test, testResult, aggregatedResult) { | ||
this.render({ | ||
status: 'testFileResult', | ||
test, | ||
testResult, | ||
aggregatedResult, | ||
}); | ||
} | ||
onRunStart() { } | ||
onRunComplete() { } | ||
getLastError() { } | ||
onTestResult(_, testResult) { | ||
onRunStart(results) { | ||
this.render({ status: 'runStart', results }); | ||
} | ||
onRunComplete(contexts, results) { | ||
this.render({ status: 'runComplete', contexts, results }); | ||
} | ||
onTestCaseResult(test, testCaseResult) { | ||
this.render({ status: 'testCaseResult', test, testCaseResult }); | ||
} | ||
onTestFileStart(test) { | ||
this.render({ status: 'testFileStart', test }); | ||
} | ||
getLastError() { | ||
return undefined; | ||
} | ||
onTestResult(test, testResult) { | ||
this.render({ status: 'testResult', test, testResult }); | ||
} | ||
render(obj) { | ||
console.log(exports.START_DIVIDER); | ||
console.log(JSON.stringify({ status: 'testComplete', results: testResult })); | ||
console.log(JSON.stringify(obj)); | ||
console.log(exports.END_DIVIDER); | ||
} | ||
onTestStart(test) { | ||
console.log(exports.START_DIVIDER); | ||
console.log(JSON.stringify({ status: 'testStart', test })); | ||
console.log(exports.END_DIVIDER); | ||
this.render({ status: 'testStart', test }); | ||
} | ||
@@ -26,0 +42,0 @@ } |
@@ -0,1 +1,8 @@ | ||
# [2.0.0](https://github.com/sprucelabsai/jest-json-reporter/compare/v1.0.1...v2.0.0) (2020-10-23) | ||
### Breaking Changes | ||
* more direct mapping to jest reporter interfaces ([8d652c6](https://github.com/sprucelabsai/jest-json-reporter/commit/8d652c6)) | ||
## [1.0.1](https://github.com/sprucelabsai/jest-json-reporter/compare/v1.0.0...v1.0.1) (2020-10-21) | ||
@@ -2,0 +9,0 @@ |
@@ -9,3 +9,3 @@ { | ||
], | ||
"version": "1.0.1", | ||
"version": "2.0.0", | ||
"main": "./build/JsonReporter.js", | ||
@@ -12,0 +12,0 @@ "types": "./build/JsonReporter.d.ts", |
Sorry, the diff of this file is not supported yet
7788
86