Is the flattened representation itself not actually verified in tests?
You could check the result by using string->isFlat() in a native C++ (not N-API) addon used specifically for testing. It's undocumented, but exposed publicly. This would make it way less brittle to check.
Yes, I think it would Would you like to send a PR for this?
I think this is cool but I'd like to do it the following way:
- create and publish a C++ node module that returns string->isFlat()
- change test field of this module to
npm install --no-save is-flat && tap
The reasoning for this is I'd rather not add a C++ build to installs, not even for dev – especially because it's fairly common in the wild for dev deps to sneak into deps, which would then cause an error in production, esp. in a docker container, and then it would seem to be flatstr causing the problem etc. etc.