-
Notifications
You must be signed in to change notification settings - Fork 108
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
mocha test runner failures #74
Comments
Can you provide a more full repo? E.g. what version of Mocha are you using? Does it occur when using only the exact code in the readme, or does it only happen when there are other Mocha tests for the library involved as well? My guess is that something changed in Mocha 2.x. |
I am using exactly and only the promises-aplus-tests (v2.1.0) package from npm, which has [email protected]. I've tried on Node 0.10.x, 0.12.x, and iojs 1.x and 2.x. This is what my // Adapter for "promises-aplus-tests" test runner
var path = require("path");
var Promise = require(path.join(__dirname,"lib","npo.src.js"));
module.exports.deferred = function __deferred__() {
var o = {};
o.promise = new Promise(function __Promise__(resolve,reject){
o.resolve = resolve;
o.reject = reject;
});
return o;
};
module.exports.resolved = function __resolved__(val) {
return Promise.resolve(val);
};
module.exports.rejected = function __rejected__(reason) {
return Promise.reject(reason);
}; I run the tests with:
It passes most of the tests, but starts adding up some test failures, usually somewhere between 20-100 failures (intermittently different numbers of failures). The problem occurs at the end of the test suite (after all tests run), whenever it tries to list the summary of test failures. Whenever I try to change internal details about sync/async scheduling of NPO, this failure crops up. If I leave NPO alone at its current release (v0.7.8), it passes the entire test suite and |
Thanks! Can you upload a branch or something with the changes that cause these failures so I can dig into this? Obviously the test runner itself should not be breaking, so this is on us or Mocha or someone. |
Sure, here's a branch: https://github.com/getify/native-promise-only/tree/mocha-test-failure As you can see with this diff, the only change I made to NPO was to try to defer (async) the calling of getify/native-promise-only@8c84f85 Thanks! |
I run into this with the Mithril promises as implemented in git HEAD (it's based on Promiz, but modified). Here's the test runner: var promisesAplusTests = require("promises-aplus-tests");
var m = require('mithril');
// Uncomment the next line to fix the crash:
// m.deferred.onerror = function(){};
promisesAplusTests(m, function (err) {
// All done; output is in the console. Or check `err` for number of failures.
}); That implementation is not compliant at all, intentionally (then callbacks may be called synchronously if the promise is resolved, some errors are rethrown rather than rejecting the promise) and it regressed quite a bit recently on other fronts, but still...
function isNativeError(e) {
return e instanceof EvalError ||
e instanceof RangeError ||
e instanceof ReferenceError ||
e instanceof SyntaxError ||
e instanceof TypeError ||
e instanceof URIError
}
mdeferred.onerror = function (e) {
if (isNativeError(e)) {
pendingRequests = 0
throw e
}
} Here's the stack trace:
Edit: using Node 5.1.1 |
I know it has, I know it's intentional, but it got worse recently #dontskim —Pierre-Yves On Sat, Dec 19, 2015 at 3:51 AM, Isiah Meadows [email protected]
|
I am getting mocha crashes while trying to debug problems with my promises lib and running the test suite:
Any ideas what's going on?
Here's another variation I get of the error:
The text was updated successfully, but these errors were encountered: