Logging from grunt-contrib-jasmine

只谈情不闲聊 提交于 2019-12-30 16:25:10

问题


I'm using grunt-contrib-jasmine to run my javascript specs. How do I write debug output to the console when running specs i.e. how do I get

console.log("something");

to show output in the console? I do find that I can get output by running:

 $ grunt jasmine --verbose

But this prints a lot of information that I'm not interested in. How can I just see the output from console.log ?


回答1:


Use console.info instead of console.log




回答2:


Not a solution but a work around (sort of). Put in a expect("something").toBe(null); This will make jasmine to write out an error message like: Expected 'something' to be null. This way you can peek into objects (expect(element).toBe(null);)




回答3:


You can also use dump(variable) or console.log(variable). Source is the excellent Year of Moo.



来源:https://stackoverflow.com/questions/14990335/logging-from-grunt-contrib-jasmine

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!