Last active
January 29, 2019 11:55
-
-
Save AshKyd/0275db246644b1f4616abf4eea9b07cb to your computer and use it in GitHub Desktop.
Mocha tests: Quick script to set up mocha testing in a project.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Install mocha in the background | |
npm install mocha --save-dev | |
# Make test folder & add a sample test | |
mkdir -p test/data | |
curl https://gist.githubusercontent.com/AshKyd/0275db246644b1f4616abf4eea9b07cb/raw/test.js?`date +%s` > test/index.js | |
# Add test command to npm scripts | |
npx json -f package.json --in-place -e 'this.scripts.test = "mocha test/**"' | |
# Run the tests | |
npm test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const assert = require('assert'); | |
describe('basic operation', () => { | |
it('should start', () => { | |
// do something | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment