File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -157,6 +157,15 @@ npm install
157
157
npm test --disable-deprecated
158
158
```
159
159
160
+ To run the tests targetting a specific version of N-API run
161
+ ```
162
+ npm install
163
+ export NAPI_VERSION=X
164
+ npm test --NAPI_VERSION=X
165
+ ```
166
+
167
+ where X is the version of N-API you want to target.
168
+
160
169
### ** Debug**
161
170
162
171
To run the ** node-addon-api** tests with ` --debug ` option:
Original file line number Diff line number Diff line change @@ -62,7 +62,15 @@ let testModules = [
62
62
'version_management'
63
63
] ;
64
64
65
- const napiVersion = Number ( process . versions . napi )
65
+ let napiVersion = Number ( process . versions . napi )
66
+ if ( process . env . NAPI_VERSION ) {
67
+ // we need this so that we don't try run tests that rely
68
+ // on methods that are not available in the NAPI_VERSION
69
+ // specified
70
+ napiVersion = process . env . NAPI_VERSION ;
71
+ }
72
+ console . log ( 'napiVersion:' + napiVersion ) ;
73
+
66
74
const majorNodeVersion = process . versions . node . split ( '.' ) [ 0 ]
67
75
68
76
if ( napiVersion < 3 ) {
You can’t perform that action at this time.
0 commit comments