AmdHarness.org/test/assert

From ApiFusion
Revision as of 04:42, 4 May 2017 by Suns (talk | contribs) (1 revision imported: ImportWiki.html from http://lowcost-env.pb3ahmsuf3.us-west-2.elasticbeanstalk.com/wiki/index.php?title=Special:Export&action=submit ;AmdHarness.org/test/assert)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Problem

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.

Solution

  • 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.