only_execute_entries.js 526 B

1234567891011121314151617181920212223242526
  1. var test = require('tap').test;
  2. var pack = require('../');
  3. test('raw', function (t) {
  4. t.plan(1);
  5. var p = pack({ raw: true });
  6. var src = '';
  7. p.on('data', function (buf) { src += buf });
  8. p.on('end', function () {
  9. var r = Function(['T'], 'return ' + src)(t);
  10. });
  11. p.write({
  12. id: 'abc',
  13. source: 'T.ok(true)',
  14. entry: true,
  15. });
  16. p.write({
  17. id: 'xyz',
  18. source: 'T.fail("non-entry files should not execute")'
  19. });
  20. p.end();
  21. });