[英]How to debug Javascript test files in the browser using gulp test and karma
I wrote a javascript test using the jasmine framework, and I run my tests using with "gulp test". 我使用jasmine框架编写了一个javascript测试,并使用“gulp test”运行我的测试。 Below is my test.js
下面是我的test.js
gulp.task('test', function(done) {
new Karma({
configFile: __dirname + '/../../karma.conf.js',
singleRun: false
}, done).start();
});
My question is what do i have to do so that i can debug my test file? 我的问题是我必须做什么才能调试我的测试文件? I want to be able to walk through the test file line by line?
我希望能够逐行浏览测试文件? Is there any property in karma.conf.js that i have to manipulate to be able to do this?
在karma.conf.js中是否有任何属性我必须操纵才能做到这一点?
You have a good start changing singleRun
to false. 你有一个良好的开端将
singleRun
更改为false。
Put a debugger
in where you want it to stop. 将
debugger
放在您希望停止的位置。
Then run gulp test
to get the browser open. 然后运行
gulp test
以打开浏览器。
Open Chrome Dev Tool. 打开Chrome开发工具。
Run again, it should stop at the debugger. 再次运行,它应该停在调试器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.