问题描述
我只是想知道是否有一个简单的教程,展示了如何使用Chutzpah,require.js和jasmine在visual studio中测试javascript。
I just wonder if there is a simple tutorial showing how to test javascript in visual studio with Chutzpah, require.js and jasmine.
基本上,我想在不使用.html文件的情况下运行测试,这样我就可以在vs test explorer中看到结果。
Basically, i want to run the tests without using an .html file so that i can see the results in the vs test explorer.
推荐答案
您可以在此处找到一些示例代码:
You can find some sample codes here:https://chutzpah.codeplex.com/SourceControl/latest#Samples/RequireJS/Jasmine/tests/base/base.jasmine.test.js
请注意,如果你想在chutzpah和Jasmine中使用requirejs,你需要在chutzpah.json中将TestHarnessReferenceMode设置为AMD。否则测试将不会在浏览器中运行。
Please note if you want to use requirejs with Chutzpah and Jasmine, you need to set TestHarnessReferenceMode to AMD in chutzpah.json. Otherwise the tests won't be ran in browser.
{
"Framework": "jasmine",
"TestHarnessReferenceMode": "AMD",
"TestHarnessLocationMode": "SettingsFileAdjacent",
"References": [
{ "Path": "require-2.1.8.js" },
{ "Path": "config.js" }
],
"Tests": [
{ "Path": "tests" }
]
}
这篇关于使用Chutzpah和requirejs测试javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!