catch.js 556 B

12345678910111213141516171819202122
  1. var browserify = require('../');
  2. var test = require('tap').test;
  3. test('catch pipeline errors with a callback', function (t) {
  4. t.plan(2);
  5. var b = browserify(__dirname + '/catch/main.js');
  6. b.bundle(function (err, src) {
  7. t.ok(err);
  8. t.ok(/no_such_file/.test(err));
  9. });
  10. });
  11. test('catch pipeline errors with an event', function (t) {
  12. t.plan(2);
  13. var b = browserify(__dirname + '/catch/main.js').bundle();
  14. b.on('error', function (err) {
  15. t.ok(err);
  16. t.ok(/no_such_file/.test(err));
  17. });
  18. });