-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
console: lazy load process.stderr and process.stdout #24534
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,20 @@ | ||
| /* eslint-disable node-core/required-modules */ | ||
|
|
||
| // Flags: --expose-internals | ||
| 'use strict'; | ||
|
|
||
| // Ordinarily test files must require('common') but that action causes | ||
| // the global console to be compiled, defeating the purpose of this test. | ||
| // This makes sure no additional files are added without carefully considering | ||
| // lazy loading. Please adjust the value if necessary. | ||
|
|
||
| // This list must be computed before we require any modules to | ||
| // to eliminate the noise. | ||
| const list = process.moduleLoadList.slice(); | ||
|
|
||
| require('../common'); | ||
| const assert = require('assert'); | ||
|
|
||
| assert(list.length <= 78, list); | ||
| // We use the internals to detect if this test is run in a worker | ||
| // to eliminate the noise introduced by --experimental-worker | ||
| const { internalBinding } = require('internal/test/binding'); | ||
| const { threadId } = internalBinding('worker'); | ||
| const isMainThread = threadId === 0; | ||
| const kMaxModuleCount = isMainThread ? 56 : 78; | ||
|
|
||
| assert(list.length <= kMaxModuleCount, | ||
| `Total length: ${list.length}\n` + list.join('\n') | ||
| ); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| calling stdout._refreshSize | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The order changed here because in the test |
||
| calling stderr._refreshSize | ||
| calling stdout._refreshSize | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
common.isMainThread?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@richardlau Didn't know about this, thanks!