qunit

How do I extend QUnit with new assertion functions?

故事扮演 提交于 2020-01-13 09:22:29
问题 I'd like to add new assertions to QUnit. I've done something this: QUnit.extend(QUnit.assert, { increases: function(measure, block, message){ var before = measure(); block(); var after = measure(); var passes = before < after; QUnit.push(passes, after, "< " + before, message); } }); When I use increases(foo,bar,baz) in my test, I get ReferenceError: increases is not defined From the browser console I can see increases is found in QUnit.assert along with all the other standard functions: ok ,

ember testing Error Adapter operation failed

元气小坏坏 提交于 2020-01-13 07:06:49
问题 My test is pretty simple. It was working before but now I have facing a new issue I am getting failure message Adapter operation failed at http://localhost:4200/assets/test-support.js:4578:13 at exports.default._emberTestingAdaptersAdapter.default.extend.exception (http://localhost:4200/assets/vendor.js:52460:34) at onerrorDefault (http://localhost:4200/assets/vendor.js:43162:24) at Object.exports.default.trigger (http://localhost:4200/assets/vendor.js:67346:11) at Promise._onerror (http:/

How to load a public function using QUnit and TypeScript

纵然是瞬间 提交于 2020-01-06 01:16:19
问题 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 import logger = module('services/logger'); export var title = 'Home View';

Testing Emberjs app using QUnit and Karma fails due to `ReferenceError: Faye is not defined`

旧时模样 提交于 2020-01-05 07:46:38
问题 I Was testing EmberJs application with Qunit and karma runner and it was working all good. Then I had to integrate faye into the application which went well but then on running my test suite, it shows following error and crashes: ReferenceError: Faye is not defined The error is thrown where, I am defining the client in emberjs client = new Faye.Client(uri); Though this works in development, staging but not in testing. Overhere, uri = "http://localhost:9292/faye" faye.js is included in vendor

Ember-auth QUnit tests fail every second run

情到浓时终转凉″ 提交于 2020-01-04 04:45:16
问题 I have recently managed to get my ember-auth tests to pass, but it's not yet perfect, as the tests fail every second time (or if there are several tests running, every second test about authentication fails). I have created a small sample app to demonstrate the failure. You should be able to reproduce the failure by following these steps: 1. git clone https://github.com/pedrokost/ember_auth_testing_example.git 2. cd ember_auth_testing_example 3. ruby -run -e httpd . -p5000 # (or any HTTP

why attach to window [edited]

早过忘川 提交于 2020-01-03 18:56:31
问题 I was looking over the code for qunit. My question is why would you want to attach the qunit object via property to window object. Here is the link to the file. Look at line 11. If I look at a unit test run using firebug you can see it is a property of window. [edit] Additional: Is there a specific reference for best practice for declaring things in specific namespaces? 回答1: All global objects (functions, variables, etc) are just children of window, it's the default context. For example:

QUnit Won't Run Tests

穿精又带淫゛_ 提交于 2020-01-03 08:52:56
问题 I'm just starting to use QUnit and having issues. I'm currently using TypeScript, which is a JavaScript compiler. I have my Tests in classes which parallel the structure of my main classes. In each of those classes, I have a function called runTests(). To execute these tests, I loop through and get all the classes which end in "Test", and then call their runTests() function. An example of the runTests() function is: runTests = function() { QUnit.test("5 = 5", function() { QUnit.ok(5 == 5,

Code coverage in sapui5 OPA5 tests

左心房为你撑大大i 提交于 2020-01-03 05:53:07
问题 i can see that in SAPUI5 Qunit tests there is option for checkbox for check the code coverage (by checkbox or with an URL parameter ?coverage) But in OPA5 tests in sapui5 there isn't checkbox for code coverage and if i add the URL parameter ?coverage, the test run regular without code coverage. OPA5 test in sapui5 doesn't support code coverage? Thanks! 回答1: Recently Opa5 introduced component based testing, guessing from 1.34 onwards, the code for calling a component based test looks like

Using Chutzpah to run Typescript qUnit tests

为君一笑 提交于 2020-01-02 05:31:51
问题 I've recently tried to incorporate qUnit and Chutzpah to unit test a project I'm working on which is written in typescript. I've got things setup in what I believe is the correct manner and the following things work: The typescript application! - I can run a very early version of the application Chutzpah - I installed this on VS2012 and it correctly see's my qUnit demo test qUnit - Appears installed and works with Chutzpah, I can run a simple test (one which doesn't look at my code) With

QUnit Async Tests with setup And teardown

时间秒杀一切 提交于 2019-12-30 10:27:09
问题 I need a little help understanding QUnit internas. I read its source from time to time, but i'm still writing weird test when it comes to asynchronous tests. I understand the concept of asynchronous tests, and the stop() and start() methods (and why they are needed), but when i combine them with setup and teardown i get a lot of weired situations. Here is my Testcode: use(['Psc.Exception','Psc.Code'], function () { module("async", { setup: function () { console.log('setup'); }, teardown: