1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
'use strict';
// This list must be computed before we require any modules to
// to eliminate the noise.
const actualModules = new Set(process.moduleLoadList.slice());
const common = require('../common');
const assert = require('assert');
const expectedModules = new Set([
'Internal Binding errors',
'Internal Binding async_wrap',
'Internal Binding buffer',
'Internal Binding config',
'Internal Binding constants',
'Internal Binding contextify',
'Internal Binding credentials',
'Internal Binding fs',
'Internal Binding fs_dir',
'Internal Binding fs_event_wrap',
'Internal Binding messaging',
'Internal Binding module_wrap',
'Internal Binding native_module',
'Internal Binding options',
'Internal Binding process_methods',
'Internal Binding report',
'Internal Binding string_decoder',
'Internal Binding symbols',
'Internal Binding task_queue',
'Internal Binding timers',
'Internal Binding trace_events',
'Internal Binding types',
'Internal Binding url',
'Internal Binding util',
'Internal Binding uv',
'Internal Binding worker',
'NativeModule buffer',
'NativeModule events',
'NativeModule fs',
'NativeModule internal/abort_controller',
'NativeModule internal/assert',
'NativeModule internal/async_hooks',
'NativeModule internal/bootstrap/pre_execution',
'NativeModule internal/buffer',
'NativeModule internal/console/constructor',
'NativeModule internal/console/global',
'NativeModule internal/constants',
'NativeModule internal/encoding',
'NativeModule internal/errors',
'NativeModule internal/event_target',
'NativeModule internal/fixed_queue',
'NativeModule internal/fs/dir',
'NativeModule internal/fs/utils',
'NativeModule internal/fs/promises',
'NativeModule internal/fs/rimraf',
'NativeModule internal/fs/watchers',
'NativeModule internal/idna',
'NativeModule internal/linkedlist',
'NativeModule internal/modules/run_main',
'NativeModule internal/modules/package_json_reader',
'NativeModule internal/modules/cjs/helpers',
'NativeModule internal/modules/cjs/loader',
'NativeModule internal/modules/esm/create_dynamic_module',
'NativeModule internal/modules/esm/get_format',
'NativeModule internal/modules/esm/get_source',
'NativeModule internal/modules/esm/loader',
'NativeModule internal/modules/esm/module_job',
'NativeModule internal/modules/esm/module_map',
'NativeModule internal/modules/esm/resolve',
'NativeModule internal/modules/esm/transform_source',
'NativeModule internal/modules/esm/translators',
'NativeModule internal/process/esm_loader',
'NativeModule internal/options',
'NativeModule internal/priority_queue',
'NativeModule internal/process/execution',
'NativeModule internal/process/per_thread',
'NativeModule internal/process/promises',
'NativeModule internal/process/report',
'NativeModule internal/process/signal',
'NativeModule internal/process/task_queues',
'NativeModule internal/process/warning',
'NativeModule internal/querystring',
'NativeModule internal/source_map/source_map_cache',
'NativeModule internal/streams/add-abort-signal',
'NativeModule internal/streams/buffer_list',
'NativeModule internal/streams/destroy',
'NativeModule internal/streams/duplex',
'NativeModule internal/streams/end-of-stream',
'NativeModule internal/streams/legacy',
'NativeModule internal/streams/passthrough',
'NativeModule internal/streams/pipeline',
'NativeModule internal/streams/readable',
'NativeModule internal/streams/state',
'NativeModule internal/streams/transform',
'NativeModule internal/streams/writable',
'NativeModule internal/timers',
'NativeModule internal/url',
'NativeModule internal/util',
'NativeModule internal/util/debuglog',
'NativeModule internal/util/inspect',
'NativeModule internal/util/iterable_weak_map',
'NativeModule internal/util/types',
'NativeModule internal/validators',
'NativeModule internal/vm/module',
'NativeModule internal/worker/io',
'NativeModule internal/worker/js_transferable',
'NativeModule internal/blob',
'NativeModule async_hooks',
'NativeModule path',
'NativeModule stream',
'NativeModule timers',
'NativeModule url',
'NativeModule util',
'NativeModule vm',
]);
if (!common.isMainThread) {
[
'Internal Binding messaging',
'Internal Binding performance',
'Internal Binding symbols',
'Internal Binding worker',
'NativeModule internal/streams/duplex',
'NativeModule internal/streams/passthrough',
'NativeModule internal/streams/readable',
'NativeModule internal/streams/transform',
'NativeModule internal/streams/writable',
'NativeModule internal/error_serdes',
'NativeModule internal/process/worker_thread_only',
'NativeModule internal/streams/buffer_list',
'NativeModule internal/streams/destroy',
'NativeModule internal/streams/end-of-stream',
'NativeModule internal/streams/legacy',
'NativeModule internal/streams/pipeline',
'NativeModule internal/streams/state',
'NativeModule internal/worker',
'NativeModule internal/worker/io',
'NativeModule stream',
'NativeModule worker_threads',
].forEach(expectedModules.add.bind(expectedModules));
}
if (common.hasIntl) {
expectedModules.add('Internal Binding icu');
} else {
expectedModules.add('NativeModule punycode');
}
if (process.features.inspector) {
expectedModules.add('Internal Binding inspector');
expectedModules.add('NativeModule internal/inspector_async_hook');
expectedModules.add('NativeModule internal/util/inspector');
}
if (process.env.NODE_V8_COVERAGE) {
expectedModules.add('Internal Binding profiler');
}
const difference = (setA, setB) => {
return new Set([...setA].filter((x) => !setB.has(x)));
};
const missingModules = difference(expectedModules, actualModules);
const extraModules = difference(actualModules, expectedModules);
const printSet = (s) => { return `${[...s].sort().join(',\n ')}\n`; };
assert.deepStrictEqual(actualModules, expectedModules,
(missingModules.size > 0 ?
'These modules were not loaded:\n ' +
printSet(missingModules) : '') +
(extraModules.size > 0 ?
'These modules were unexpectedly loaded:\n ' +
printSet(extraModules) : ''));
|