Conversation
This uses `process.versions.node` to see if we are in Node.js rather than using `global.self` to check if we are in a Browser. This change also makes some minor `wasm_bindgen` improvements: - Use `js_sys::global()` to get the global object - Bind the node require as `module.require` - Improving error messages Signed-off-by: Joe Richey <joerichey@google.com>
to reproduce: $ OPTIC__BUILD_SKIP__UI=yes task postpull $ yarn workspace @useoptic/ui-v2 test
|
Thanks @josephlr I'm checking right now via https://github.com/opticdev/optic/pull/786/checks?check_run_id=2611731376#step:6:25 but I still see the issues. Perhaps I'm not setting the dependency correctly? let me know if you can't see the logs but I believe you should be able to. |
|
Now that I look at the issue with fresh eyes, I'm using Jest on a React UI project. It's set up to run in a jsdom environment. However, the jsdom environment does not provide an implementation for global.crypto. It appears I have to do that manually in the Jest setup, but I can definitely do that. So, I think the issue still remains that detection should be improved, but in my particular situation I think I should be making my jsdom environment include a crypto implementation, since jsdom is intended to make it look like it's in a browser, so your detection would probably continue to be fooled. |
This uses `process.versions.node` to see if we are in Node.js rather than using `global.self` to check if we are in a Browser. This change also makes some minor `wasm_bindgen` improvements: - Use `js_sys::global()` to get the global object - Bind the node require as `module.require` - Improving error messages Signed-off-by: Joe Richey <joerichey@google.com>
Fixes #214 (CC: @devdoshi can you verify that this fixes your issue)
This uses
process.versions.nodeto see if we are in Node.js ratherthan using
global.selfto check if we are in a Browser.This change also makes some minor
wasm_bindgenimprovements:js_sys::global()to get the global objectrequire()asmodule.requireSigned-off-by: Joe Richey joerichey@google.com