chai.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*!
  2. * chai
  3. * Copyright(c) 2011-2012 Jake Luer <jake@alogicalparadox.com>
  4. * MIT Licensed
  5. */
  6. var used = []
  7. , exports = module.exports = {};
  8. /*!
  9. * Chai version
  10. */
  11. exports.version = '1.2.0';
  12. /*!
  13. * Primary `Assertion` prototype
  14. */
  15. exports.Assertion = require('./chai/assertion');
  16. /*!
  17. * Assertion Error
  18. */
  19. exports.AssertionError = require('./chai/error');
  20. /*!
  21. * Utils for plugins (not exported)
  22. */
  23. var util = require('./chai/utils');
  24. /**
  25. * # .use(function)
  26. *
  27. * Provides a way to extend the internals of Chai
  28. *
  29. * @param {Function}
  30. * @returns {this} for chaining
  31. * @api public
  32. */
  33. exports.use = function (fn) {
  34. if (!~used.indexOf(fn)) {
  35. fn(this, util);
  36. used.push(fn);
  37. }
  38. return this;
  39. };
  40. /*!
  41. * Core Assertions
  42. */
  43. var core = require('./chai/core/assertions');
  44. exports.use(core);
  45. /*!
  46. * Expect interface
  47. */
  48. var expect = require('./chai/interface/expect');
  49. exports.use(expect);
  50. /*!
  51. * Should interface
  52. */
  53. var should = require('./chai/interface/should');
  54. exports.use(should);
  55. /*!
  56. * Assert interface
  57. */
  58. var assert = require('./chai/interface/assert');
  59. exports.use(assert);