abao
abao copied to clipboard
Abao Tests Not Running
My Abao tests are not running: upon running the test, I get the message: Found Hookfiles: tests/raml/test_machines_hooks.js
But none of the tests run as they did before.
Nothing has changed about the hookfiles or the RAML. Please advise what could have caused this issue
Didn't provide enough information for me to help.
- Which version of Abao? (current release: v0.5.3)
- Node version?
- Platform?
- OS Version?
- API endpoint running? Verified URL using browser or curl?
- "None of the tests run as before" -- what does that mean? No tests run? All run but fail?
- What did you expect to happen?
- What actually did?
Not there with you. Screenshots always nice.
I have a similar problem.
My environment is version v0.5.3, but the npm test fails. It fails if version of underscore.js is 1.9.0, it does not seem to have failed in 1.8.3.
I’ll keep you posted.
The Abao version is 0.5.0 The Node version is v9.4.0 Platform is OS Version 10.12.6 API endpoint is running - verified using Postman
In the past, when I ran my command abao ../raml/api.raml --hookfiles=tests/raml/test_machines_hooks.js --server http://localhost:5000
Found Hookfiles: tests/raml/test_machines_hooks.js GET /batches -> 200 ✓ Validate response code and body . .
However now I get:
Found Hookfiles: tests/raml/test_machines_hooks.js
- "before all" hook
- "after all" hook
0 passing (6ms) 2 failing
-
"before all" hook: TypeError: callback is not a function at /usr/local/lib/node_modules/abao/lib/hooks.coffee:76:16 at /usr/local/lib/node_modules/abao/node_modules/async/dist/async.js:3888:9 at /usr/local/lib/node_modules/abao/node_modules/async/dist/async.js:473:16 at replenish (/usr/local/lib/node_modules/abao/node_modules/async/dist/async.js:1006:25) at /usr/local/lib/node_modules/abao/node_modules/async/dist/async.js:1016:9 at eachOfLimit (/usr/local/lib/node_modules/abao/node_modules/async/dist/async.js:1041:24) at /usr/local/lib/node_modules/abao/node_modules/async/dist/async.js:1046:16 at parallel (/usr/local/lib/node_modules/abao/node_modules/async/dist/async.js:3879:5) at Object.series (/usr/local/lib/node_modules/abao/node_modules/async/dist/async.js:4735:5) at Hooks.runBeforeAll (/usr/local/lib/node_modules/abao/lib/hooks.coffee:75:20) at Hooks.runBeforeAll (/usr/local/lib/node_modules/abao/lib/hooks.coffee:3:59) at Object.mocha.suite.beforeAll..bind.hooks (/usr/local/lib/node_modules/abao/lib/test-runner.coffee:103:31) at executeBound (/usr/local/lib/node_modules/abao/node_modules/underscore/underscore.js:758:67) at Context.
(/usr/local/lib/node_modules/abao/node_modules/underscore/underscore.js:771:14) at Context. (/usr/local/lib/node_modules/abao/node_modules/underscore/underscore.js:122:29) -
"after all" hook: TypeError: callback is not a function at /usr/local/lib/node_modules/abao/lib/hooks.coffee:82:16 at /usr/local/lib/node_modules/abao/node_modules/async/dist/async.js:3888:9 at /usr/local/lib/node_modules/abao/node_modules/async/dist/async.js:473:16 at replenish (/usr/local/lib/node_modules/abao/node_modules/async/dist/async.js:1006:25) at /usr/local/lib/node_modules/abao/node_modules/async/dist/async.js:1016:9 at eachOfLimit (/usr/local/lib/node_modules/abao/node_modules/async/dist/async.js:1041:24) at /usr/local/lib/node_modules/abao/node_modules/async/dist/async.js:1046:16 at parallel (/usr/local/lib/node_modules/abao/node_modules/async/dist/async.js:3879:5) at Object.series (/usr/local/lib/node_modules/abao/node_modules/async/dist/async.js:4735:5) at Hooks.runAfterAll (/usr/local/lib/node_modules/abao/lib/hooks.coffee:81:20) at Hooks.runAfterAll (/usr/local/lib/node_modules/abao/lib/hooks.coffee:3:59) at Object.mocha.suite.afterAll..bind.hooks (/usr/local/lib/node_modules/abao/lib/test-runner.coffee:108:31) at executeBound (/usr/local/lib/node_modules/abao/node_modules/underscore/underscore.js:758:67) at Context.
(/usr/local/lib/node_modules/abao/node_modules/underscore/underscore.js:771:14) at Context. (/usr/local/lib/node_modules/abao/node_modules/underscore/underscore.js:122:29)
In another branch, I only get Found Hookfiles: tests/raml/test_machines_hooks.js but am not sure what may cause the rest to stop.
I would like to run it as it was before. Right now it either doesn't run at all or throws the error as above.
@jtodo, you have the exact same error, or something else?
@NikhilPunwaney, BTW, shouldn't your hookfile be named "test_batches_hooks.js" (format: "test_<endpoint>_hooks.js")
Can either of you provide me with a copy of something I can test locally? Would need hookfile, RAML, and copy of your endpoint code (abridged version would be fine).
Hi @plroebuck Here I attached the information you asked, sharing on behalf of @NikhilPunwaney . Please let me know if you need more details. hook_endpoint_to_test.zip
@plroebuck ,
Are you able to reproduce the issue? following details may help to reproduce the issue: The Abao version is 0.5.0 The Node version is v9.4.0 Platform is OS Version 10.12.6 API endpoint is running - verified using Postman Steps to run tests:
- Copy attached files into a folder
- Run following command in directory: abao api.raml --hookfiles=test_machines_hooks.js --server http://google.com hook_endpoint_to_test (1).zip
Console output: [~/Downloads/hook_endpoint_to_test]$ abao api.raml --hookfiles=test_machines_hooks.js --server http://google.com Found Hookfiles: test_machines_hooks.js
- "before all" hook
- "after all" hook
0 passing (10ms) 2 failing
-
"before all" hook: TypeError: callback is not a function at /usr/local/lib/node_modules/abao/lib/hooks.coffee:76:16 at /usr/local/lib/node_modules/abao/node_modules/async/dist/async.js:3888:9 at /usr/local/lib/node_modules/abao/node_modules/async/dist/async.js:473:16 at replenish (/usr/local/lib/node_modules/abao/node_modules/async/dist/async.js:1006:25) at /usr/local/lib/node_modules/abao/node_modules/async/dist/async.js:1016:9 at eachOfLimit (/usr/local/lib/node_modules/abao/node_modules/async/dist/async.js:1041:24) at /usr/local/lib/node_modules/abao/node_modules/async/dist/async.js:1046:16 at parallel (/usr/local/lib/node_modules/abao/node_modules/async/dist/async.js:3879:5) at Object.series (/usr/local/lib/node_modules/abao/node_modules/async/dist/async.js:4735:5) at Hooks.runBeforeAll (/usr/local/lib/node_modules/abao/lib/hooks.coffee:75:20) at Hooks.runBeforeAll (/usr/local/lib/node_modules/abao/lib/hooks.coffee:3:59) at Object.mocha.suite.beforeAll..bind.hooks (/usr/local/lib/node_modules/abao/lib/test-runner.coffee:103:31) at executeBound (/usr/local/lib/node_modules/abao/node_modules/underscore/underscore.js:758:67) at Context.
(/usr/local/lib/node_modules/abao/node_modules/underscore/underscore.js:771:14) at Context. (/usr/local/lib/node_modules/abao/node_modules/underscore/underscore.js:122:29) -
"after all" hook: TypeError: callback is not a function at /usr/local/lib/node_modules/abao/lib/hooks.coffee:82:16 at /usr/local/lib/node_modules/abao/node_modules/async/dist/async.js:3888:9 at /usr/local/lib/node_modules/abao/node_modules/async/dist/async.js:473:16 at replenish (/usr/local/lib/node_modules/abao/node_modules/async/dist/async.js:1006:25) at /usr/local/lib/node_modules/abao/node_modules/async/dist/async.js:1016:9 at eachOfLimit (/usr/local/lib/node_modules/abao/node_modules/async/dist/async.js:1041:24) at /usr/local/lib/node_modules/abao/node_modules/async/dist/async.js:1046:16 at parallel (/usr/local/lib/node_modules/abao/node_modules/async/dist/async.js:3879:5) at Object.series (/usr/local/lib/node_modules/abao/node_modules/async/dist/async.js:4735:5) at Hooks.runAfterAll (/usr/local/lib/node_modules/abao/lib/hooks.coffee:81:20) at Hooks.runAfterAll (/usr/local/lib/node_modules/abao/lib/hooks.coffee:3:59) at Object.mocha.suite.afterAll..bind.hooks (/usr/local/lib/node_modules/abao/lib/test-runner.coffee:108:31) at executeBound (/usr/local/lib/node_modules/abao/node_modules/underscore/underscore.js:758:67) at Context.
(/usr/local/lib/node_modules/abao/node_modules/underscore/underscore.js:771:14) at Context. (/usr/local/lib/node_modules/abao/node_modules/underscore/underscore.js:122:29)
@raj-bhagya, you sent a couple Python files but nothing that I could run myself. Unable to reproduce more than a portion of the required package, I can't do anything with what you provided.
Abao-0.6.0 now builds successfully with related patches to further lockdown dependencies. Install the new version and retry the test on your side.
@plroebuck , Our services are developed on Flask web application framework written in Python.
@plroebuck ,
I Installed latest development version Abao-0.6.0, but I'm encountering different error only with this version where as the previous version 0.5.0 is not throwing this error. I'm suspecting this could be because of node version compatibility, please suggest solution.
0.6.0 Installation output: sudo npm install -g git+https://[email protected]/cybertk/abao.git#0.6.0 Password: npm WARN deprecated [email protected]: CoffeeScript on NPM has moved to "coffeescript" (no hyphen) /usr/local/bin/abao -> /usr/local/lib/node_modules/abao/bin/abao
- [email protected] added 173 packages from 569 contributors in 8.551s
[~/repos/simile → develop]$ npm --version 6.1.0 [~/repos/simile → develop]$ node -v v10.2.1
Error: [~/repos/simile → develop]$ abao -v path.js:39 throw new ERR_INVALID_ARG_TYPE('path', 'string', path); ^
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type object
at assertPath (path.js:39:11)
at Object.basename (path.js:1299:5)
at parseArgs (/usr/local/lib/node_modules/abao/lib/cli.coffee:49:17)
at Object.main (/usr/local/lib/node_modules/abao/lib/cli.coffee:67:18)
at Object.
@raj-bhagya, I don't get an error on my side (displays usage) but to display the version type:
$ abao --version
Same error with abao --version also, basically getting this error with any abao command option.
[~/repos/simile/simile_web_service → develop]$ abao --version path.js:39 throw new ERR_INVALID_ARG_TYPE('path', 'string', path); ^
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type object
at assertPath (path.js:39:11)
at Object.basename (path.js:1299:5)
at parseArgs (/usr/local/lib/node_modules/abao/lib/cli.coffee:49:17)
at Object.main (/usr/local/lib/node_modules/abao/lib/cli.coffee:67:18)
at Object.
Line numbers don't exactly match expected, but only place basename
is used in CLI is here.
Original (line 35):
prog = path.basename pkg.bin
For quick test, change that line to be:
prog = 'abao'
What OS version for my reference?
I hardcoded value to prog = 'abao' in line 35, but still same issue. macOS 10.13.2
I'm running macOS-10.13.4 so OS-wise this code should have no problems. I was running Node-8.11.1, but to test this I upgraded to current development version without any changes to abao-0.6.0 GitHub release.
$ node --version
v10.3.0
$ bin/abao --version
0.6.0
What is displayed for this command?
$ which abao
Should be impossible to get the same error if you replaced Line 35 above with the hardcoded value!
$ which abao
/usr/local/bin/abao
Copy'n'paste the parseArgs
function from "cli.coffee" here.
Also:
$ npm list --depth=0
parseArgs = (argv) ->
'use strict'
allOptions = _.assign {}, abaoOptions, mochaOptions
mochaOptionNames = Object.keys mochaOptions
prog = path.basename pkg.bin
return yargs(argv)
.usage("Usage:\n #{prog} </path/to/raml> [OPTIONS]" +
"\n\nExample:\n #{prog} api.raml --server http://api.example.com")
.options(allOptions)
.group(mochaOptionNames, 'Options passed to Mocha:')
.implies('template', 'generate-hooks')
.check((argv) ->
if argv.reporters == true
showReporters()
process.exit EXIT_SUCCESS
# Ensure single positional argument present
if argv._.length < 1
throw new Error "#{prog}: must specify path to RAML file"
else if argv._.length > 1
throw new Error "#{prog}: accepts single positional command-line argument"
return true
)
.wrap(80)
.help('help', 'Show usage information and exit')
.version('version', 'Show version number and exit', pkg.version)
.epilog("Website:\n #{pkg.homepage}")
.argv
parseArgs = (argv) ->
'use strict'
allOptions = _.assign {}, abaoOptions, mochaOptions
mochaOptionNames = Object.keys mochaOptions
prog = path.basename pkg.bin <--- Thought you changed this line
return yargs(argv)
.usage("Usage:\n #{prog} </path/to/raml> [OPTIONS]" +
"\n\nExample:\n #{prog} api.raml --server http://api.example.com")
.options(allOptions)
...
I changed that line and tried. Meantime time I tired to downgrade node version to 8.11.1 and reinstalled abao-0.6.0 (Just to see if there is compatibility problem), that's why it changed back to original state. Sorry about the confusion. Here is the function code:
parseArgs = (argv) ->
'use strict'
allOptions = _.assign {}, abaoOptions, mochaOptions
mochaOptionNames = Object.keys mochaOptions
prog = 'abao'
return yargs(argv)
.usage("Usage:\n #{prog} </path/to/raml> [OPTIONS]" +
"\n\nExample:\n #{prog} api.raml --server http://api.example.com")
.options(allOptions)
.group(mochaOptionNames, 'Options passed to Mocha:')
.implies('template', 'generate-hooks')
.check((argv) ->
if argv.reporters == true
showReporters()
process.exit EXIT_SUCCESS
# Ensure single positional argument present
if argv._.length < 1
throw new Error "#{prog}: must specify path to RAML file"
else if argv._.length > 1
throw new Error "#{prog}: accepts single positional command-line argument"
return true
)
.wrap(80)
.help('help', 'Show usage information and exit')
.version('version', 'Show version number and exit', pkg.version)
.epilog("Website:\n #{pkg.homepage}")
.argv
[~/repos/simile/simile_web_service/tests/raml → develop]$ npm list --depth=0
[email protected] /Users/ramesh/repos/simile ├── [email protected] └── [email protected]
So I'm lost. If the code is changed, how are you still getting the same error referring to path.basename()
?
Need this from abao's perspective:
$ cd /usr/local/lib/node_modules/abao
$ npm list --depth=0
For me:
[email protected] /var/tmp/abao
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]
[/usr/local/lib/node_modules/abao]$ npm list --depth=0
[email protected] (git+https://[email protected]/cybertk/abao.git#20b9357daafb051d6f59db136f9b35b59a1eaa0e) /usr/local/lib/node_modules/abao
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]
Is there any other occurrence of basename? do I need to build anything after changing that line?
Rerun abao --version
and post the current error message
$ abao --version
path.js:39
throw new ERR_INVALID_ARG_TYPE('path', 'string', path);
^
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type object
at assertPath (path.js:39:11)
at Object.basename (path.js:1299:5)
at parseArgs (/usr/local/lib/node_modules/abao/lib/cli.coffee:49:17)
at Object.main (/usr/local/lib/node_modules/abao/lib/cli.coffee:67:18)
at Object.<anonymous> (/usr/local/lib/node_modules/abao/bin/abao:15:27)
at Module._compile (internal/modules/cjs/loader.js:702:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module._load (internal/modules/cjs/loader.js:543:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:744:10)
at startup (internal/bootstrap/node.js:238:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:572:3)
I got that fixed, there was a problem with my local setup. I was changing basename in one user's library not globally, changed it globally and working fine now. Sorry about that.
$ abao --version 0.6.0
Looks like raml tests are also running fine with "underscore": "1.8.3"
, I will confirm it soon. thanks!
Found the TypeError
problem you had above -- "npm" changes the "bin" field in "package.json" from string to a map when installed. Fix committed.
@plroebuck Tests are running now with 0.6.0 version with above fix, thanks. Just curious to know when is the Abao 0.6.0 expected to move to stable release?
@plroebuck Tests are running now with 0.6.0 version with above fix, thanks. Just curious to know when is the Abao 0.6.0 expected to move to stable release?
@raj-bhagya: How can I install Abao 0.6.0?
I tried the following
but still got 0.5.3