qunit

Non-blocking asynchronous tests using QUnit

柔情痞子 提交于 2019-12-23 15:39:54
问题 It seems that the QUnit functions stop() and start() allow to wait for asynchronous tests, but during that waiting period the whole test suite hangs. Is there a way to run asynchronous tests in a non-blocking fashion using QUnit? 回答1: Looking at the docs for asyncTest and stop, there's two reason's I can see that it's set up like that. So that you aren't accidentally running two tests at a time which might conflict with something (ie, modifying the DOM and so changing each others' test

QUnit strange behavior with fixture, tests alternately failing and passing

我只是一个虾纸丫 提交于 2019-12-23 08:30:13
问题 I have the following set up in QUnit: /* Dozen or so previous tests here */ test("Test some markup generation", function () { $('#qunit-fixture').plugin(); // jQuery plugin: Generates a table var rows = $('#qunit-fixture table tbody tr'); count = rows.length; // Count the rows console.log(count); equal(count, "96", "Expect the number of rows to be 96"); }); When it runs, or when I refresh the browser it alternately fails this test showing count = 0, or passes this and fails all the previous

QUnit asyncTest does not continue after error

南笙酒味 提交于 2019-12-23 02:14:07
问题 How can I tell QUnit to consider errors during asyncTest as test failures and continue to next test? here is an example which QUnit stops running after a ReferenceError : jsfiddle 回答1: Errors in asynchronous tests die silently if they arise while QUnit isn't officially running. The simplest solution is to wrap every asyncTest contents in a try/catch block that propagates any errors after restarting QUnit. We don't actually have to pollute the code with a million try/catches--we can decorate

Is it possible to run a single test using QUnit inside Karma?

孤者浪人 提交于 2019-12-22 15:07:13
问题 Jasmine has iit() and ddescribe , and Mocha has it.only and describe.only , but I can't see any way to get QUnit to focus on running a single test. The QUnit UI allows you to run a single test, but I can't see how to get this to work inside Karma, because it doesn't display the QUnit UI. 回答1: Here is my solution. It works fine for me, but YMMV. Download qunit-karma-setup.js, qunit-karma-launch.js from here Then, in your Gruntfile: config.set({ frameworks: ['qunit'], files: [ 'your-app-files

Ember.js - CircleCI - BrowserStack

烂漫一生 提交于 2019-12-22 09:39:07
问题 I try to connect together our cicleCI with browserstack and run our integration_test and unit tests not only with PhantomJS but on real Firefox and Internet Explorer as well, using Browserstack service. I try to configure browserstack-cli. I can run the test from circleci via tunnel on Browserstack, but never report back to circleci server. Could you please share your experience if you already played with this stack? Thank you very much! 回答1: The solution is to use BrowserStackLocal and

Qunit test alternates between pass and fail on page refresh

不羁岁月 提交于 2019-12-22 03:43:43
问题 I have a two tests that are causing side effects with each other. I understand why as I am replacing a jQuery built-in function that is being called internally in the second test. However what I don't understand is why the test alternately passes and fails. This question is similar However, I am not doing anything directly on the qunit-fixture div. Here are my tests test('always passing test', function() { // Always passes var panelId = '#PanelMyTab'; var event = {}; var ui = { tab: { name:

Ember - Return a promise from beforeModel not working with Qunit

雨燕双飞 提交于 2019-12-21 18:43:12
问题 In my ApplicationRoute I implement a beforeModel hook that does a server call to see if a valid session exists. If it does, then the app navigates to the 'dashboard' route, otherwise it goes to the 'login' route. I am trying to implement some tests and I can't seem to get it to work with QUnit. I keep getting: Assertion failed: You have turned on testing mode, which disabled the run-loop's autorun. You will need to wrap any code with asynchronous side-effects in an Ember.run Here is a plunker

Ember - Return a promise from beforeModel not working with Qunit

守給你的承諾、 提交于 2019-12-21 18:42:29
问题 In my ApplicationRoute I implement a beforeModel hook that does a server call to see if a valid session exists. If it does, then the app navigates to the 'dashboard' route, otherwise it goes to the 'login' route. I am trying to implement some tests and I can't seem to get it to work with QUnit. I keep getting: Assertion failed: You have turned on testing mode, which disabled the run-loop's autorun. You will need to wrap any code with asynchronous side-effects in an Ember.run Here is a plunker

Getting QUnit to run tests in order

╄→尐↘猪︶ㄣ 提交于 2019-12-21 09:28:29
问题 I've used qunit to write a series of tests for javascript code I have. Right now for some reason, the first test in my list will run, and then the LAST test in the list runs, followed by the 2nd to last, 3rd to last, 4th to last, etc... It's crucial for my tests that things run in the order that I have them in. I tried turning off that option where qunit runs tests that failed last time first, but it's still doing this. Is there any way to fix this? 回答1: First, figure out why your tests MUST

How to stop Global Failures in qUnit?

你离开我真会死。 提交于 2019-12-21 07:57:18
问题 I'm new to qunit, and am attempting to integrate it with an existing environment. One of the issues I get on pages that utilize jQuery is this: global failure (1, 0, 1)Rerun6 ms Uncaught ReferenceError: $ is not defined I think this is because I'm not calling the jquery library in the qunit HTML. Is it possible to set a parameter to ignore globals like this? I am trying to make the HTML as flexible as possible, and as many editors have different dependencies, I only want qunit to test the