Tag: 茉莉花节点

我如何正确地失败茉莉节点中的asynchronousunit testing

为什么下面的代码失败,超时? 它看起来像“应该”抛出一个错误,done()永远不会被调用? 我如何编写这个testing,以便它正确地失败,而不是茉莉花报告超时? var Promise = require('bluebird'); var should = require('chai').should(); describe('test', function () { it('should work', function (done) { Promise.resolve(3) .then(function (num) { num.should.equal(4); done(); }); }); }); 控制台输出是: c:> jasmine-node spec \ 未处理的拒绝AssertionError:预期3到等于4 …失败:1)testing应该工作消息:超时:超过5000毫秒后超时等待规范完成

Node.JS +茉莉花+量angular器

有 ActionManager.js从文件夹中读取所有可能的testing函数的文件(库) WorkflowManager.js读取具有所需testing描述的文件(testing工作stream程)。 每个文件都包含动作和参数数组。 TestsRunner.js需要并运行ActionManager和WorkflowManager。 之后,我想用参数运行每个testing工作stream的动作(执行Jasminetesting)。 如何使这个过程严重执行? 我试图实现亚军作为: 在描述块之前调用require,所以Jasmine的testing在此之前运行 把要求放在beforeEach之前 ,所以在执行它之前每个被调用() ; 所以我知道需要和获得stream数组之后循环它的stream的数量; 但是当它执行时,它应该已经从已经定义的循环迭代中被调用 我把它的模拟描述块()用于主要描述下的初始化,但是在这种情况下,循环为()得到stream量的量化为0,并且这之后所有描述开始执行并且量被初始化 我将这两个描述都包含在其他描述之间 – > 描述和描述之间的代码, 描述和循环的内部不执行。 以下是只需要WorkflowManager的代码部分,并且在每次迭代时使用控制台输出循环执行工作stream数组大小。 var firstTime = true; beforeEach(function() { if (firstTime) { var flow = protractor.promise.controlFlow(); flow.execute(function() { console.log("I'm beforeach part#1"); path = require("path"); testsPath = path.resolve("./e2e/tests/"); //requiring WorkflowManager wfMng = require('./utils/WorkflowManager.js'); }).then(function() { console.log("I'm beforeeach part#2"); […]

在Webstorm / Intellij中debuggingCoffeescript jasmine-nodetesting

我正在使用节点 – 茉莉花2testing版,并写在咖啡的脚本。 我很高兴地在Intellij 13.1中运行testing,并设置了以下运行configuration Node interpreter: /usr/local/bin/node Working Dir: [Project Directory] Javascript File: node_modules/jasmine-node/bin/jasmine-node Application Parameters: –coffee –verbose spec 我也为我所有的coffeescript文件设置了文件监视器,并且它们正在正确构build并放入[Project Directory]/.build /。build子目录 大! 但是在debugging时设置断点不起作用。 发回给Intellij的信息似乎引用了javascript文件,给出了我所看到的行号,表明sourcemaps没有被正确引用。 谁能帮忙? (目前我通过添加一个debugger语句,而不是intellij的断点)

node.js僵尸无头浏览器不加载url

工具 Linux ubuntuG5 3.13.0-48-powerpc64-smp node.js v0.10.38 僵尸版本3.1.0 2015-03-15 茉莉花节点1.14.3 sample_zombie_spec.js var Browser, assert, browser, url, title; assert = require('assert'); Browser = require('zombie'); var google = "https://google.com" var google_title = "Google" url = google title = google_title browser = new Browser(); describe('home page', function() { describe('title', function() { it('should have a title', function(done) { browser.visit(url).then(function() { […]

茉莉花节点没有显示testing结果

我正在使用jasmine-node为我的node.js应用程序运行testing。 问题是,如果我运行指定文件( jasmine-node spec/file.spec.js )一个接一个的testing – 那么一切看起来不错 – 我得到(作为一个例子)的输出,如Finished in 0.049 seconds 4 tests, 19 assertions, 1 failure, 0 skipped 。 但是,如果我只是通过input命令jasmine-node spec/运行testing,我没有得到如上所述的结果,我看不到哪些testing失败或成功。 有谁知道如何解决这个问题? (我使用node.js版本0.12.7和茉莉花节点1.14.3)

如何使用jasmine-node在Node.js中模拟seneca调用?

我使用express模块​​,下面是app.js的代码 app.post('/test_url', function(request, response){ seneca.client({type: 'http',port: '3000',host: 'localhost',protocol: 'http'}).act({role: 'sample_role', cmd: 'save',firstname: request.params.firstname}, function (err, result) { console.log("Inside Seneca act"); response.json(result); }) }); 以下是我正在编写上述代码的testing用例的testing文件。 describe("POST /test_url/:firstname", function() { it("should return status code 200", function(done) { <b>//here I want to mock the call for seneca.client so that I can test if the call has been made […]

Node.js:require语句中的相对path如何工作?

我正在使用茉莉花节点来运行茉莉花testing。 我的项目有一个典型的结构“spec”和“src”文件夹。 在我的“HelloSpec.js”文件里面我有: require('../src/Hello.js'); 但是,当我用这个命令从项目的根文件夹(即“spec”和“src”的父文件夹)运行testing时: jasmine-node spec/HelloSpec.js 我收到错误,指出require d文件实际上并没有被要求。 但是,如果我将require语句更改为: require('src/Hello.js'); 一切正常。 所以看起来require语句是parsing相对于执行testing的文件夹的path,而不是相对于它们自己的文件位置。 但是这对我来说没有意义。 “要求”中的相对path如何工作? 我需要做一些事情,让他们像我期望的那样工作吗? 谢谢!

当使用量angular器作为一个库时,'没有方法期待'

使用量angular器作为图书馆 无法要求参考茉莉花。 引用expect方法返回输出Cannot call method 'expect' of null 。 代码更新以反映评论: var protractor = require('protractor'); require('protractor/node_modules/minijasminenode'); require('protractor/jasminewd'); // output: jasmine is undefined (this error can only be seen if the above line is commented out) //expect(true).toBe(true); // output: Cannot call method 'expect' of null var driver = new protractor.Builder() .usingServer('http://localhost:4444/wd/hub') .withCapabilities(protractor.Capabilities .chrome()).build(); var ptor = protractor.wrapDriver(driver); […]

特拉维斯build设不正确完成

我试图设置一个travis版本,除了testing脚本没有完全执行。 它开始,但是特拉维斯说,当它仍然在运行中时,它退出代码0。 这是travis页面。 我使用茉莉花节点来运行testing,并在我的电脑上工作得很好。 让我知道如果我错过了任何重要的信息。 谢谢, -tlf

如何在茉莉花需要的时候把它expression出来?

我试图得到下面的代码,当我发现我已经包含在这个文件的顶部。 你可以在猴子已经加载后如何修补快递对象吗? var express = require('express') Helper = (function() { var HelperObject = function(params) { this.directories = params.directories; }; HelperObject.prototype.addStaticPath = function(app) { for(i = 0; i < this.directories.length; i++) { var static = express.static('/public'); app.use(static); } }; return HelperObject; })();