File tree Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ let testModules = [
55
55
'objectwrap_constructor_exception' ,
56
56
'objectwrap-removewrap' ,
57
57
'objectwrap_multiple_inheritance' ,
58
+ 'objectwrap_worker_thread' ,
58
59
'objectreference' ,
59
60
'reference' ,
60
61
'version_management'
@@ -90,6 +91,10 @@ if (napiVersion < 6) {
90
91
testModules . splice ( testModules . indexOf ( 'typedarray-bigint' ) , 1 ) ;
91
92
}
92
93
94
+ if ( majorNodeVersion < 12 ) {
95
+ testModules . splice ( testModules . indexOf ( 'objectwrap_worker_thread' ) , 1 ) ;
96
+ }
97
+
93
98
if ( typeof global . gc === 'function' ) {
94
99
( async function ( ) {
95
100
console . log ( `Testing with N-API Version '${ napiVersion } '.` ) ;
Original file line number Diff line number Diff line change @@ -40,6 +40,14 @@ class Test : public Napi::ObjectWrap<Test> {
40
40
info.This ().As <Napi::Object>().DefineProperty (
41
41
Napi::PropertyDescriptor::Accessor<OwnPropertyGetter>(" ownPropertyT" ,
42
42
napi_enumerable, this ));
43
+
44
+ bufref_ = Napi::Persistent (Napi::Buffer<uint8_t >::New (
45
+ Env (),
46
+ static_cast <uint8_t *>(malloc (1 )),
47
+ 1 ,
48
+ [](Napi::Env, uint8_t * bufaddr) {
49
+ free (bufaddr);
50
+ }));
43
51
}
44
52
45
53
static Napi::Value OwnPropertyGetter (const Napi::CallbackInfo& info) {
@@ -183,6 +191,8 @@ class Test : public Napi::ObjectWrap<Test> {
183
191
Napi::FunctionReference finalizeCb_;
184
192
185
193
static std::string s_staticMethodText;
194
+
195
+ Napi::Reference<Napi::Buffer<uint8_t >> bufref_;
186
196
};
187
197
188
198
std::string Test::s_staticMethodText;
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+ const buildType = process . config . target_defaults . default_configuration ;
3
+ const { Worker, isMainThread } = require ( 'worker_threads' ) ;
4
+
5
+ if ( isMainThread ) {
6
+ new Worker ( __filename ) ;
7
+ } else {
8
+ const test = binding => {
9
+ new binding . objectwrap . Test ( ) ;
10
+ } ;
11
+
12
+ test ( require ( `./build/${ buildType } /binding.node` ) ) ;
13
+ test ( require ( `./build/${ buildType } /binding_noexcept.node` ) ) ;
14
+ }
You can’t perform that action at this time.
0 commit comments