import 'mocha' ; import { expect , ifExitCodeIsOtherThan , logOutput , PickEvent } from '@integration/testing-tools' ; import { SceneFinished , SceneStarts , SceneTagged , TestRunFinished , TestRunFinishes , TestRunnerDetected , TestRunStarts } from '@serenity-js/core/lib/events' ; import { ExecutionSuccessful , FeatureTag , Name , Timestamp } from '@serenity-js/core/lib/model' ; import { jasmine } from '../src/jasmine' ; describe ( '@serenity-js/jasmine' , function ( ) { this . timeout ( 5000 ) ; it ( 'recognises a passing scenario' , ( ) => jasmine ( 'examples/passing.spec.js' ) . then ( ifExitCodeIsOtherThan ( 0 , logOutput ) ) . then ( res => { expect ( res . exitCode ) . to . equal ( 0 ) ; PickEvent . from ( res . events ) . next ( TestRunStarts , event => expect ( event . timestamp ) . to . be . instanceof ( Timestamp ) ) . next ( SceneStarts , event => expect ( event . details . name ) . to . equal ( new Name ( 'A scenario passes' ) ) ) . next ( SceneTagged , event => expect ( event . tag ) . to . equal ( new FeatureTag ( 'Jasmine' ) ) ) . next ( TestRunnerDetected , event => expect ( event . name ) . to . equal ( new Name ( 'Jasmine' ) ) ) . next ( SceneFinished , event => expect ( event . outcome ) . to . equal ( new ExecutionSuccessful ( ) ) ) . next ( TestRunFinishes , event => expect ( event . timestamp ) . to . be . instanceof ( Timestamp ) ) . next ( TestRunFinished , event => expect ( event . timestamp ) . to . be . instanceof ( Timestamp ) ) ; } ) ) ; } ) ;