11/* eslint-disable no-undef */
22import {
3- AllureGroup , AllureRuntime , AllureStep , AllureTest , ContentType , ExecutableItemWrapper ,
4- isPromise , LabelName , Severity , Stage , Status , AllureInterface , GlobalInfoWriter
3+ AllureGroup , IAllureRuntime , AllureStep , AllureTest , ContentType , ExecutableItemWrapper ,
4+ isPromise , LabelName , Severity , Stage , Status , GlobalInfoWriter , Allure , StepInterface
55} from "allure-js-commons" ;
66import FailedExpectation = jasmine . FailedExpectation ;
77
@@ -22,7 +22,7 @@ export class JasmineAllureReporter implements jasmine.CustomReporter {
2222 private stepStack : AllureStep [ ] = [ ] ;
2323 private runningExecutable : ExecutableItemWrapper | null = null ;
2424
25- constructor ( private readonly runtime : AllureRuntime ) {
25+ constructor ( private readonly runtime : IAllureRuntime ) {
2626 this . installHooks ( ) ;
2727 }
2828
@@ -37,7 +37,7 @@ export class JasmineAllureReporter implements jasmine.CustomReporter {
3737 return currentGroup ;
3838 }
3939
40- getInterface ( ) : AllureInterface {
40+ getInterface ( ) : Allure {
4141 return new JasmineAllureInterface ( this ) ;
4242 }
4343
@@ -238,62 +238,19 @@ export class JasmineAllureReporter implements jasmine.CustomReporter {
238238}
239239
240240
241- export class JasmineAllureInterface extends AllureInterface {
241+ export class JasmineAllureInterface extends Allure {
242242 constructor ( private readonly reporter : JasmineAllureReporter ) {
243243 super ( ) ;
244244 }
245245
246- private get currentExecutable ( ) : ExecutableItemWrapper {
246+ protected get currentExecutable ( ) : ExecutableItemWrapper {
247247 return this . reporter . currentStep
248248 || this . reporter . currentExecutable
249249 || this . reporter . currentTest ;
250250 }
251251
252- setDescription ( text : string ) {
253- this . currentExecutable . description = text ;
254- this . currentExecutable . descriptionHtml = text ;
255- }
256-
257- setFlaky ( ) {
258- this . currentExecutable . detailsFlaky = true ;
259- }
260-
261- setKnown ( ) {
262- this . currentExecutable . detailsKnown = true ;
263- }
264-
265- setMuted ( ) {
266- this . currentExecutable . detailsMuted = true ;
267- }
268-
269- addOwner ( owner : string ) {
270- if ( this . reporter . currentTest === null ) throw new Error ( "No test running!" ) ;
271- this . reporter . currentTest . addLabel ( LabelName . OWNER , owner ) ;
272- }
273-
274- setSeverity ( severity : Severity ) {
275- if ( this . reporter . currentTest === null ) throw new Error ( "No test running!" ) ;
276- this . reporter . currentTest . addLabel ( LabelName . SEVERITY , severity ) ;
277- }
278-
279- addIssue ( issue : string ) {
280- if ( this . reporter . currentTest === null ) throw new Error ( "No test running!" ) ;
281- this . reporter . currentTest . addLabel ( LabelName . ISSUE , issue ) ;
282- }
283-
284- addTag ( tag : string ) {
285- if ( this . reporter . currentTest === null ) throw new Error ( "No test running!" ) ;
286- this . reporter . currentTest . addLabel ( LabelName . TAG , tag ) ;
287- }
288-
289- addTestType ( type : string ) {
290- if ( this . reporter . currentTest === null ) throw new Error ( "No test running!" ) ;
291- this . reporter . currentTest . addLabel ( LabelName . TEST_TYPE , type ) ;
292- }
293-
294- addLink ( name : string , url : string , type ?: string ) {
295- if ( this . reporter . currentTest === null ) throw new Error ( "No test running!" ) ;
296- this . reporter . currentTest . addLink ( name , url , type ) ;
252+ protected get currentTest ( ) : AllureTest {
253+ return this . reporter . currentTest ;
297254 }
298255
299256 private startStep ( name : string ) : WrappedStep {
@@ -302,7 +259,7 @@ export class JasmineAllureInterface extends AllureInterface {
302259 return new WrappedStep ( this . reporter , allureStep ) ;
303260 }
304261
305- step < T > ( name : string , body : ( ) => any ) : any {
262+ step < T > ( name : string , body : ( step : StepInterface ) => any ) : any {
306263 const wrappedStep = this . startStep ( name ) ;
307264 let result ;
308265 try {
@@ -326,21 +283,15 @@ export class JasmineAllureInterface extends AllureInterface {
326283 }
327284 }
328285
286+ logStep ( name : string , status ?: Status ) : void {
287+ this . step ( name , ( ) => { } ) ; // todo status
288+ }
289+
329290 attachment ( name : string , content : Buffer | string , type : ContentType ) {
330291 const file = this . reporter . writeAttachment ( content , type ) ;
331292 this . currentExecutable . addAttachment ( name , type , file ) ;
332293 }
333294
334- addParameter ( name : string , value : string ) : void {
335- if ( this . reporter . currentTest === null ) throw new Error ( "No test running!" ) ;
336- this . reporter . currentTest . addParameter ( name , value ) ;
337- }
338-
339- addLabel ( name : string , value : string ) : void {
340- if ( this . reporter . currentTest === null ) throw new Error ( "No test running!" ) ;
341- this . reporter . currentTest . addLabel ( name , value ) ;
342- }
343-
344295 getGlobalInfoWriter ( ) : GlobalInfoWriter {
345296 return this . reporter . getGlobalInfoWriter ( ) ;
346297 }
@@ -362,7 +313,7 @@ class WrappedStep { // needed?
362313 this . step . endStep ( ) ;
363314 }
364315
365- run < T > ( body : ( ) => T ) : T {
316+ run < T > ( body : ( step : StepInterface ) => T ) : T {
366317 return this . step . wrap ( body ) ( ) ;
367318 }
368319}
0 commit comments