Jasmine有iit()
和ddescribe
,Mocha有it.only
和describe.only
,但我看不出有什么方法可以让 QUnit 专注于运行单个测试。
QUnit UI 允许您运行单个测试,但我看不出如何让它在 Karma 中运行,因为它不显示 QUnit UI。
最佳答案
这是我的解决方案。它对我来说很好用,但是 YMMV。
从 here 下载 qunit-karma-setup.js, qunit-karma-launch.js
然后,在你的 Gruntfile 中:
config.set({
frameworks: ['qunit'],
files: [
'your-app-files-here/**/*.js',
'qunit-karma-setup.js',
'your-tests-here/**/*.js',
'qunit-karma-launch.js'
]
});
现在,您可以使用 omodule()、otest()、oasyncTest() 函数分别仅运行选定的模块或测试。
关于testing - 是否可以在 Karma 中使用 QUnit 运行单个测试?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18975998/