* Returns a task function after making sure it is valid. * @param {string} taskSourceFileName * @param {string} taskFuncName * @return {TaskFuncDef}
(taskSourceFileName, taskFuncName)
| 153 | * @return {TaskFuncDef} |
| 154 | */ |
| 155 | function getTaskFunc(taskSourceFileName, taskFuncName) { |
| 156 | const taskSourceFilePath = getTaskSourceFilePath(taskSourceFileName); |
| 157 | const taskFunc = require(taskSourceFilePath)[taskFuncName]; |
| 158 | const isValidFunc = typeof taskFunc == 'function'; |
| 159 | if (!isValidFunc) { |
| 160 | handleInvalidTaskError(taskSourceFileName, taskFuncName); |
| 161 | } |
| 162 | return taskFunc; |
| 163 | } |
| 164 | |
| 165 | /** |
| 166 | * Uses esprima to extract the description from a task file without require-ing |
no test coverage detected