问题标签 [chutzpah]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
376 浏览

qunit - chutzpah 可以从 url 运行 qunit 测试吗?

Chutzpah 可以从 url 运行 qunit 测试吗?在我的 qunit 测试中,我需要大量服务器端注入的标记和 json 数据,因此我喜欢在本地主机上的 Visual Studio 项目中运行测试套件,而不是在我的 test.js 文件中模拟大量测试数据。

0 投票
3 回答
2917 浏览

javascript - 使用 Chutzpah 和 requirejs 测试 javascript

我只是想知道是否有一个简单的教程展示了如何在 Visual Studio 中使用 Chutzpah、require.js 和 jasmine 测试 javascript。

基本上,我想在不使用 .html 文件的情况下运行测试,这样我就可以在 vs 测试资源管理器中看到结果。

0 投票
1 回答
582 浏览

javascript - PhantomJS Cookies

I'm trying to run some QUnit test cases with phantomJS and chutzpah console. I'm having difficulties communicate with the phantomJS cookies. My test case runs perfectly with the browser communicating with the but not with phantomJS as it gives an error with the cookie.

Does the phantomJS deals with Cookies in a different pattern than the other browsers? any suggestions?

0 投票
2 回答
2432 浏览

javascript - phantomJS 是否支持地理位置?

我正在尝试使用 PhantomJS 运行 qunit 测试用例。当 phantomJS 尝试访问 DOM 的 navigator.geolocation 函数时,我的一项测试正在进行中。同样的测试在浏览器中运行良好,只是挂在带有 phantomJS 的控制台中。

phantomJS 是否支持地理位置?有什么建议吗?

在以下 if 条件下中断

0 投票
1 回答
338 浏览

javascript - 有没有办法在 chutzpah 中执行 phantomJS 语句?

我正在运行一些 Qunit 测试来测试框架。当我的测试挂在那里时,我无法从 phantomJS 获取 cookie。它无法读取 cookie。

我尝试使用 phantom.cookies 函数获取 fetch phantom cookies,但 chutzpah 不执行这些语句?我有办法用 chutzpah 获取幻影饼干吗?

0 投票
1 回答
1886 浏览

javascript - How to load a public function using QUnit and TypeScript

I am using QUnit to test my typescript code and everything is fine when I run a simple example like this: http://thomasardal.com/testing-typescript-with-typescript-using-qunit-and-chutzpah/

But my nightmare start when I try create unit tests for my SPA app. At the moment to run the testing using Chutzpah on my VS I got a strange error: "Can't Find variable home in mypath\home.tests.ts(line6).

My Code bellow:

home.ts

home.tests.ts

here you are my typeScript settings: setting for typescript

any idea what is wrong with my code?

UPDATE 1 The complete message from output windows in Vs2012 is:

Test 'home.ts tests:test activate function from home viewmodel' failed Died on test #1 at file:///C:/Users/rolando/AppData/Local/Microsoft/VisualStudio/11.0/Extensions/kyo4ap1e.tvo/TestFiles/QUnit/qunit.js:412 at file:///D:/Mercatus/SourceCode/KILN/AquaVet2/SW/AquaVet.Web/App/viewmodels/_Chutzpah.7.home.tests.js:6: Can't find variable: home in D:\Mercatus\SourceCode\KILN\AquaVet2\SW\AquaVet.Web\App\viewmodels\home.tests.ts (line 6)

0 passed, 1 failed, 1 total (chutzpah).

UPDATE 2 As you see in the code i am trying load home.ts using the keyword module("home").... I am not sure if that could be the reason of my problems. A better solution could be add a internal reference to home.ts

Adding home.ts as internal reference

but i don't know how I can reference to activate function !!.

0 投票
3 回答
7695 浏览

asp.net-mvc - Jasmine 在一个单独的测试项目中

将茉莉花测试分离到单独的视觉工作室项目中是否可行/可行?

我刚刚开始使用 Angular,并且在开始实际的 Angular 实现之前尝试编写我的测试。我将在Visual Studio 2012中使用Chutzpah 测试运行程序编写我的项目,请参阅此视频。目前,我正在尝试弄清楚如何组织我的文件夹结构。我知道 angular-seed 和 yeoman,但它们不适合启动 .net 项目。

我假设由于 Visual Studio 中的单元测试通常被分成一个单独的测试项目,按照惯例,茉莉花测试也应该这样做。

但是,对于 java 脚本,没有要引用的项目 dll,因此我认为将测试分离到不同的项目中需要大量的复制和粘贴。

0 投票
1 回答
728 浏览

extjs - 使用 ExtJS 的 Chutzpah 测试适配器问题 - 在浏览器中工作。不在IDE中

尝试使用 Chutzpah 和 Jasmine 对 ExtJS 应用程序进行单元测试。在 VS 2012 中检测到测试并显示在测试资源管理器中。附加的示例在浏览器中运行时通过。但是,在 IDE 中运行它,我的商店测试失败了。现在 Ext 创建了一个单例应用程序对象 (v 4.1.3) 并正在创建一个 Chutzpah 可以看到的应用程序特定名称空间,但是一旦我尝试从名称空间加载控制器,AppName.app.getController('My.controller.Controller ') 没有说它未定义。

app_jasmine.js

SpecRunner.html

MySpecs.specs.js

现在显然这里有两种情况。浏览器和无头,因为这是执行之间的唯一差异。我会很感激任何想法。

0 投票
1 回答
490 浏览

javascript - Resharper Ajax 设置不安全的标头

我从 ResharperAjax.cs 中设置的东西中得到一个 javascript 异常,但不知道如何解决它

在 ResharperAjax.cs 中似乎导致问题的行是:

setRequestHeader 方法导致异常(拒绝设置不安全的标头 - 用户代理)。

当我尝试使用 Chutzpah 和 Sinon.js 运行一些基本的 JS 单元测试时,就会发生这种情况。

有任何想法吗?

0 投票
1 回答
709 浏览

javascript - Chutzpah 控制台运行程序默默地失败

刚开始用 require 获取 Chutzpah(这很有趣)。

我现在遇到的问题是,如果有一个 javascript 错误,它似乎会失败而没有选择任何测试。但是,当在调试模式下运行时,它似乎会在调试中拾取它们。

有什么办法可以解决这个问题。这是我的测试运行的输出。正在测试的 js 文件之一中出现“未定义”错误