MCPcopy Create free account
hub / github.com/FSGModding/FSG_Mod_Assistant / tester

Function tester

test/tests/sourcecode.js:19–53  ·  view source on GitHub ↗
(test)

Source from the content-addressed store, hash-verified

17}
18
19async function tester (test) {
20 const promiseArray = []
21 const rootPath = path.join(__dirname, '..', '..')
22 const eslint = new ESLint()
23
24 const thisPath = path.join(__dirname, '..', '..', '**', '*.js').split(path.sep).join('/')
25 const jsFiles = globSync(thisPath, { absolute : true })
26
27 for ( const file of jsFiles ) {
28 const thisFile = path.relative(rootPath, file)
29
30 if ( thisFile.startsWith('node_modules') || thisFile.startsWith('jsdoc_server') || thisFile.includes('inc') ) {
31 continue
32 }
33
34 const problems = []
35
36 promiseArray.push(eslint.lintFiles(file).then((result) => {
37 if ( result[0].errorCount > 0 ) {
38 problems.push(`${result[0].errorCount} Errors`)
39 }
40 if ( result[0].warningCount > 0 ) {
41 problems.push(`${result[0].warningCount} Warnings`)
42 }
43 if ( problems.length !== 0 ) {
44 test.error(`${thisFile} has ${problems.join(' and ')}`)
45 } else {
46 test.step(`${thisFile} is clean`)
47 }
48 }).catch((err) => {
49 test.error(err)
50 }))
51 }
52 return Promise.all(promiseArray)
53}

Callers 1

sourcecode.jsFile · 0.70

Calls 2

stepMethod · 0.80
errorMethod · 0.45

Tested by

no test coverage detected