Skip to content

Instantly share code, notes, and snippets.

@psaia
Last active September 11, 2017 23:58
Show Gist options
  • Select an option

  • Save psaia/ea274c3c4d67489e861539e2f30dc710 to your computer and use it in GitHub Desktop.

Select an option

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

psaia commented Sep 11, 2017

Copy link
Copy Markdown
Author
.
├── 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