Skip to content

Commit 0413fc8

Browse files
authored
Merge branch 'nodejs:main' into doc-stream-consumers
2 parents 5e5b5d6 + 511a57a commit 0413fc8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+6917
-1057
lines changed

β€ŽSECURITY.mdβ€Ž

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ response or engagement within 14 days, escalation is also appropriate.
2424

2525
### Node.js bug bounty program
2626

27-
The Node.js project engages in an official bug bounty program for security
28-
researchers and responsible public disclosures. The program is managed through
29-
the HackerOne platform. See <https://hackerone.com/nodejs> for further details.
27+
The Node.js project no longer has a bug bounty program.
3028

3129
## Reporting a bug in a third-party module
3230

β€Ždeps/googletest/include/gtest/gtest.hβ€Ž

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@ GTEST_DECLARE_int32_(repeat);
137137
// only torn down once, for the last.
138138
GTEST_DECLARE_bool_(recreate_environments_when_repeating);
139139

140+
// Together these flags determine which tests are run if the test is sharded.
141+
GTEST_DECLARE_int32_(shard_index);
142+
GTEST_DECLARE_int32_(total_shards);
143+
140144
// This flag controls whether Google Test includes Google Test internal
141145
// stack frames in failure stack traces.
142146
GTEST_DECLARE_bool_(show_internal_stack_frames);

β€Ždeps/googletest/src/gtest-internal-inl.hβ€Ž

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -246,15 +246,12 @@ GTEST_API_ std::string WideStringToUtf8(const wchar_t* str, int num_chars);
246246
// be created, prints an error and exits.
247247
void WriteToShardStatusFileIfNeeded();
248248

249-
// Checks whether sharding is enabled by examining the relevant
250-
// environment variable values. If the variables are present,
251-
// but inconsistent (e.g., shard_index >= total_shards), prints
252-
// an error and exits. If in_subprocess_for_death_test, sharding is
249+
// Checks whether sharding is enabled by examining the relevant flag values.
250+
// If the flags are set, but inconsistent (e.g., shard_index >= total_shards),
251+
// prints an error and exits. If in_subprocess_for_death_test, sharding is
253252
// disabled because it must only be applied to the original test
254253
// process. Otherwise, we could filter out death tests we intended to execute.
255-
GTEST_API_ bool ShouldShard(const char* total_shards_str,
256-
const char* shard_index_str,
257-
bool in_subprocess_for_death_test);
254+
GTEST_API_ bool ShouldShard(bool in_subprocess_for_death_test);
258255

259256
// Parses the environment variable var as a 32-bit integer. If it is unset,
260257
// returns default_val. If it is not a 32-bit integer, prints an error and

β€Ždeps/googletest/src/gtest.ccβ€Ž

Lines changed: 42 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,18 @@ GTEST_DEFINE_bool_(
407407
"if exceptions are enabled or exit the program with a non-zero code "
408408
"otherwise. For use with an external test framework.");
409409

410+
GTEST_DEFINE_int32_(
411+
shard_index,
412+
testing::internal::Int32FromEnvOrDie(testing::kTestShardIndex, -1),
413+
"The zero-based index of the shard to run. A value of -1 "
414+
"(the default) indicates that sharding is disabled.");
415+
416+
GTEST_DEFINE_int32_(
417+
total_shards,
418+
testing::internal::Int32FromEnvOrDie(testing::kTestTotalShards, -1),
419+
"The total number of shards to use when running tests in parallel. "
420+
"A value of -1 (the default) indicates that sharding is disabled.");
421+
410422
#if GTEST_USE_OWN_FLAGFILE_FLAG_
411423
GTEST_DEFINE_string_(
412424
flagfile, testing::internal::StringFromGTestEnv("flagfile", ""),
@@ -3475,11 +3487,11 @@ void PrettyUnitTestResultPrinter::OnTestIterationStart(
34753487
filter);
34763488
}
34773489

