Created
July 25, 2017 20:36
-
-
Save jsturtevant/b6f32c8250f7ac2cd81b42157ea0d2dc to your computer and use it in GitHub Desktop.
Azure Functions VS Code debugging scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "Attach to Azure Functions", | |
"type": "node", | |
"request": "attach", | |
"port": 5858 | |
}, | |
{ | |
"type": "node", | |
"request": "launch", | |
"name": "Run Tests", | |
"program": "${workspaceRoot}\\tests\\test-runner.js", | |
"args": [ | |
"./tests" //run all the tests | |
] | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var test = require('tape'); | |
var path = require('path'); | |
var fs = require('fs'); | |
test.createStream().pipe(process.stdout); | |
var testDir = process.argv[2]; | |
// https://stackoverflow.com/a/21459809/697126 | |
var getAllFilesFromFolder = function(dir) { | |
var results = []; | |
fs.readdirSync(dir).forEach(function(file) { | |
file = dir+'/'+file; | |
var stat = fs.statSync(file); | |
if (stat && stat.isDirectory()) { | |
results = results.concat(getAllFilesFromFolder(file)) | |
} else results.push(file); | |
}); | |
return results; | |
}; | |
var testFiles = getAllFilesFromFolder(testDir).filter(x => {return x.endsWith('.test.js')}); | |
testFiles.forEach(file => { | |
console.log('running test file: ' + file); | |
var pathToModule = path.resolve(file); | |
require(pathToModule); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment