Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: formalize exposure of internal bindings #18698

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions lib/internal/loader/ModuleWrap.js

This file was deleted.

13 changes: 13 additions & 0 deletions lib/internal/test/binding.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
'use strict';

process.emitWarning(
'These APIs are exposed only for testing and are not ' +
'tracked by any versioning system or deprecation process.',
'internal/test/binding');

// These exports should be scoped as specifically as possible
// to avoid exposing APIs because even with that warning and
// this file being internal people will still try to abuse it.
module.exports = {
ModuleWrap: internalBinding('module_wrap').ModuleWrap,
};
2 changes: 1 addition & 1 deletion node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@
'lib/internal/loader/DefaultResolve.js',
'lib/internal/loader/ModuleJob.js',
'lib/internal/loader/ModuleMap.js',
'lib/internal/loader/ModuleWrap.js',
'lib/internal/loader/Translators.js',
'lib/internal/safe_globals.js',
'lib/internal/net.js',
Expand All @@ -125,6 +124,7 @@
'lib/internal/repl.js',
'lib/internal/repl/await.js',
'lib/internal/socket_list.js',
'lib/internal/test/binding.js',
'lib/internal/test/unicode.js',
'lib/internal/timers.js',
'lib/internal/tls.js',
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-internal-module-wrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const common = require('../common');
common.crashOnUnhandledRejection();
const assert = require('assert');

const ModuleWrap = require('internal/loader/ModuleWrap');
const { ModuleWrap } = require('internal/test/binding');
const { getPromiseDetails, isPromise } = process.binding('util');
const setTimeoutAsync = require('util').promisify(setTimeout);

Expand Down