Skip to content

Commit 2bb7fbc

Browse files
authored
add TODO comment
1 parent 3ffcebd commit 2bb7fbc

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/internal/test_runner/test.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,14 @@ class TestContext {
264264
};
265265
});
266266

267-
// assert.ok needs it's own function, as it checks the stack
268-
// trace to provide more descriptive errors.
267+
// TODO(RedYetiDev): This is a hack. It should be replaced with better handling in
268+
// internal/assert/util.js
269+
//
270+
// The innerOk function receives a reference to the userland function that invoked it
271+
// to correctly generate the stack trace. However, when each assert method is wrapped
272+
// (for test planning purposes), the reference passed to innerOk no longer points to
273+
// the original userland function. To address this issue, the ok function is implemented
274+
// below without using the wrapper, allowing innerOk to receive the correct reference.
269275
function ok(...args) {
270276
if (plan !== null) {
271277
plan.actual++;

0 commit comments

Comments
 (0)