nodeunit

    0熱度

    1回答

    我有我的測試自定義咕嚕任務nodeunit測試:基於 nodeunit documentation 'use strict'; var grunt = require('grunt'); exports.when_executing_single_command = { it_should_execute_successfully: function(test) {

    1熱度

    1回答

    過去幾天我已經發布了一些問題,這些問題太長了(我猜測是因爲我沒有收到任何非隱含的反饋)。我試圖做這個簡短的。 以下代碼使用'setup-complete'事件來通知nodeunit setUp命令來運行測試。測試1次傳球,2測試失敗, 故障:而複測試(或它們的設置/拆解): - 基於事件的異步代碼 - test2的 有沒有在我的代碼中的一些錯誤呢? Nodeunit是測試基於事件的代碼的不錯選擇嗎

    2熱度

    1回答

    我想測試簡單的代碼: function div2(a, b) { return a/b; } module.exports.div = div2; 而且在examplesTestUnit.js文件: var calculator = require("./examples"); module.exports["div test"] = function(test) {

    1熱度

    1回答

    現在我有一個使用node.js和nodeunit的單元測試構建環境。非常滿意這些,但現在我需要TCO。我知道TCO已經加入到ES6標準中,但我不知道如何讓它用於我的項目。嘗試了和諧標誌,但無法使它與nodeunit一起工作。任何幫助? 上心這裏用和諧: Node.js tail-call optimization: possible or not? 我喜歡這些傢伙的思維方式,但我不能做的第一答案,

    1熱度

    1回答

    我想編寫一個輔助函數,該函數既可以聲明給定的測試函數作爲參數,也可以默認調用assert.equal。除去test.expect當Expected 1 assertions, 0 ran var assert = require('nodeunit').assert; var interpretTest = function(expression, expected, testFunction

    0熱度

    1回答

    我正在研究一個現有的節點項目,其中大多數js文件的代碼結構如下所示。 var mod1 = require("mod1"); var mod2 = require("mod2"); var modn = require("moden"); function func1(data, callback) { // Do some validation wi

    2熱度

    1回答

    我正在使用nodeunit對一些Javascript對象運行測試。在某些時候,我有去像這樣驗證: test.deepEqual(originalObject, testObject, 'Sentiment validation'); 我大約驗證的樣子,這些的對象: var originalObject = { "sentiments": [ { "sentime

    3熱度

    4回答

    我需要在nodeunit成功通過所有測試後運行一些代碼。 我正在測試一些Firebase包裝和Firebase參考塊在所有測試運行後退出nodeunit。 我正在尋找一些鉤子或回調,所有的單元測試通過後運行。所以我可以終止Firebase進程,以便nodeunit能夠退出。

    6熱度

    2回答

    如果我通過var a = sinon.createStubInstance(MyContructor)創建實例。 我該如何更換var stub = sinon.stub(object, "method", func);之類的殘存功能之一。 主要的原因,我這樣做是想實現多回調的解決方法爲this mentioned

    0熱度

    1回答

    我要用nodeunit來測試我的庫,並使用File對象,在網站上一切正常(FileAPI在那裏實現),但是當我試圖測試它時與nodeunit我得到一個錯誤: Fatal error: File is not defined 我以爲我要補充: var FileAPI = require('file-api'); var File = FileAPI.File; 的代碼的乞討,但我不需要,當我包