bundle_sourcemap.js 932 B

1234567891011121314151617181920212223242526272829303132
  1. var browserify = require('../');
  2. var test = require('tap').test;
  3. test('bundle in debug mode', function (t) {
  4. t.plan(3);
  5. var b = browserify({ debug: true });
  6. b.require('seq');
  7. b.bundle(function (err, buf) {
  8. var src = buf.toString('utf8');
  9. var secondtolastLine = src.split('\n').slice(-2);
  10. t.ok(typeof src === 'string');
  11. t.ok(src.length > 0);
  12. t.ok(/^\/\/# sourceMappingURL=/.test(secondtolastLine), 'includes sourcemap');
  13. });
  14. });
  15. test('bundle in non debug mode', function (t) {
  16. t.plan(3);
  17. var b = browserify();
  18. b.require('seq');
  19. b.bundle(function (err, buf) {
  20. var src = buf.toString('utf8');
  21. var secondtolastLine = src.split('\n').slice(-2);
  22. t.ok(typeof src === 'string');
  23. t.ok(src.length > 0);
  24. t.notOk(/^\/\/# sourceMappingURL=/.test(secondtolastLine), 'includes no sourcemap');
  25. });
  26. });