Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't format node assert errors when there's no 'assert' module (#4376)
* Don't format node assert errors when there's no 'assert' module In format_node_assert_errors.js, we require the 'assert' module to detect that an error thrown is an AssertionError, so that we can format assertion errors nicely. This creates an implicit dependency in the library on the assert module (a node builtin, but not available without adding a shim in browsers, React Native, etc). If we are running in an environment where assert is not available, we don't need to try to format assertion errors, so we can just bail. Detecting this case and performing the require in a try/catch removes the implicit dependency on assert. Fixes #4365 * Use require.call(null, 'assert') instead of require('assert') The React Native packager was attempting to pull in the assert module as a dependency when using `require('assert')`, but it does not do this if you use require.call(null, 'assert'), because it does not detect this pattern. * Update format_node_assert_errors.js * Remove unnecessary test
- Loading branch information