Skip to content

Commit

Permalink
Tests failing for Node > 14
Browse files Browse the repository at this point in the history
`napi_create_reference` returns `napi_invalid_arg` instead of `napi_object_expected`.
Extended logic for this case.

Also updated `node-addon-api` to `4.2.0`
  • Loading branch information
takameyer committed Dec 15, 2021
1 parent 643fff6 commit de16302
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ x.x.x Release notes (yyyy-MM-dd)
* If the option `user` in a sync configuration was not a `Realm.User` object could lead to a crash. ([#1348](https://github.com/realm/realm-js/issues/1348), since v10.0.0)
* `@sum` and `@avg` queries on Dictionaries of floats or doubles used too much precision for intermediates, resulting in incorrect rounding. (since v10.3.0-rc.1)
* Queries of the form `link.collection.@sum = 0` where `link` is `null` matched when `collection` was a List or Set, but not a Dictionary ([realm/realm-core#5080](https://github.com/realm/realm-core/pull/5080), since v10.5.0)
* Fix Realm for versions of Node greater than 14.

### Compatibility
* MongoDB Realm Cloud.
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"fs-extra": "^4.0.3",
"https-proxy-agent": "^2.2.4",
"ini": "^1.3.7",
"node-addon-api": "^3.1.0",
"node-addon-api": "4.2.0",
"node-fetch": "^2.6.1",
"node-machine-id": "^1.1.10",
"prebuild-install": "^6.1.1",
Expand Down Expand Up @@ -160,4 +160,4 @@
4
]
}
}
}
2 changes: 1 addition & 1 deletion src/node/node_protected.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Protected {
, m_isValue(false)
{
napi_status status = napi_create_reference(env, value, 1, &m_ref);
if (status == napi_object_expected) {
if (status == napi_object_expected || status == napi_invalid_arg) {
m_isValue = true;
Napi::Object object = Napi::Object::New(m_env);
object.Set("value", value);
Expand Down
4 changes: 4 additions & 0 deletions tests/js/list-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ const DATE3 = new Date(3);
const isNodeProcess = typeof process === "object" && process + "" === "[object process]";
const isElectronProcess = typeof process === "object" && process.versions && process.versions.electron;

global.inspect = function (obj) {
console.log("BREAK: ", obj);
};

module.exports = {
testListConstructor: function () {
const realm = new Realm({ schema: [schemas.PersonObject, schemas.PersonList] });
Expand Down

0 comments on commit de16302

Please sign in to comment.