backbone.js 607 B

1234567891011121314151617181920212223
  1. var browserify = require('../');
  2. var vm = require('vm');
  3. var backbone = require('backbone');
  4. var test = require('tap').test;
  5. test('backbone', function (t) {
  6. t.plan(3);
  7. var b = browserify();
  8. b.require('backbone');
  9. b.bundle(function (err, buf) {
  10. t.ok(Buffer.isBuffer(buf));
  11. var src = buf.toString('utf8');
  12. t.ok(src.length > 0);
  13. var c = { console: console };
  14. vm.runInNewContext(src, c);
  15. t.deepEqual(
  16. Object.keys(backbone).sort(),
  17. Object.keys(c.require('backbone')).sort()
  18. );
  19. t.end();
  20. });
  21. });