You cannot change the language definition rules. But you can get around this. You can export an environment variable, and if the variable exists, you can also export foo3 . Like this
module.exports = { foo1: foo1, foo2: foo2 } if (process.env.TESTING) { module.exports.foo3 = foo3; }
So, test foo3 can test foo3 , just like they test other exported functions. But in a production environment, since there will be no TESTING environment variable, foo3 will not be exported.
In addition, when using _ in a function name, the / variable function is understood for internal use, external code should not rely on this function / variable, and it is subject to change without any notice.
source share