Skip to content

Error "any must be an array" even if an array is passed #124

Closed
@thegeorgeous

Description

@thegeorgeous

The condition in this line evaluates to false under certain conditions even if Array.isArray(someArray) evaluates to true and Object.prototype.toString.call(someArray) returns [Object Array].

Could these edge cases be the problem?

I'm using supertest and nock to test a Cloudflare worker.

Using Array.isArray() instead of instanceof doesn't seem to be causing any problems for tests. https://github.com/thegeorgeous/json-rules-engine/commit/c2da34fc59d94cc4f8e6f54eaca431b079220f12

Happy to provide any more details if necessary.

UPDATE:
The issue seems to be a jest issue. Would you consider using Array.isArray() instead?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions