Skip to content

v4.16.4 - Bugfix: logger LWC Initialization Message

Latest
Compare
Choose a tag to compare
@jongpie jongpie released this 23 Jul 23:49
2ab4af9

Core Unlocked Package Changes

Fixed #870 (reported by @dominykasvitkus) by updating the logger LWC initialization message to only print when JavaScript console logging is enabled via LoggerSettings__c. Also resolved some test isolation issues in logger.test.js + test improvements + code cleanup:

  • Updated loggerService.js to only call console.info() with an init message ('logger component initialized') when console logging is enabled via LoggerSettings__c.IsJavaScriptConsoleLoggingEnabled__c
  • Replaced enableSystemMessages() and disableSystemMessages() in loggerService.js with a new static variable LoggerService.areSystemMessagesEnabled (intended for internal-use only)
  • Updated logger.test.js to reset LoggerService.hasInitialized and LoggerService.areSystemMessagesEnabled static variables in beforeEach() (instead of afterAll())
  • Switched to using jest.resetAllMocks() instead of jest.clearAllMocks() in logger.test.js for better test isolation
  • Updated all test functions to consistently use all 3 logger creation methods (createLogger, getLogger, and getMarkupLogger)

Also include a 🤏 liiiiiiitle bit of scope creep:

  • Updated all Jest tests to import createElement from '@lwc/engine-dom' (instead of 'lwc')
  • Updated the project's threshold for code coverage in codecov.yml to compensate for the lower code coverage in LWC tests for now (currently around ~86%). Eventually, tests & code coverage for LWC will be improved - but for now, the constant pipeline alerts from codecov.io aren't particularly helpful 😅
  • Cleaned up a small code block in LogBatchPurger using the null coalescing operator (??) to reduce the lines of code needed
  • Corrected the label on field LoggerScenarioRule__mdt.IsLogAssignmentEnabled__c to use the term Logger Scenario, instead of the deprecated term Log Scenario

Installation Info

Core Unlocked Package - no namespace

Full Changelog: v4.16.3...v4.16.4