使WebStorm Karma对象和数组输出更易于阅读

时间:2015-12-27 20:03:29

标签: karma-runner webstorm

所以,当我在WebStorm中使用Karma运行测试时(只需右键单击karma.conf.js文件然后选择“运行karma.conf.js。”)它有一个非常漂亮的图形用户界面排序所有通过和失败的测试,这就是为什么我喜欢它,但当你测试一个算法来排序大数组和对象时失败的反馈是一个可怕的blob:

> Expected [ [ Object({ id: 70111470, title: 'Die Hard', time: Object({
> type: 'End', time: 213432 }), url: Object({ width: 150, height: 200,
> url: 'http://cdn-0.nflximg.com/images/2891/DieHard150.jpg' }) }),
> Object({ id: 70111470, title: 'Die Hard', time: Object({ type:
> 'Start', time: 64534 }), url: Object({ width: 200, height: 200, url:
> 'http://cdn-0.nflximg.com/images/2891/DieHard200.jpg' }) }) ], [
> Object({ id: 654356453, title: 'Bad Boys', time: Object({ type: 'End',
> time: 54654754 }), url: Object({ width: 200, height: 200, url:
> 'http://cdn-0.nflximg.com/images/2891/BadBoys200.jpg' }) }), Object({
> id: 654356453, title: 'Bad Boys', time: Object({ type: 'Start', time:
> 43524243 }), url: Object({ width: 140, height: 200, url:
> 'http://cdn-0.nflximg.com/images/2891/BadBoys140.jpg' }) }) ], [
> Object({ id: 65432445, title: 'The Chamber', time: Object({ type:
> 'End', time: 132423 }), url: Object({ width: 130, height: 200, url:
> 'http://cdn-0.nflximg.com/images/2891/TheChamber130.jpg' }) }),
> Object({ id: 65432445, title: 'The Chamber', time: Object({ type:
> 'Start', time: 54637425 }), url: Object({ width: 200, height: 200,
> url: 'http://cdn-0.nflximg.com/images/2891/TheChamber200.jpg' }) }) ],
> [ Object({ id: 675465, title: 'Fracture', time: Object({ type: 'End',
> time: 45632456 }), url: Object({ width: 200, height: 200, url:
> 'http://cdn-0.nflximg.com/images/2891/Fracture200.jpg' }) }), Object({
> id: 675465, title: 'Fracture', time: Object({ type: 'Start', time:
> 234534 }), url: Object({ width: 120, height: 200, url:
> 'http://cdn-0.nflximg.com/images/2891/Fracture120.jpg' }) }), Object({
> id: 675465, title: 'Fracture', time: Object({ type: 'Middle', time:
> 3453434 }), url: Object({ width: 300, height: 200, url:
> 'http://cdn-0.nflximg.com/images/2891/Fracture300.jpg' }) }) ] ] to
> equal [ Object({ id: 70111470, title: 'Die Hard', time: 323133, url:
> 'http://cdn-0.nflximg.com/images/2891/DieHard150.jpg' }), Object({ id:
> 654356453, title: 'Bad Boys', time: 6575665, url:
> 'http://cdn-0.nflximg.com/images/2891/BadBoys140.jpg' }), Object({ id:
> 65432445, title: 'The Chamber', time: 3452343, url:
> 'http://cdn-0.nflximg.com/images/2891/TheChamber130.jpg' }), Object({
> id: 675465, title: 'Fracture', time: 323133, url:
> 'http://cdn-0.nflximg.com/images/2891/DieHard150.jpg' }) ].

是否有插件,设置或简单的黑客可以使这个更有条理,更容易阅读?

0 个答案:

没有答案