Skip to content

Commit

Permalink
chore: upgrade packages and adjust tests
Browse files Browse the repository at this point in the history
  • Loading branch information
galuszkak committed Sep 21, 2020
1 parent 910a111 commit 25dcfa7
Show file tree
Hide file tree
Showing 5 changed files with 1,858 additions and 1,249 deletions.
1 change: 0 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"consistent-return": [0],

// Disabled but may want to refactor code eventually
"no-shadow": [1],
"no-use-before-define": [2, "nofunc"],
"no-underscore-dangle": [0],

Expand Down
16 changes: 8 additions & 8 deletions lib/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ Test.prototype.end = function(fn) {
*/

Test.prototype.assert = function(resError, res, fn) {
var error;
var errorObj;
var i;

// check for unexpected network errors or server not running/reachable errors
Expand All @@ -164,23 +164,23 @@ Test.prototype.assert = function(resError, res, fn) {
if (!res && resError) {
if (resError instanceof Error && resError.syscall === 'connect'
&& Object.getOwnPropertyNames(sysErrors).indexOf(resError.code) >= 0) {
error = new Error(resError.code + ': ' + sysErrors[resError.code]);
errorObj = new Error(resError.code + ': ' + sysErrors[resError.code]);
} else {
error = resError;
errorObj = resError;
}
}

// asserts
for (i = 0; i < this._asserts.length && !error; i += 1) {
error = this._assertFunction(this._asserts[i], res);
for (i = 0; i < this._asserts.length && !errorObj; i += 1) {
errorObj = this._assertFunction(this._asserts[i], res);
}

// set unexpected superagent error if no other error has occurred.
if (!error && resError instanceof Error && (!res || resError.status !== res.status)) {
error = resError;
if (!errorObj && resError instanceof Error && (!res || resError.status !== res.status)) {
errorObj = resError;
}

fn.call(this, error || null, res);
fn.call(this, errorObj || null, res);
};

/**
Expand Down
Loading

0 comments on commit 25dcfa7

Please sign in to comment.