MCPcopy Create free account
hub / github.com/breck7/scroll / testCommand

Method testCommand

scroll.js:102–129  ·  view source on GitHub ↗
(cwd, filenames)

Source from the content-addressed store, hash-verified

100 }
101
102 async testCommand(cwd, filenames) {
103 const start = Date.now()
104 const folder = this.resolvePath(cwd)
105 let target = cwd
106 let scrollErrors = []
107 let fileCount = 0
108 if (filenames && filenames.length) {
109 const files = await this.getFiles(cwd, filenames)
110 scrollErrors = await this.getErrorsInFiles(files)
111 target = filenames.join(" ")
112 fileCount = files.length
113 } else {
114 scrollErrors = await this.getErrorsInFolder(folder)
115 const files = await this._getFilesInFolder(folder)
116 fileCount = files.length
117 }
118
119 const seconds = (Date.now() - start) / 1000
120
121 if (scrollErrors.length) {
122 this.log(``)
123 this.log(`❌ ${scrollErrors.length} errors in "${cwd}"`)
124 this.log(new Particle(scrollErrors).toFormattedTable(100))
125 this.log(``)
126 }
127 if (!scrollErrors.length) return this.log(`✅ 0 errors in "${target}". ${fileCount} files tested in ${seconds} seconds.`)
128 return `${scrollErrors.length} Errors`
129 }
130
131 async formatCommand(cwd, filenames) {
132 let files = []

Callers 1

scroll.test.jsFile · 0.80

Calls 8

getFilesMethod · 0.95
getErrorsInFilesMethod · 0.95
getErrorsInFolderMethod · 0.95
_getFilesInFolderMethod · 0.95
logMethod · 0.80
toFormattedTableMethod · 0.80
resolvePathMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected