Running command line script looks like this:
$ node /path/script.js input.file output.file
Return value: {JSON}, on success or failure, one of the parameters in JSON is printing arguments (argv)
{"key": "value", ... , "argv":['/path/node', '/path/script.js', argv[2], arg[2],...]}
$ mocha --compilers coffee:coffee-script/register --colors
Script is checking existence of input.file.
Mocha is running itself (this is returned from script)
{ "key": "value", ... , "argv":['/path/node', '/path/mocha', '--compilers', 'coffee:coffee-script/register', '--colors' ] }
Returns: error that file not found. Everything is Sync. I need to test returning JSON on very case that can be in running script.
- file not found
- file not readable
- etc
Project
|--/src
|--+script.js
|--/test
|--+scriptTest
|--+mocha.opts
Can anyone point what I'm doing wrong? How should I run Mocha so it's inserting argv[2], argv[3], argv[4]... into script?
I'm new in Unit Testing.
Aucun commentaire:
Enregistrer un commentaire