From c61f363d66e4c69e1f2e32ec3559211e7ddc14ca Mon Sep 17 00:00:00 2001 From: Bradley Farias Date: Fri, 2 Apr 2021 14:26:01 -0500 Subject: [PATCH] doc: internal/test/binding for testing PR-URL: https://github.com/nodejs/node/pull/38026 Reviewed-By: James M Snell Reviewed-By: Antoine du Hamel Reviewed-By: Rich Trott Reviewed-By: Colin Ihrig --- doc/guides/writing-tests.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/guides/writing-tests.md b/doc/guides/writing-tests.md index b0a82b2dcac4b0..29facf4cc25527 100644 --- a/doc/guides/writing-tests.md +++ b/doc/guides/writing-tests.md @@ -287,6 +287,15 @@ const assert = require('assert'); const freelist = require('internal/freelist'); ``` +In specific scenarios it may be useful to get a hold of `primordials` or +`internalBinding()`. You can do so using + +```console +node --expose-internals -r internal/test/binding lib/fs.js +``` + +This only works if you preload `internal/test/binding` by command line flag. + ### Assertions When writing assertions, prefer the strict versions: