The assert concept is not popular withing the JS community due to missing support of assert functionality in development stack. The lack of assert call elimination in release environment in particular. The default assert behavior is expected to throw an exception in case of evaluation failure. Which is actively used as an error exposure in unit test. Unfortunately it is not acceptable for modules within production environment resulting in absence of asserts within business logic code.
- Differentiate the assert behavior in test, production and debug environment:
- The behavior in unit test will be kept as desired and currently supported in multiple implementations
- The release version shall trigger the filter in loader and cut the assert call and its parameters off the execution.
- As an final option the filtering could be done during the release build
- In regular (and debug) mode assert will not trigger the exception leaving the application behavior intact. Rather it will report the error via "trace" call.