bootstrap.js 664 B

12345678910111213141516171819202122232425262728
  1. const chai = require('chai')
  2. const sinon = require('sinon')
  3. // add chai.should()
  4. chai.should()
  5. // Load sinon-chai assertions so expect(stubFn).to.have.been.calledWith('abc')
  6. // has a nicer failure messages
  7. chai.use(require('sinon-chai'))
  8. // Load promise support for chai
  9. chai.use(require('chai-as-promised'))
  10. // Do not truncate assertion errors
  11. chai.config.truncateThreshold = 0
  12. // add support for mongoose in sinon
  13. require('sinon-mongoose')
  14. // Crash the process on an unhandled promise rejection
  15. process.on('unhandledRejection', err => {
  16. console.error('Unhandled promise rejection:', err)
  17. process.exit(1)
  18. })
  19. afterEach(function() {
  20. sinon.restore()
  21. })