Redirect calls to console.log() to standard output in Jasmine tests

后端 未结 8 1616
名媛妹妹
名媛妹妹 2021-02-02 05:00

I\'m using Jasmine via the jasmine-maven-plugin, and I would like to see console.log() messages in the Maven build output. Is there a way to achieve this?

If console.log

8条回答
  •  眼角桃花
    2021-02-02 05:39

    I think it is not possible.

    I had to overwrite the console.log implementation in the spec loader. i.e (using jQuery):

    var console = {
        panel: $('body').append('
    ').css({position:'fixed', top:0, right:0,background:'transparent'}), log: function(m){ this.panel.prepend('
    '+m+'
    '); } }; console.log('message 1'); console.log('message 2');

    ​ here your have a functional example

提交回复
热议问题