tr_flags.js 927 B

123456789101112131415161718192021222324252627282930313233343536
  1. var through = require('through2');
  2. var browserify = require('../');
  3. var test = require('tap').test;
  4. var vm = require('vm');
  5. test('--debug passed to transforms', function (t) {
  6. var empty = require.resolve('../lib/_empty');
  7. t.plan(3);
  8. [true, false].forEach(function(debug) {
  9. var b = browserify(empty, { debug: debug });
  10. b.transform(function(file, opts) {
  11. t.equal(opts._flags.debug, debug, 'debug: ' + debug);
  12. return through();
  13. });
  14. b.bundle(function (err, src) {
  15. if (err) return t.fail(err.message);
  16. });
  17. });
  18. var b = browserify(empty, { debug: true });
  19. b.transform({
  20. _flags: Infinity
  21. }, function(file, opts) {
  22. t.equal(opts._flags, Infinity, 'transform arguents are preserved');
  23. return through();
  24. });
  25. b.bundle(function(err, src) {
  26. if (err) return t.fail(err.message);
  27. });
  28. });