Tag: qunit

麻烦运行使用grunt静态服务器的Qunittesting

通过networking浏览器运行testing工作正常,但使用grunt给我错误。 我很难理解我在这里做错了什么。 grunt tests失败 $ grunt tests Running "jsonlint:sample" (jsonlint) task >> 4 files lint free. Running "jshint:all" (jshint) task >> 4 files lint free. Running "connect:server" (connect) task Started connect web server on http://localhost:5000 Running "qunit:all" (qunit) task Testing http://localhost:5000/tests/tests.html F >> Settings.json tests – Fetching settings file >> Message: InvalidStateError: DOM Exception 11: […]

使用jasmine和grunt对多个版本的jquery进行testing

我已经写了一个jQuery插件的茉莉花testing,我想自动testing我声称支持的每个版本的jQuery。 我已经设置了使用grunt-jasmine-runner运行单个版本的jquery的testing,但是我怎样才能多次运行jasmine任务,每个版本的jquery一次呢? 也可以用qunit吗?

node.jsasynchronoussubprocesstesting

我在node.js中做了第一步,想testing我的代码,但是我被卡住了。 我使用node-qunit库作为testing工具。 这是我的代码: var spawn = require('child_process').spawn; var ok = require('assert').ok; function _call_gpg(stdin_pass, passphrase, decrypt, callback) { ok(stdin_pass); ok(passphrase); var buffers = []; var gpg = spawn('gpg', ['–passphrase', passphrase, decrypt ? '-d' : '-c', '–no-use-agent']); gpg.stdout.on('data', function(data) { buffers.push(data); }); gpg.on('exit', function(return_code) { callback(return_code === 0 ? Buffer.concat(buffers) : undefined); }); gpg.stdin.write(stdin_pass); gpg.stdin.end(); } function […]

将节点命令作为咕噜驱动的QUnittesting的一部分运行

我正在使用grunt来打包我的jQuery插件。 作为QUnittesting的一部分,我需要在testing开始之前运行一个节点命令,以获得一致的结果(类似于process.env.TZ = 'Europe/London'因为我的插件处理时区,所以结果会有所不同不同的时区)。 所以我的问题是:如何运行一个特定于节点的命令作为qunittesting的一部分? 谢谢。

如何使用单个命令运行多个QUnit(node.js)testing文件?

脚本 我们正在尝试在我们的服务器端testing中使用Node.js QUnit模块 qunitjs ,以便我们可以编写一个testing并在服务器和客户端上运行它,例如: https : //github.com/nelsonic/learn-tdd/斑点/主/ test.js 当我们使用以下命令运行单个文件时: node test/my_test.js 它按预期工作。 但是,如果在/ test 目录中有多个testing,并尝试使用以下命令将所有文件作为套件运行: node test/*.js 只有第一个文件( 按字母顺序 )被执行。 请参阅: https : //github.com/nelsonic/hapi-socketio-redis-chat-example/tree/master/test 题 我们如何用一个命令 执行多个testing文件 ? 我们试图挖掘现有的StackOverflow + GitHub Q / A,但没有find任何匹配。 ( 任何build议/帮助非常感谢! )

未被捕获的exception与qunit和jquery

我正在尝试使用qunit获取javascriptunit testing在命令行上工作时遇到问题。 以下是一些重现错误的示例代码: 文件util.js : function abc() { return 'abc'; } if (typeof module !== 'undefined' && module.exports) { module.exports = { abc: abc }; } 文件util-tests.js var qunit = require("qunit"); test("Test abc function", function () { equal(util.abc(), 'abc'); }); 使用这些文件,我可以使用以下命令运行testing(在testing结果中在shell中提供了一个类似于表的输出): qunit -c util:util.js -t util-tests.js 现在,如果我将以下内容添加到util.js,就会中断 $(document).ready(function () { /* some code here */ […]

节点qunit不包括我的源文件在范围内

我已经从npm安装了node-qunit(stable),但似乎无法得到任何testing工作。 我的源文件似乎不包括在范围内。 ./source/myscript.js: var myObj = { a : true } ./test/tests.js: test("that a is true", function () { ok(myObj.a); }); ./test/runner.js: var runner = require('qunit'); runner.run({ code : './source/myscript.js', tests : './test/tests.js' }); ./Makefile: test : <tab>node ./test/testrunner.js .PHONY: install test 如果我运行make test ,会得到一个'ReferenceError: myObj is not defined'错误。 源文件确实运行,因为它可能会引发错误。 它似乎并不像它应该包含在全球范围内。 如果我从命令行执行它,按照node-qunit自述文件中的说明进行操作将不起作用 。 任何人有任何想法如何得到这个工作?