Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
ea86656
net: use `_final` instead of `on('finish')`
addaleax Feb 7, 2018
1fd4e4d
src: fix deprecation warning in node_perf.cc
danbev Feb 20, 2018
15c9a71
doc: remove CII badge in README
silverwind Feb 21, 2018
dfe0bc1
cluster: fix inspector port assignment
santigimeno Feb 10, 2018
9d73910
net: inline and simplify onSocketEnd
addaleax Feb 6, 2018
ad98ff1
vm: consolidate validation
timotew Feb 12, 2018
e29acf8
tools: fix custom eslint rule errors
BridgeAR Feb 18, 2018
04f0482
build, win: vcbuild improvements
bzoz Nov 13, 2017
e3f901c
http: allow _httpMessage to be GC'ed
lpinca Feb 19, 2018
2ad7cb9
test: http2 compat response.write() error checks
trivikr Feb 18, 2018
f6e2ba4
repl: fix tab-complete warning
killagu Feb 20, 2018
8773c10
src: fix abort when taking a heap snapshot
bnoordhuis Feb 21, 2018
4bce02a
http: remove default 'drain' listener on upgrade
lpinca Feb 19, 2018
b4e13b0
doc: fix link in onboarding.md
justin0022 Feb 20, 2018
8d0cc17
doc: update description of 'clientError' event
lpinca Feb 20, 2018
d240009
doc: remove extraneous "for example" text
Trott Feb 20, 2018
5477060
url: reduce deplicated codes in `autoEscapeStr`
starkwang Feb 7, 2018
d58dcec
deps: upgrade libuv to 1.19.2
cjihrig Feb 21, 2018
0075f8c
tools: ignore VS compiler output in deps/v8
targos Feb 23, 2018
89323da
src: remove node namespace qualifiers
danbev Feb 23, 2018
eb4ab48
doc: `readable.push(undefined)` in non-object mode
Jan 21, 2018
b5ecc45
doc: add process.debugPort to doc/api/process.md
flickz Feb 11, 2018
795f39b
doc: update 2fa information in onboarding.md
Trott Feb 24, 2018
415e777
doc: mention git-node in the collaborator guide
joyeecheung Feb 23, 2018
5c727a0
doc: remove `Returns: {undefined}`
Feb 21, 2018
534de4a
build: make gyp user defined variables lowercase
danbev Oct 16, 2017
70c9ad9
tools, test: fix prof polyfill readline
killagu Feb 11, 2018
8beecb2
build: include the libuv and zlib into node
yhwang Jan 17, 2018
61436e8
process: use more direct sync I/O for stdio
addaleax Dec 30, 2017
d2a752f
src: remove `HasWriteQueue()`
addaleax Dec 30, 2017
c8741ba
src: use `DoTryWrite()` for not-all-Buffer writev()s too
addaleax Jan 10, 2018
35b0936
tty: fix console printing on Windows
addaleax Jan 17, 2018
a3aebea
test: stdio pipe behavior tests
bzoz Feb 7, 2018
367241a
src: refactor stream callbacks and ownership
addaleax Jan 8, 2018
6a70933
src: simplify handles for libuv streams
addaleax Jan 24, 2018
3e1d810
test: introduce SetUpTestCase/TearDownTestCase
danbev Feb 3, 2018
337d529
lib: add `process` to internal module wrapper
addaleax Nov 21, 2017
fc2fc21
process: refactor nextTick for clarity
apapirovski Dec 18, 2017
7f9b554
process: do not directly schedule _tickCallback in _fatalException
apapirovski Dec 23, 2017
839a3f7
timers: make setImmediate() immune to tampering
bnoordhuis Dec 18, 2017
d82efdb
src: use AliasedBuffer for TickInfo
apapirovski Dec 27, 2017
d2475cc
timers: refactor setImmediate error handling
apapirovski Dec 26, 2017
2177138
timers: allow Immediates to be unrefed
apapirovski Jan 13, 2018
b04d42d
src, test: node internals' postmortem metadata
Dec 26, 2017
7d12ef6
test: fix cctest -Wunused-variable warning
bnoordhuis Feb 2, 2018
d26e658
src: do not redefine private for GenDebugSymbols
joyeecheung Feb 8, 2018
686a66d
build: add node_lib_target_name to cctest deps
danbev Feb 5, 2018
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
Prev Previous commit
Next Next commit
test: introduce SetUpTestCase/TearDownTestCase
This commit add SetUpTestCase and TearDownTestCase functions that will
be called once per test case. Currently we only have SetUp/TearDown
which are called for each test.

This commit moves the initialization and configuration of Node and V8 to
be done on a per test case basis, but gives each test a new Isolate.

Backport-PR-URL: #18957
PR-URL: #18558
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
  • Loading branch information
danbev authored and addaleax committed Feb 26, 2018
commit 3e1d8103a68a64b7368fe19e8eb2570f6d58dffe
5 changes: 4 additions & 1 deletion test/cctest/node_test_fixture.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#include "node_test_fixture.h"

uv_loop_t current_loop;
uv_loop_t NodeTestFixture::current_loop;
std::unique_ptr<node::NodePlatform> NodeTestFixture::platform;
std::unique_ptr<v8::ArrayBuffer::Allocator> NodeTestFixture::allocator;
v8::Isolate::CreateParams NodeTestFixture::params;
37 changes: 21 additions & 16 deletions test/cctest/node_test_fixture.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,42 +52,47 @@ struct Argv {
int nr_args_;
};

extern uv_loop_t current_loop;

class NodeTestFixture : public ::testing::Test {
public:
static uv_loop_t* CurrentLoop() { return &current_loop; }

node::MultiIsolatePlatform* Platform() const { return platform_; }
node::MultiIsolatePlatform* Platform() const { return platform.get(); }

protected:
static std::unique_ptr<v8::ArrayBuffer::Allocator> allocator;
static std::unique_ptr<node::NodePlatform> platform;
static v8::Isolate::CreateParams params;
static uv_loop_t current_loop;
v8::Isolate* isolate_;

virtual void SetUp() {
static void SetUpTestCase() {
platform.reset(new node::NodePlatform(4, nullptr));
allocator.reset(v8::ArrayBuffer::Allocator::NewDefaultAllocator());
params.array_buffer_allocator = allocator.get();
CHECK_EQ(0, uv_loop_init(&current_loop));
platform_ = new node::NodePlatform(8, nullptr);
v8::V8::InitializePlatform(platform_);
v8::V8::InitializePlatform(platform.get());
v8::V8::Initialize();
v8::Isolate::CreateParams params_;
params_.array_buffer_allocator = allocator_.get();
isolate_ = v8::Isolate::New(params_);
}

virtual void TearDown() {
platform_->Shutdown();
static void TearDownTestCase() {
platform->Shutdown();
while (uv_loop_alive(&current_loop)) {
uv_run(&current_loop, UV_RUN_ONCE);
}
v8::V8::ShutdownPlatform();
delete platform_;
platform_ = nullptr;
CHECK_EQ(0, uv_loop_close(&current_loop));
}

private:
node::NodePlatform* platform_ = nullptr;
std::unique_ptr<v8::ArrayBuffer::Allocator> allocator_{
v8::ArrayBuffer::Allocator::NewDefaultAllocator()};
virtual void SetUp() {
isolate_ = v8::Isolate::New(params);
CHECK_NE(isolate_, nullptr);
}

virtual void TearDown() {
isolate_->Dispose();
isolate_ = nullptr;
}
};

#endif // TEST_CCTEST_NODE_TEST_FIXTURE_H_