I have Jasmine with custom reporter
var myReporter = {
jasmineStarted: function(suiteInfo) {
console.log('Running suite with ' + suiteInfo.totalSpecsDefined);
},
suiteStarted: function(result) {
console.log('Suite started: ' + result.description + ' whose full description is: ' + result.fullName);
},
specStarted: function(result) {
console.log('Spec started: ' + result.description + ' whose full description is: ' + result.fullName);
},
specDone: function(result) {
console.log('Spec: ' + result.description + ' was ' + result.status);
for(var i = 0; i < result.failedExpectations.length; i++) {
console.log('Failure: ' + result.failedExpectations[i].message);
console.log(result.failedExpectations[i].stack);
}
},
suiteDone: function(result) {
console.log('Suite: ' + result.description + ' was ' + result.status);
for(var i = 0; i < result.failedExpectations.length; i++) {
console.log('AfterAll ' + result.failedExpectations[i].message);
console.log(result.failedExpectations[i].stack);
}
},
jasmineDone: function() {
console.log('Finished suite');
}
};
jasmine.getEnv().addReporter(myReporter);
describe('Top Level suite', function() {
it('spec', function() {
expect(1).toBe(1);
});
describe('Nested suite', function() {
it('nested spec', function() {
expect(true).toBe(true);
});
});
});
live: http://jsfiddle.net/wLnmbh88/
Now results show on html and console but I need turn off this in html. How can I show test results only in console? Code example is from jasmine documentation.
No need to remove jasmine-html.js
and fiddle with a custom boot.js
. Just remove any reporters before adding your reporter of choice:
var jasmineReporters = require('jasmine-reporters');
jasmine.getEnv().clearReporters();
jasmine.getEnv().addReporter(new jasmineReporters.TapReporter());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With