Skip to content

tamasflamich/node-shy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shy

shy is a simple mocha extension that enables to write functional tests for your node based command line application.

Let's create the simplest cli app possible: echojs

First install the required dependencies

npm install mocha shy --save-dev

Create the executable js file (./bin/echojs.js)

#!/usr/bin/env node
process.stdout.write(process.argv.slice(2).join(' ') + '\n');

Configure package.json properly

...
"bin": {
	"echojs": "./bin/echojs.js"
},
"scripts": {
    "test": "./node_modules/.bin/_mocha --compilers shy:shy 
}
...

Write a simple functional test (./test/multi_input.shy)

shy track 'echojs hello world'

shy assert {stdout} = "hello world\n"

Run the tests

npm test

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published