function syntaxTest(test) {
	var cbCounter = 0

	// get possible custom settings from file
	var defaults = getDefaults()

	// look for syntax errors in all .js files
	var counts = {}
	var t = new Date
	scanFolder(deployFolder)

	function end(err) {

		if (err) throw err
		if (--cbCounter == 0) {
			// print file counts
			var s = []
			Object.keys(fileTypeMap).forEach(function (countKey) {
				s.push(countKey + ':' + counts[countKey])
			})
			console.log('Files checked for syntax:', s.join(', '), 'in', (((new Date) - t) / 1e3).toFixed(1),'s')

			test.done()
		}
	}

	function scanFolder(folder) {
		//console.log(arguments.callee.name, folder)
		cbCounter++
		fs.readdir(folder, function (err, entries) {
			if (!err) {
				entries.forEach(function (entry) {

					// ignore hidden file (start with '.')
					if (entry.substring(0, 1) != '.') {
						var absolutePath = path.join(folder, entry)
						var relativePath = absolutePath.substring(deployFolder.length + 1)

						// check against ignore list
						if (defaults.ignore.indexOf(relativePath) == -1) {
							if (getType(absolutePath) === false) {

								// recursively scan folders
								scanFolder(absolutePath)
							} else {
								var entryExtension = path.extname(entry).substring(1)
								var fileTypeKey = defaults.extensions[entryExtension]
								if (fileTypeKey) {
									counts[fileTypeKey] = (counts[fileTypeKey] || 0) + 1
									var parseFunc = fileTypeMap[fileTypeKey]
									if (parseFunc) {

										// check syntax of json and JavaScript files
										cbCounter++
										parseFunc(absolutePath, relativePath, test, end)
									}
								}
							}
						}
					}
				})
			}
			end(err)
		})
	}
}
// verify syntax of applicable files (JavaScript and json)
verify syntax of applicable files (JavaScript and json)
verify syntax of applicable files ( JavaScript and json )
function syntaxTest(test) {
	var cbCounter = 0
	var defaults = getDefaults()
	var counts = {}
	var t = new Date
	scanFolder(deployFolder)
	function end(err) {
		if (err) throw err
		if (--cbCounter == 0) {
			var s = []
			Object.keys(fileTypeMap).forEach(function (countKey) {
				s.push(countKey + ':' + counts[countKey])
			})
			console.log('Files checked for syntax:', s.join(', '), 'in', (((new Date) - t) / 1e3).toFixed(1),'s')
			test.done()
		}
	}
	function scanFolder(folder) {
		cbCounter++
		fs.readdir(folder, function (err, entries) {
			if (!err) {
				entries.forEach(function (entry) {
					if (entry.substring(0, 1) != '.') {
						var absolutePath = path.join(folder, entry)
						var relativePath = absolutePath.substring(deployFolder.length + 1)
						if (defaults.ignore.indexOf(relativePath) == -1) {
							if (getType(absolutePath) === false) {
								scanFolder(absolutePath)
							} else {
								var entryExtension = path.extname(entry).substring(1)
								var fileTypeKey = defaults.extensions[entryExtension]
								if (fileTypeKey) {
									counts[fileTypeKey] = (counts[fileTypeKey] || 0) + 1
									var parseFunc = fileTypeMap[fileTypeKey]
									if (parseFunc) {
										cbCounter++
										parseFunc(absolutePath, relativePath, test, end)
									}
								}
							}
						}
					}
				})
			}
			end(err)
		})
	}
}
function syntaxTest ( test ) { var cbCounter = 0 var defaults = getDefaults ( ) var counts = { } var t = new Date scanFolder ( deployFolder ) function end ( err ) { if ( err ) throw err if ( -- cbCounter == 0 ) { var s = [ ] Object . keys ( fileTypeMap ) . forEach ( function ( countKey ) { s . push ( countKey + ':' + counts [ countKey ] ) } ) console . log ( 'Files checked for syntax:' , s . join ( ', ' ) , 'in' , ( ( ( new Date ) - t ) / 1e3 ) . toFixed ( 1 ) , 's' ) test . done ( ) } } function scanFolder ( folder ) { cbCounter ++ fs . readdir ( folder , function ( err , entries ) { if ( ! err ) { entries . forEach ( function ( entry ) { if ( entry . substring ( 0 , 1 ) != '.' ) { var absolutePath = path . join ( folder , entry ) var relativePath = absolutePath . substring ( deployFolder . length + 1 ) if ( defaults . ignore . indexOf ( relativePath ) == - 1 ) { if ( getType ( absolutePath ) === false ) { scanFolder ( absolutePath ) } else { var entryExtension = path . extname ( entry ) . substring ( 1 ) var fileTypeKey = defaults . extensions [ entryExtension ] if ( fileTypeKey ) { counts [ fileTypeKey ] = ( counts [ fileTypeKey ] || 0 ) + 1 var parseFunc = fileTypeMap [ fileTypeKey ] if ( parseFunc ) { cbCounter ++ parseFunc ( absolutePath , relativePath , test , end ) } } } } } } ) } end ( err ) } ) } }
verify syntax of applicable files (JavaScript and json)
verify syntax of applicable files ( JavaScript and json )
// get possible custom settings from file // look for syntax errors in all .js files // print file counts //console.log(arguments.callee.name, folder) // ignore hidden file (start with '.') // check against ignore list // recursively scan folders // check syntax of json and JavaScript files