@@ -70,27 +70,37 @@ npm test --NAPI_VERSION=X
7070
7171where X is the version of Node-API you want to target.
7272
73- To run a specific unit test, filter conditions are available
73+ To run a subset of the test suite, filter conditions are available.
74+ The ` --filter ` option limits which JavaScript test modules are executed by
75+ ` node test ` . The default ` pretest ` step is still ` node-gyp rebuild -C test ` ,
76+ so ` npm test --filter=... ` still performs a full rebuild of the test addon
77+ targets before the filtered tests run.
7478
7579** Example:**
76- compile and run only tests on objectwrap.cc and objectwrap.js
80+ perform the default test rebuild, then run only the ` objectwrap ` test module
7781 ```
78- npm run unit --filter=objectwrap
82+ npm test --filter=objectwrap
7983 ```
8084
81- Multiple unit tests cane be selected with wildcards
85+ Multiple test modules can be selected with wildcards.
8286
8387** Example:**
84- compile and run all test files ending with "reference" -> function_reference.cc, object_reference.cc, reference.cc
88+ perform the default test rebuild, then run all test modules ending with
89+ ` reference ` :
90+ ` function_reference ` , ` object_reference ` , and ` reference `
8591 ```
86- npm run unit --filter=*reference
92+ npm test --filter=*reference
8793 ```
8894
89- Multiple filter conditions can be joined to broaden the test selection
95+ Multiple filter conditions can be joined to broaden the test selection.
9096
9197** Example:**
92- compile and run all tests under folders threadsafe_function and typed_threadsafe_function and also the objectwrap.cc file
93- npm run unit --filter='* function objectwrap'
98+ perform the default test rebuild, then run all tests under
99+ ` threadsafe_function ` and ` typed_threadsafe_function ` , and also the
100+ ` objectwrap ` test module
101+ ```
102+ npm test --filter='*function objectwrap'
103+ ```
94104
95105As an alternative, ` ninja ` can be used to build the tests. Please
96106follow the instructions in [ Build with ninja] ( doc/contributing/build_with_ninja.md ) .
@@ -203,4 +213,3 @@ The downside of this approach is the following:
203213authors might not find the right patterns and instead implement things themselves
204214- There might be greater friction for the Node-API WG in evolving APIs since the
205215ecosystem would have taken dependencies on the API shape of ** node-addon-api**
206-
0 commit comments