cybertk / abao

REST API automated testing tool based on RAML
MIT License
353 stars 59 forks source link

ENOENT: no such file or directory, open 'templates/hookfile.js' #151

Closed aisensiy closed 8 years ago

aisensiy commented 8 years ago
abao doc.raml --generate-hooks > test_machines_hooks.js

And get error:

failed to generate skeleton hooks
ENOENT: no such file or directory, open 'templates/hookfile.js'
Error: ENOENT: no such file or directory, open 'templates/hookfile.js'
    at Error (native)
    at Object.fs.openSync (fs.js:585:18)
    at Object.fs.readFileSync (fs.js:432:33)
    at generateHooks (/usr/local/lib/node_modules/abao/lib/generate-hooks.coffee:17:21)
    at /usr/local/lib/node_modules/abao/lib/test-runner.coffee:93:20
    at fn (/usr/local/lib/node_modules/abao/node_modules/async/lib/async.js:638:34)
    at Immediate._onImmediate (/usr/local/lib/node_modules/abao/node_modules/async/lib/async.js:554:34)
plroebuck commented 8 years ago

Use the --template option to specify the location of the Mustache template file.

$ ABAO_HOME="/usr/local/lib/node_modules/abao"
$ TEMPLATE="${ABAO_HOME}/templates/hookfile.js"
$ RAML="doc.raml"
$ HOOKS="test_machines_hooks.js"
$ abao "${RAML}" --generate-hooks --template="${TEMPLATE}" > "${HOOKS}"
aisensiy commented 8 years ago

Thanks, I thought is --template is not required. Because the README has no --template parameter.

plroebuck commented 8 years ago

Yeah, don't know where that argument's description in the documentation went. I must have run the command I documented from the Abao installation directory; since that's not always the case, I'll see if I can determine the installation location programmatically and default appropriately, or document the solution above.