Repositorio del curso CCOM4030 el semestre B91 del proyecto kilometro0

skip_explanation.js 2.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. var tap = require('tap');
  2. var test = require('../');
  3. var concat = require('concat-stream');
  4. var stripFullStack = require('./common').stripFullStack;
  5. tap.test('test skip explanations', function (assert) {
  6. assert.plan(1);
  7. var verify = function (output) {
  8. assert.equal(stripFullStack(output.toString('utf8')), [
  9. 'TAP version 13',
  10. '# SKIP (this skips)',
  11. '# some tests might skip',
  12. 'ok 1 this runs',
  13. 'ok 2 failing assert is skipped # SKIP',
  14. 'ok 3 this runs',
  15. '# incomplete test',
  16. 'ok 4 run sh',
  17. 'ok 5 run openssl # SKIP',
  18. '# incomplete test with explanation',
  19. 'ok 6 run sh (conditional skip) # SKIP',
  20. 'ok 7 run openssl # SKIP can\'t run on windows platforms',
  21. 'ok 8 this runs',
  22. '# too much explanation',
  23. 'ok 9 run openssl # SKIP Installer cannot work on windows and fails to add to PATH Err: (2401) denied',
  24. '',
  25. '1..9',
  26. '# tests 9',
  27. '# pass 9',
  28. '',
  29. '# ok',
  30. ''
  31. ].join('\n'));
  32. };
  33. var tapeTest = test.createHarness();
  34. tapeTest.createStream().pipe(concat(verify));
  35. tapeTest('(this skips)', { skip: true }, function (t) {
  36. t.fail('doesn\'t run');
  37. t.fail('this doesn\'t run too', { skip: false });
  38. t.end();
  39. });
  40. tapeTest('some tests might skip', function (t) {
  41. t.pass('this runs');
  42. t.fail('failing assert is skipped', { skip: true });
  43. t.pass('this runs');
  44. t.end();
  45. });
  46. tapeTest('incomplete test', function (t) {
  47. // var platform = process.platform; something like this needed
  48. var platform = 'win32';
  49. t.pass('run sh', { skip: platform !== 'win32' });
  50. t.pass('run openssl', { skip: platform === 'win32' });
  51. t.end();
  52. });
  53. tapeTest('incomplete test with explanation', function (t) {
  54. // var platform = process.platform; something like this needed
  55. var platform = 'win32';
  56. t.fail('run sh (conditional skip)', { skip: platform === 'win32' });
  57. t.fail('run openssl', { skip: platform === 'win32' && 'can\'t run on windows platforms' });
  58. t.pass('this runs');
  59. t.end();
  60. });
  61. tapeTest('too much explanation', function (t) {
  62. // var platform = process.platform; something like this needed
  63. var platform = 'win32';
  64. t.fail('run openssl',
  65. { skip: platform === 'win32' && 'Installer cannot work on windows\nand fails to add to PATH\n\n Err: (2401) denied' }
  66. );
  67. t.end();
  68. });
  69. });
  70. // vim: set softtabstop=4 shiftwidth=4: