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
157157npm test --disable-deprecated
158158```
159159
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+
160169### ** Debug**
161170
162171To 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 = [
6262 'version_management'
6363] ;
6464
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+
6674const majorNodeVersion = process . versions . node . split ( '.' ) [ 0 ]
6775
6876if ( napiVersion < 3 ) {
You can’t perform that action at this time.
0 commit comments