Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

anonymous-fn.js 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. var tape = require('../');
  2. var tap = require('tap');
  3. var concat = require('concat-stream');
  4. var stripFullStack = require('./common').stripFullStack;
  5. var testWrapper = require('./anonymous-fn/test-wrapper');
  6. tap.test('inside anonymous functions', function (tt) {
  7. tt.plan(1);
  8. var test = tape.createHarness();
  9. var tc = function (rows) {
  10. var body = stripFullStack(rows.toString('utf8'));
  11. // Handle stack trace variation in Node v0.8
  12. body = body.replace(
  13. 'at Test.module.exports',
  14. 'at Test.<anonymous>'
  15. );
  16. tt.same(body, [
  17. 'TAP version 13',
  18. '# wrapped test failure',
  19. 'not ok 1 fail',
  20. ' ---',
  21. ' operator: fail',
  22. ' at: <anonymous> ($TEST/anonymous-fn.js:$LINE:$COL)',
  23. ' stack: |-',
  24. ' Error: fail',
  25. ' [... stack stripped ...]',
  26. ' at $TEST/anonymous-fn.js:$LINE:$COL',
  27. ' at Test.<anonymous> ($TEST/anonymous-fn/test-wrapper.js:$LINE:$COL)',
  28. ' [... stack stripped ...]',
  29. ' ...',
  30. '',
  31. '1..1',
  32. '# tests 1',
  33. '# pass 0',
  34. '# fail 1'
  35. ].join('\n') + '\n');
  36. };
  37. test.createStream().pipe(concat(tc));
  38. test('wrapped test failure', testWrapper(function (t) {
  39. t.fail('fail');
  40. t.end();
  41. }));
  42. });