Skip to content

Instantly share code, notes, and snippets.

@psaia
Last active September 11, 2017 23:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save psaia/ea274c3c4d67489e861539e2f30dc710 to your computer and use it in GitHub Desktop.
Save psaia/ea274c3c4d67489e861539e2f30dc710 to your computer and use it in GitHub Desktop.
Enable idiomatic "golang style" unit testing in node.js with mocha. Add this to npm's scripts or your pipeline.
#!/bin/sh
NODE_ENV=test mocha --recursive ./**/*_test.js
@psaia
Copy link
Author

psaia commented Sep 11, 2017

.
├── cli.js
├── cli_test.js
├── dashboard.js
├── dashboard_test.js
├── analytics.js
├── analytics_test.js
├── stats.js
└── stats_test.js

I find this much more readable than keeping them all in one directory together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment