File tree Expand file tree Collapse file tree 3 files changed +22
-1
lines changed
Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,11 @@ To create and debug a test:
121121- Run ` npm run test:debug`
122122- In the opened window, click the Debug button and place breakpoints in browser debugger.
123123
124+ To run a subset of tests matching a pattern:
125+ ` ` ` sh
126+ $ VTKJS_TEST_PATTERN=ConeSource npm test
127+ ` ` `
128+
124129# # Updating Documentation
125130
126131The vtk.js documentation is part of the code repository and is entirely written in
Original file line number Diff line number Diff line change 33 * entrypoints into one chunk. This cuts down on extraneous
44 * code generation and addresses a race issue with the
55 * timer task queue.
6+ *
7+ * Optional filtering:
8+ * VTKJS_TEST_PATTERN=ConeSource npm test
9+ * VTKJS_TEST_PATTERN=Filters/Sources/ConeSource/test npm test
610 */
711
12+ /* global __VTKJS_TEST_PATTERN__ */
13+
814import './setupTestEnv' ;
915
1016// webpack will include files that match the regex
1117// '..' refers to the Sources/ dir
1218const testsContext = require . context ( '..' , true , / t e s t [ ^ / ] + \. j s $ / ) ;
13- testsContext . keys ( ) . forEach ( testsContext ) ;
19+
20+ const testPattern =
21+ typeof __VTKJS_TEST_PATTERN__ !== 'undefined' ? __VTKJS_TEST_PATTERN__ : '' ;
22+ const testKeys = testsContext . keys ( ) ;
23+
24+ if ( testPattern ) {
25+ testKeys . filter ( ( key ) => key . includes ( testPattern ) ) . forEach ( testsContext ) ;
26+ } else {
27+ testKeys . forEach ( testsContext ) ;
28+ }
Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ module.exports = function init(config) {
5858 new ESLintPlugin ( ) ,
5959 new webpack . DefinePlugin ( {
6060 __BASE_PATH__ : "'/base'" ,
61+ __TEST_PATTERN__ : JSON . stringify ( process . env . VTKJS_TEST_PATTERN || '' ) ,
6162 } ) ,
6263 new webpack . ProvidePlugin ( { process : [ 'process/browser' ] } ) ,
6364 ] ,
You can’t perform that action at this time.
0 commit comments