Skip to content

Instantly share code, notes, and snippets.

@imaman
Last active November 20, 2018 08:19
Show Gist options
  • Select an option

  • Save imaman/0c428ccc0eac32b76f493fcaa7985571 to your computer and use it in GitHub Desktop.

Select an option

Save imaman/0c428ccc0eac32b76f493fcaa7985571 to your computer and use it in GitHub Desktop.
ts unit testing boilerplate
npm install --save-dev mocha ts-node chai chai-subset @types/chai @types/mocha @types/chai-subset
cp /dev/stdin src/u.test.ts <<EOF
import * as chai from 'chai';
import chaiSubset = require('chai-subset');
chai.use(chaiSubset);
const {expect} = chai;
import 'mocha';
describe('a', () => {
it('is doing something', () => {
expect(4 + 8).to.equal(12);
});
});
EOF
package.json > scripts:
"unit": "mocha -r ts-node/register src/**/*.test.ts"
https://github.com/testimio/data-platform/commit/611822d40ef84561d37fe844b53821bba7753482
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment