-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error running asynchronous tests #129
Comments
As far as I know, I created a repository with minimal code (roughly the same as the code you provided) to prove that everything works as expected, clone it and run |
@gmiano have you fixed your issues ? if so, can you share your workaround ? |
Hi @Arkni, sorry but I have had not enough time to work on that problem. I have made a test using your workaround but it seems not to work. Every time I esecutivo the test it enters the catch statement and the test return an error. G. |
Can you create a repository that I can check and test. I'll take a look at it when time allows. |
Yep, when I have time enough I'la do it! Thanks for you help @Arkni! |
Hi @Arkni please see https://github.com/matzetronic/grunt-contrib-qunit-promise for a demonstration of the error. Thanks! |
But I dont know if that is the same issue since I use requirejs to load the tests and that could also be another issue. But they also time out. If you open the same tests in the browser they run successfully (as you can see in my repo). |
@matzetronic test/index.html | 11 ++++++++---
test/test.js | 8 +++++---
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/test/index.html b/test/index.html
index f36d119..2ffa305 100644
--- a/test/index.html
+++ b/test/index.html
@@ -14,17 +14,22 @@
<body id="body">
<div id="qunit"></div>
- <script src="../../node_modules/requirejs/require.js"></script>
+ <script src="../node_modules/requirejs/require.js"></script>
<script>
require.config({
paths: {
- qunitjs: "../../node_modules/qunitjs/qunit/qunit",
+ // The bridge file injected by grunt-contrib-qunit use the name `qunit`
+ // see note in README:
+ // https://github.com/gruntjs/grunt-contrib-qunit#loading-qunit-with-amd
+
+ // Also, you were using a wrong path to `QUnit`
+ qunit: "../node_modules/qunitjs/qunit/qunit",
tests: "./test"
}
});
- require( [ "qunitjs", "tests" ], function( QUnit, tests ) {
+ require( [ "qunit", "tests" ], function( QUnit, tests ) {
tests();
QUnit.start();
} );
diff --git a/test/test.js b/test/test.js
index 554692d..5140763 100644
--- a/test/test.js
+++ b/test/test.js
@@ -1,7 +1,9 @@
-
-define(["qunitjs"], function(QUnit) {
+// The bridge file used by grunt-contrib-qunit uses the name `qunit`
+// see note in README:
+// https://github.com/gruntjs/grunt-contrib-qunit#loading-qunit-with-amd
+define(["qunit"], function(QUnit) {
"use strict";
-
+
return function() {
function fn(i) {
return new Promise(function(resolve, reject) { |
Great thanks! I copied the paths from another project, sorry! But that qunit has to be defined was probably the real error.. |
I'm closing this issue since the original poster hasn't yet responded to the request made to them. I therefore assume that the user has lost interest or resolved the problem on their own. Don't worry though; if you have followup question, let us know with a comment and I'll be happy to reopen the issue. Thanks! |
Hi there,
I am having some problems in running a qunit file which contains many asynchrounous tests.
For instance I have a test structured like this:
QUnit.test("Test asynchfunction.", function(assert){ var done = assert.async(); this.MODULE.myFunction() .then(function(result){ assert.ok(true, "Complete workflow execution ended correctly."); done(); }) .catch(function(err){ assert.ok(false, "A server error occurred."); done(); }) });
The same file executes all the tests correctly when opened within a browser. On the contrary by using grunt-contrib-qunit to run it, it always go within the catch statement.
There is a possible solution to that? I really would like to automatize everything and it is a big issue.
Thanks,
G.
The text was updated successfully, but these errors were encountered: