Details
Tests continue to pass, Jest issues are no longer a problem.
Diff Detail
- Repository
- rCOMM Comm
- Branch
- master
- Lint
No Lint Coverage - Unit
No Test Coverage
Event Timeline
This is super hacky – can you spend some more time explaining the error you're seeing and what you've tried?
PS – it's always best to document each step in an investigation live on Linear... saves you time having to trace backwards to document it later
Created a Linear issue here: https://linear.app/comm/issue/ENG-5692/jest-issue-with-derived-tshape-validators
Ideally would prefer to land this as is to unblock and proceed w/ Flow and refactoring work if there's no obvious solution
I strongly suspect that you have a circular dependency issue and you are papering over it. I spent about 20min pulling down your changes locally and then removing this diff. I can see it failing once you introduce the hasPermission check in thread-utils.js. Then I looked through the code and I think there's an import cycle here:
thread-utils.js -> minimally-encoded-thread-permissions.js -> types/thread-types.js -> utils/entity-text.js -> thread-utils.js
Circular dependencies will show up in a Node environment (like the one keyserver and Jest run), but won't show up in "bundled" environments (like web and native). The tests failing is pointing to a larger issue, which I suspect would show up in the keyserver environment once you start importing hasPermission there.
Either way we should try to avoid them. Can you try to fix the import cycle? If pulling hasPermission outside of minimally-encoded-thread-permissions.js doesn't solve it, you could try pulling threadNoun outside of thread-utils.js.