export.js 900 B

1234567891011121314151617181920212223242526272829303132333435
  1. var browserify = require('../');
  2. var vm = require('vm');
  3. var test = require('tap').test;
  4. test('no exports when no files are loaded', function (t) {
  5. t.plan(1);
  6. var b = browserify();
  7. b.bundle(function (err, src) {
  8. var c = {};
  9. vm.runInNewContext(src, c);
  10. t.same(Object.keys(c), []);
  11. });
  12. });
  13. test('no exports when entries are defined', function (t) {
  14. t.plan(1);
  15. var b = browserify();
  16. b.add(__dirname + '/export/entry.js');
  17. b.bundle(function (err, src) {
  18. var c = {};
  19. vm.runInNewContext(src, c);
  20. t.same(c, {});
  21. });
  22. });
  23. test('require export when files are required', function (t) {
  24. t.plan(1);
  25. var b = browserify();
  26. b.require(__dirname + '/export/entry.js');
  27. b.bundle(function (err, src) {
  28. var c = {};
  29. vm.runInNewContext(src, c);
  30. t.same(Object.keys(c), [ 'require' ]);
  31. });
  32. });