Add support for Node.js 12.x

- Fix code to pass all tests on Node.js 12
- Add Node.js 12 to the list of Travis CI platforms
This commit is contained in:
Miroslav Bajtoš 2019-04-29 09:39:20 +02:00
parent a4e69353e9
commit 70b3d219ab
No known key found for this signature in database
GPG Key ID: 6F2304BA9361C7E3
4 changed files with 17 additions and 0 deletions

View File

@ -4,5 +4,6 @@ node_js:
- "6"
- "8"
- "10"
- "12"
after_success: npm run coverage

View File

@ -97,3 +97,10 @@ DateString.prototype.inspect = function(depth, options) {
_date: this._date,
});
};
if (inspect.custom) {
// Node.js 12+ no longer recognizes "inspect" method,
// it uses "inspect.custom" symbol as the key instead
// TODO(semver-major) always use the symbol key only (requires Node.js 8+).
DateString.prototype[inspect.custom] = DateString.prototype.inspect;
}

View File

@ -385,6 +385,8 @@ ModelUtils._coerce = function(where, options) {
self._coerce(clauses[k], options);
}
where[p] = clauses;
continue;
}
let DataType = props[p] && props[p].type;

View File

@ -637,6 +637,13 @@ ModelBaseClass.prototype.inspect = function(depth) {
});
};
if (util.inspect.custom) {
// Node.js 12+ no longer recognizes "inspect" method,
// it uses "inspect.custom" symbol as the key instead
// TODO(semver-major) always use the symbol key only (requires Node.js 8+).
ModelBaseClass.prototype[util.inspect.custom] = ModelBaseClass.prototype.inspect;
}
/**
*
* @param {String} anotherClass could be string or class. Name of the class or the class itself