Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ language: node_js
node_js:
- "8"
- "10"
- "12"

after_success: npm run coverage
7 changes: 7 additions & 0 deletions lib/date-string.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
2 changes: 2 additions & 0 deletions lib/model-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,8 @@ ModelUtils._coerce = function(where, options) {
self._coerce(clauses[k], options);
}

where[p] = clauses;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is kind of weird. Before my change, the block "handle logical operators" did not apply updates made by coerceArray to the original where[p] value. As a result, array-like object {1: {field: 'value'}} was not converted into an array [{field: 'value'}]. I am not sure why this was not caught earlier and surfaced only with Node.js 12. Is it perhaps a change in how deep-equality checks work on the new Node version? IDK.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


continue;
}
let DataType = props[p] && props[p].type;
Expand Down
7 changes: 7 additions & 0 deletions lib/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down