kukeiko / entity-space

MIT License
5 stars 1 forks source link

circular JSON structure error when jest uses workers to run tests #192

Closed kukeiko closed 1 year ago

kukeiko commented 2 years ago

If a test fails that tries to check equality between queries, and that test is run in a worker (which jest decides to not always do), the worker tries to serialize the Query to JSON to send it to the parent (messageParent.js), which fails - as the EntitySchema within the Query can (and in tested models does) have a circular structure.

That makes testing a bit of a pain, so we need some solution here. As far as I can tell there is no fix yet in Jest, so we might need to work around it somehow. Maybe we can use custom matchers for queries?

kukeiko commented 2 years ago

we might ignore this issue and just expect to always use --runInBand, which also runs much quicker as there is no overhead of creating workers (also, my CPU does not get bombarded like crazy).

the difference in speed is night and day.

edit: correction; it is only quicker when running small amount of tests. as the amount grows, using workers becomes quicker. should therefore still find a fix for this.

kukeiko commented 1 year ago

closing as wontfix since I don't care about this at all anymore. I just run tests using --runInBand