Skip to content

Commit 7aaa44a

Browse files
committed
Section 33: Ignoring Directories
1 parent 5cb5e24 commit 7aaa44a

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

33-Building-a-Testing-Framework-From-Scratch/01-testme/runner.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ const fs = require('fs')
22
const path = require('path')
33
const chalk = require('chalk')
44

5+
const forbiddenDirs = ['node_modules']
6+
57
class 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)))

33-Building-a-Testing-Framework-From-Scratch/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)