emit-error.js 366 B

1234567891011121314
  1. 'use strict';
  2. var customError = require('es5-ext/error/custom')
  3. , ee = require('../');
  4. module.exports = function (t, a) {
  5. var x, error = customError('Some error', 'ERROR_TEST'), emitted;
  6. x = ee();
  7. a.throws(function () { t.call(x, error); }, 'ERROR_TEST');
  8. x.on('error', function (err) { emitted = err; });
  9. t.call(x, error);
  10. a(emitted, error);
  11. };