3478-
if (internal::ShouldShard(kTestTotalShards, kTestShardIndex, false)) {
3479-
const int32_t shard_index = Int32FromEnvOrDie(kTestShardIndex, -1);
3480-
ColoredPrintf(GTestColor::kYellow, "Note: This is test shard %d of %s.\n",
3490+
if (internal::ShouldShard(false)) {
3491+
const int32_t shard_index = GTEST_FLAG_GET(shard_index);
3492+
ColoredPrintf(GTestColor::kYellow, "Note: This is test shard %d of %d.\n",
34813493
static_cast<int>(shard_index) + 1,
3482-
internal::posix::GetEnv(kTestTotalShards));
3494+
GTEST_FLAG_GET(total_shards));
34833495
}
34843496

34853497
if (GTEST_FLAG_GET(shuffle)) {
@@ -5983,8 +5995,7 @@ bool UnitTestImpl::RunAllTests() {
59835995
#endif // defined(GTEST_EXTRA_DEATH_TEST_CHILD_SETUP_)
59845996
#endif // GTEST_HAS_DEATH_TEST
59855997

5986-
const bool should_shard = ShouldShard(kTestTotalShards, kTestShardIndex,
5987-
in_subprocess_for_death_test);
5998+
const bool should_shard = ShouldShard(in_subprocess_for_death_test);
59885999

59896000
// Compares the full test names with the filter to decide which
59906001
// tests to run.
@@ -6196,45 +6207,44 @@ void WriteToShardStatusFileIfNeeded() {
61966207
}
61976208
#endif // GTEST_HAS_FILE_SYSTEM
61986209

6199-
// Checks whether sharding is enabled by examining the relevant
6200-
// environment variable values. If the variables are present,
6201-
// but inconsistent (i.e., shard_index >= total_shards), prints
6202-
// an error and exits. If in_subprocess_for_death_test, sharding is
6203-
// disabled because it must only be applied to the original test
6204-
// process. Otherwise, we could filter out death tests we intended to execute.
6205-
bool ShouldShard(const char* total_shards_env, const char* shard_index_env,
6206-
bool in_subprocess_for_death_test) {
6210+
// Checks whether sharding is enabled by examining the relevant command line
6211+
// arguments. If the arguments are present, but inconsistent
6212+
// (i.e., shard_index >= total_shards), prints an error and exits.
6213+
// If in_subprocess_for_death_test, sharding is disabled because it must only
6214+
// be applied to the original test process. Otherwise, we could filter out death
6215+
// tests we intended to execute.
6216+
bool ShouldShard(bool in_subprocess_for_death_test) {
62076217
if (in_subprocess_for_death_test) {
62086218
return false;
62096219
}
62106220

6211-
const int32_t total_shards = Int32FromEnvOrDie(total_shards_env, -1);
6212-
const int32_t shard_index = Int32FromEnvOrDie(shard_index_env, -1);
6221+
const int32_t total_shards = GTEST_FLAG_GET(total_shards);
6222+
const int32_t shard_index = GTEST_FLAG_GET(shard_index);
62136223

62146224
if (total_shards == -1 && shard_index == -1) {
62156225
return false;
62166226
} else if (total_shards == -1 && shard_index != -1) {
6217-
const Message msg = Message() << "Invalid environment variables: you have "
6218-
<< kTestShardIndex << " = " << shard_index
6219-
<< ", but have left " << kTestTotalShards
6220-
<< " unset.\n";
6227+
const Message msg = Message()
6228+
<< "Invalid sharding: you have " << kTestShardIndex
6229+
<< " = " << shard_index << ", but have left "
6230+
<< kTestTotalShards << " unset.\n";
62216231
ColoredPrintf(GTestColor::kRed, "%s", msg.GetString().c_str());
62226232
fflush(stdout);
62236233
exit(EXIT_FAILURE);
62246234
} else if (total_shards != -1 && shard_index == -1) {
62256235
const Message msg = Message()
6226-
<< "Invalid environment variables: you have "
6227-
<< kTestTotalShards << " = " << total_shards
6228-
<< ", but have left " << kTestShardIndex << " unset.\n";
6236+
<< "Invalid sharding: you have " << kTestTotalShards
6237+
<< " = " << total_shards << ", but have left "
6238+
<< kTestShardIndex << " unset.\n";
62296239
ColoredPrintf(GTestColor::kRed, "%s", msg.GetString().c_str());
62306240
fflush(stdout);
62316241
exit(EXIT_FAILURE);
62326242
} else if (shard_index < 0 || shard_index >= total_shards) {
62336243
const Message msg =
6234-
Message() << "Invalid environment variables: we require 0 <= "
6235-
<< kTestShardIndex << " < " << kTestTotalShards
6236-
<< ", but you have " << kTestShardIndex << "=" << shard_index
6237-
<< ", " << kTestTotalShards << "=" << total_shards << ".\n";
6244+
Message() << "Invalid sharding: we require 0 <= " << kTestShardIndex
6245+
<< " < " << kTestTotalShards << ", but you have "
6246+
<< kTestShardIndex << "=" << shard_index << ", "
6247+
<< kTestTotalShards << "=" << total_shards << ".\n";
62386248
ColoredPrintf(GTestColor::kRed, "%s", msg.GetString().c_str());
62396249
fflush(stdout);
62406250
exit(EXIT_FAILURE);
@@ -6277,11 +6287,10 @@ bool ShouldRunTestOnShard(int total_shards, int shard_index, int test_id) {
62776287
// . Returns the number of tests that should run.
62786288
int UnitTestImpl::FilterTests(ReactionToSharding shard_tests) {
62796289
const int32_t total_shards = shard_tests == HONOR_SHARDING_PROTOCOL
6280-
? Int32FromEnvOrDie(kTestTotalShards, -1)
6290+
? GTEST_FLAG_GET(total_shards)
62816291
: -1;
6282-
const int32_t shard_index = shard_tests == HONOR_SHARDING_PROTOCOL
6283-
? Int32FromEnvOrDie(kTestShardIndex, -1)
6284-
: -1;
6292+
const int32_t shard_index =
6293+
shard_tests == HONOR_SHARDING_PROTOCOL ? GTEST_FLAG_GET(shard_index) : -1;
62856294

62866295
const PositiveAndNegativeUnitTestFilter gtest_flag_filter(
62876296
GTEST_FLAG_GET(filter));
@@ -6810,6 +6819,8 @@ static bool ParseGoogleTestFlag(const char* const arg) {
68106819
GTEST_INTERNAL_PARSE_FLAG(print_utf8);
68116820
GTEST_INTERNAL_PARSE_FLAG(random_seed);
68126821
GTEST_INTERNAL_PARSE_FLAG(repeat);
6822+
GTEST_INTERNAL_PARSE_FLAG(shard_index);
6823+
GTEST_INTERNAL_PARSE_FLAG(total_shards);
68136824
GTEST_INTERNAL_PARSE_FLAG(recreate_environments_when_repeating);
68146825
GTEST_INTERNAL_PARSE_FLAG(shuffle);
68156826
GTEST_INTERNAL_PARSE_FLAG(stack_trace_depth);

β€Ždeps/minimatch/README.mdβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ objects.
1515
> you provide to this library in production systems.
1616
1717
_Any_ library in JavaScript that deals with matching string
18-
patterns using regular expressions will be subject to
18+
patterns using regular expressions will be subject to
1919
[ReDoS](https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS)
2020
if the pattern is generated using untrusted input.
2121

β€Ždeps/minimatch/dist/commonjs/ast.d.tsβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { MinimatchOptions, MMRegExp } from './index.js';
1+
import type { MinimatchOptions, MMRegExp } from './index.js';
22
export type ExtglobType = '!' | '?' | '+' | '*' | '@';
33
export declare class AST {
44
#private;
@@ -9,7 +9,7 @@ export declare class AST {
99
get hasMagic(): boolean | undefined;
1010
toString(): string;
1111
push(...parts: (string | AST)[]): void;
12-
toJSON(): any[];
12+
toJSON(): unknown[];
1313
isStart(): boolean;
1414
isEnd(): boolean;
1515
copyIn(part: AST | string): void;

β€Ždeps/minimatch/dist/commonjs/ast.d.ts.mapβ€Ž

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Ždeps/minimatch/dist/commonjs/ast.jsβ€Ž

Lines changed: 9 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Ždeps/minimatch/dist/commonjs/ast.js.mapβ€Ž

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Ždeps/minimatch/dist/commonjs/escape.d.tsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { MinimatchOptions } from './index.js';
1+
import type { MinimatchOptions } from './index.js';
22
/**
33
* Escape all magic characters in a glob pattern.
44
*

0 commit comments

Comments
Β (0)