Auto-mocking proxy not compatible with Conversion to primitive value
chrisspiegl opened this issue · comments
Chris Spiegl commented
Describe the feature
I am trying to use unenv to get something to work with the use of rollup and in another project with nuxt.js
I found that the auto mocking proxy runs into issues when the requesting library tries to convert something to a primitive value as in this example:
file:///Users/.../_worker.js:107963
[http2$1.constants.HTTP2_HEADER_STATUS]: http2$1.constants.HTTP_STATUS_OK,
^
TypeError: Cannot convert object to primitive value
I had the same issue with a library doing something like this:
const sys = os.platform()
if (sys && sys.length > 3) {}
In this case the auto mocking failed because the sys.length
can't be provided as a primitive value.
Not sure this can be somehow enhanced but I thought I'd share my findings here.
Additional information
- Would you be willing to help implement this feature?
Pooya Parsa commented
Hi. This is because node:https
is not implemented. Moving issue to #92