[SERVER-20774] Force assert() to accept only booleans Created: 06/Oct/15  Updated: 06/Dec/22

Status: Open
Project: Core Server
Component/s: Testing Infrastructure
Affects Version/s: None
Fix Version/s: Needs Further Definition

Type: Improvement Priority: Major - P3
Reporter: Kevin Pulo Assignee: Backlog - Server Tooling and Methods (STM) (Inactive)
Resolution: Unresolved Votes: 0
Labels: stm, tig-assertjs
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-12476 assert() calls that can't fail becaus... Closed
Assigned Teams:
Server Tooling & Methods
Participants:

 Description   

Currently assert() will accept non-boolean values, and tests them for truthyness/falsiness. Sometimes this is desirable, but it may permit problems such as mistakenly testing an object, or a function itself (rather than its return value), and so on.

It would be better if assert() only accepted boolean values, and situations where the author wants to test a non-boolean value should explicitly declare that by using assert.truthy() and/or assert.falsy() helper functions.


Generated at Thu Feb 08 03:55:14 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.