UNPKG

siesta-lite

Version:

Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers

55 lines (42 loc) 1.49 kB
var project = new Siesta.Project.Browser() var log = function(text) { if (window.console && console.log) { console.log(text); } } project.configure({ title : 'Listening project event', preload : [ 'project-events/preload.js' ], recorderClass : 'CustomRecorder', recorderConfig : {}, // can provide single event handlers in the special "listeners" config listeners : { testsuitestart : function (event, project) { log('Test suite is starting: ' + project.title) }, testsuiteend : function (event, project) { log('Test suite is finishing: ' + project.title) }, teststart : function (event, test) { log('Test case is starting: ' + test.url) }, testupdate : function (event, test, result) { log('Test case [' + test.url + '] has been updated: ' + result.description + (result.annotation ? ', ' + result.annotation : '')) }, testfailedwithexception : function (event, test) { log('Test case [' + test.url + '] has failed with exception: ' + test.failedException) } } }) // or can subscribe manually project.on('testfinalize', function (event, test) { log('Test case [' + test.url + '] has completed') }) project.plan( 'project-events/sanity.t.js', 'project-events/basics.t.js', 'project-events/custom-recorder.t.js' ) project.start()