Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ab1a4eb

Browse filesBrowse files
refacktargos
authored andcommitted
test: drain platform before unregistering isolate
Backport-PR-URL: #28005 PR-URL: #27375 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent ad3a164 commit ab1a4eb
Copy full SHA for ab1a4eb

File tree

Expand file treeCollapse file tree

2 files changed

+14
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+14
-0
lines changed
Open diff view settings
Collapse file

‎test/cctest/node_test_fixture.h‎

Copy file name to clipboardExpand all lines: test/cctest/node_test_fixture.h
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ class NodeTestFixture : public ::testing::Test {
107107
void TearDown() override {
108108
isolate_->Exit();
109109
isolate_->Dispose();
110+
platform->DrainTasks(isolate_);
110111
platform->UnregisterIsolate(isolate_);
111112
isolate_ = nullptr;
112113
}
Collapse file

‎test/cctest/test_environment.cc‎

Copy file name to clipboardExpand all lines: test/cctest/test_environment.cc
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,19 @@ TEST_F(EnvironmentTest, MultipleEnvironmentsPerIsolate) {
8888
EXPECT_TRUE(called_cb_2);
8989
}
9090

91+
TEST_F(EnvironmentTest, NoEnvironmentSanity) {
92+
const v8::HandleScope handle_scope(isolate_);
93+
v8::Local<v8::Context> context = v8::Context::New(isolate_);
94+
EXPECT_EQ(node::Environment::GetCurrent(context), nullptr);
95+
EXPECT_EQ(node::GetCurrentEnvironment(context), nullptr);
96+
EXPECT_EQ(node::Environment::GetCurrent(isolate_), nullptr);
97+
98+
v8::Context::Scope context_scope(context);
99+
EXPECT_EQ(node::Environment::GetCurrent(context), nullptr);
100+
EXPECT_EQ(node::GetCurrentEnvironment(context), nullptr);
101+
EXPECT_EQ(node::Environment::GetCurrent(isolate_), nullptr);
102+
}
103+
91104
TEST_F(EnvironmentTest, NonNodeJSContext) {
92105
const v8::HandleScope handle_scope(isolate_);
93106
const Argv argv;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.