File tree Expand file tree Collapse file tree
33-Building-a-Testing-Framework-From-Scratch Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ const fs = require('fs')
22const path = require ( 'path' )
33const chalk = require ( 'chalk' )
44
5+ const forbiddenDirs = [ 'node_modules' ]
6+
57class Runner {
68 constructor ( ) {
79 this . testFiles = [ ]
@@ -46,7 +48,7 @@ class Runner {
4648
4749 if ( stats . isFile ( ) && file . includes ( '.test.js' ) ) {
4850 this . testFiles . push ( { name : filepath , shortName : file } )
49- } else if ( stats . isDirectory ( ) ) {
51+ } else if ( stats . isDirectory ( ) && ! forbiddenDirs . includes ( file ) ) {
5052 const childFiles = await fs . promises . readdir ( filepath )
5153
5254 files . push ( ...childFiles . map ( ( f ) => path . join ( file , f ) ) )
Original file line number Diff line number Diff line change @@ -33,4 +33,6 @@ Terminal command: `testme`
3333
3434## 10. 11 Adding Colors
3535
36- ## 11. 12 Better Formatting
36+ ## 11. 12 Better Formatting
37+
38+ ## 12. 13 Ignoring Directories
You can’t perform that action at this time.
0 commit comments