PageRenderTime 27ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/release_notes/20.md

https://gitlab.com/Rockyspade/jasmine
Markdown | 179 lines | 122 code | 57 blank | 0 comment | 0 complexity | c6bab8cc20d7c8401a08c2af805ac73a MD5 | raw file
  1. # Jasmine Core 2.0 Release Notes
  2. ## Summary
  3. These notes are for Jasmine Core 2.0.
  4. ## Breaking Changes
  5. The [`introduction.js`][intro] page covers the current syntax, highlighting the changes. Here are the known interface changes that are not backwards compatible with 1.x.
  6. * New syntax for asynchronous specs
  7. * New syntax for spies
  8. * New interface for reporters
  9. * Better Equality testing
  10. * Replaced custom matchers for ease of use
  11. * Change to `toThrow` matcher
  12. * Clock now remains installed when a spec finishes
  13. * More Jasmine internal variables/functions have been moved into closures
  14. ### New syntax for asynchronous specs
  15. Similar to [Mocha][mocha], Jasmine `before`s, `spec`s, and `after`s can take an optional `done` callback in order to force asynchronous tests. The next function, whether it's a `before`, `spec` or `after`, will wait until this function is called or until a timeout is reached.
  16. ### New syntax for spies
  17. Spies have a slightly modified syntax. The idea came from a desire to preserve any of the properties on a spied-upon function and some better testing patterns.
  18. ### New interface for reporters
  19. The reporter interface has been **replaced**. The callbacks are different and more consistent. The objects passed in should only provide what is needed to report results. This enforces an interface to result data so custom reporters will be less coupled to the Jasmine implementation. The Jasmine reporter API now includes a slot for a `timer` object.
  20. ### Better Equality testing
  21. We removed the previous equality code and are now using new code for testing equality. We started with [Underscore.js][underscore]'s `isEqual`, refactored a bit and added some additional tests.
  22. ### Replaced custom matchers for ease of use
  23. The interface for adding custom matchers has been **replaced**. It has always been possible to add custom matchers, but the API was barely documented and difficult to test. We've changed how matchers are added and tested. Jasmine adds its own matchers by the same mechanism that custom matchers use. Dogfooding FTW.
  24. ### Change to `toThrow` matcher
  25. We've changed the behavior of the `toThrow` matcher, moving some functionality to the `toThrowError` matcher. This should allow more of the requested use cases.
  26. ### Clock now remains installed when a spec finishes
  27. After installing the Jasmine Clock, it will stay installed until `uninstall` is called -- clearing up any ambiguity for when those timing functions will revert to using the global clock object.
  28. ## More Jasmine internal variables/functions have been moved into closures
  29. Certain variables/functions like a function to get the next spec id have been moved into closures, making the Jasmine interface cleaner.
  30. ## Other Changes
  31. * Massive refactoring and better testing
  32. * Environment setup now in `boot.js`
  33. * Development and Build moved to Grunt
  34. * Changes to how Jasmine is loaded
  35. * Changes to how Jasmine is tested
  36. * Better node.js support
  37. * Better Continuous Integration Environment at Travis
  38. * Support matrix updated
  39. * Removed JsDoc Pages
  40. * Adding Code Climate for JavaScript
  41. ## Massive refactoring and better testing
  42. This is the biggest set of changes. We've touched nearly every file and every object. We've merged objects together and factored out code. We styled the code more consistently. We've improved nearly every test.
  43. In general, Jasmine is made of smaller, more-loosely-coupled objects, unit-tested with explicit dependencies injected. This made tests easier to read, write, and maintain. We know this has made Jasmine development easier for the core team. We expect (and hope) this makes it easier for the community to extend Jasmine and provide pull requests that make more sense the first time out.
  44. ## Environment setup now in `boot.js`
  45. Instantiation and setup of the Jasmine environment, including building reporters, exposing the "global" functions, and executing tests has moved into its own file: `boot.js`. This should make it easier to add custom reporters, configure some objects, or just in general change how you use Jasmine from the outside.
  46. For example, during development, Jasmine uses its own `devboot.js` to load itself twice - once from `jasmine.js` and once from the source directories.
  47. ## Development and Build moved to Grunt
  48. We've moved away from Ruby and embraced [Node.js][node] and [Grunt.js][grunt] for the various command line tasks during development. Yes, it's a just a different set of dependencies. But it's less code for the team to maintain - it turns out that JavaScript tools are pretty good at building JavaScript projects. This will make it easier for the community to make sure contributions work in browsers and in Node.js before submitting Pull Requests. There is more detail in the [Contributor's Guide][contrib].
  49. ## Changes to how Jasmine is loaded
  50. We did not want to add new run-time dependencies, yet we needed to be cleaner when loading Jasmine. So we wrote a custom "require" scheme that works in Node.js and in browsers. This only affects pull requests which add files - please be careful in these cases. Again, the [Contributor's Guide][contrib] should help.
  51. ## Changes to how Jasmine is tested with Jasmine
  52. Writing a custom require system helped enforce self-testing - the built `jasmine.js` testing Jasmine from the source directories. Overall this has improved the stability of the code. When you look at Jasmine's tests, you'll see both `jasmine` and `j$` used. The former, `jasmine`, will always be used to test the code from source, which is loaded into the reference `j$`. Please adhere to this pattern when writing tests for contributions.
  53. ## Better node.js support
  54. `Node.js` is now officially a first-class citizen. For a long time we've made sure tests were green in Node before releasing. But it is now officially part of Jasmine's CI build at [Travis][travis]. For the curious, the [`node_suite.js`][node_suite], is essentially a `boot.js` for Node. An official `npm` is coming.
  55. ## Better Continuous Integration Environment at Travis
  56. The [CI build at Travis][travis_jasmine] now runs the core specs in a build matrix across browsers. It's far from complete on the operating system matrix, but you will see that Jasmine runs against: Firefox, Chrome, Safari 5, Safari 6, [Phantom.js][phantom], [Node.js][node], and IE versions 8, 9, and 10. Big thanks to [SauceLabs][sauce] for their support of open source projects. We will happily take pull requests for additional OS/Browser combos within the matrix.
  57. ## Support Matrix Updated
  58. We're dropping support for IE < 8. [Jasmine 1.x][jasmine_downloads] remains for projects that need to support older browsers.
  59. ## Removed JsDoc Pages
  60. Comments in code are lies waiting to happen. Jasmine's JsDoc comments were no exception. The comments were out of date, the generated pages were even more out of date, and frankly they were not helpful. So they're gone.
  61. Last year saw the posting of the [`introduction.js`][intro] page to document the real, practical interface for projects to use. This page has received a lot of positive feedback so expect more pages like this one.
  62. ## Adding Code Climate for JavaScript
  63. We are running Code Climate for Jasmine. We have some work to do here but it's helping us easily find code hotspots.
  64. ## Pull Requests and Issues
  65. The following Pull Requests were merged:
  66. * ObjectContaining wrong filed value error message #[394](https://github.com/pivotal/jasmine/issues/394) from albertandrejev
  67. * Removed unnecessary parameter from `suiteFactory()` call #[397](https://github.com/pivotal/jasmine/issues/397) from valera-rozuvan
  68. * `jasmine.Any` supports `Boolean` #[392](https://github.com/pivotal/jasmine/issues/392) from albertandrejev
  69. * Reporters get execution time #[30](https://github.com/pivotal/jasmine/issues/30)
  70. * `toThrow` matchers handle falsy exceptions #[317](https://github.com/pivotal/jasmine/issues/371)
  71. * Removed deprecated `jasmine.Matchers.pp` #[363](https://github.com/pivotal/jasmine/issues/363) from robinboehm
  72. * Fix for Clock ticking to default to 0 #[340](https://github.com/pivotal/jasmine/issues/340) from Caio Cunha
  73. * Whitespace failures should be easier to understand #[332](https://github.com/pivotal/jasmine/issues/332) from bjornblomqvist
  74. * Fix for more markdown-y image for Build status #[329](https://github.com/pivotal/jasmine/issues/329) from sunliwen
  75. * UTF-8 encoding fixes #[333](https://github.com/pivotal/jasmine/issues/333) from bjornblomqvist
  76. * Replaced deprecated octal literal with hexadecimal from kris7t
  77. * Make getGlobal() work in strict mode from metaweta
  78. * Clears timeout timer even when async spec throws an exception from tidoust
  79. * Timeouts scheduled within a delayed function are correctly scheduled and executed from maciej-filip-sz
  80. ### Bug Fixes
  81. * Improved the performance of the HTML output with a CSS change #[428](https://github.com/pivotal/jasmine/issues/428) - Thanks @tjgrathwell
  82. * Removed an accidental global pollution of `j$` as a reference to Jasmine. Thanks to Morten Maxild from the mailing list
  83. * There is now a consistent `this` between `beforeEach`, `it` and `afterEach` for a spec
  84. * A spy's strategy now has properties `returnValue` and `throwError` because they are better names
  85. * Make it easy to copy the title of failing specs from the HTML output
  86. * Don't add periods to the full name of a spec fix #[427](https://github.com/pivotal/jasmine/issues/427)
  87. * Allow Env to take optional spec/suite ids when asked to `execute`
  88. * [Mock clock now less intrusive, replacing global timer functions only when clock is installed](http://www.pivotaltracker.com/story/54168708)
  89. * Restore custom failure messages for `toHaveBeenCalledWith`
  90. * Jasmine global object has a addCustomEqualityTester and addMatchers (no longer directly on global)
  91. * Fixed a global leak of `timer`
  92. * Remove currentRunner from Env (users can use topSuite from Env instead)
  93. * [Specs without expectations are now considered passing](http://www.pivotaltracker.com/story/59422744)
  94. * Improve error message when a spec does not call the async callback within the default time interval
  95. * Allow passing a negativeCompare in a custom matcher for more custom implementations when `.not` is called
  96. * Update favicon to be higher resolution
  97. * Make all async functions be subject to the timeout
  98. There were several other pull requests that either had already been fixed, or were good starting points for the various changes above. Thank you for all of the hard work to keep Jasmine awesome.
  99. ## Other Bugs and Features
  100. There were a few small changes and fixes that didn't fit into any of the above categories:
  101. * HTML Reporter refactored for simplicity and performance
  102. * Default character encoding on the HTML runner page is UTF-8
  103. * [Escape special regex characters from the spec param](http://www.pivotaltracker.com/story/52731407)
  104. * Favicon returns
  105. * [Clock supports `eval`'d strings as functions](http://www.pivotaltracker.com/story/40853563)
  106. * There should always be stack traces on failures
  107. * Removed references to unused `jasmine.VERBOSE`
  108. * Removed references to unused `jasmine.XmlHttpRequest`
  109. [mocha]: http://visionmedia.github.io/mocha/
  110. [underscore]: http://underscorejs.org/
  111. [grunt]: http://gruntjs.com
  112. [node]: http://nodejs.org
  113. [phantom]: http://phantomjs.org
  114. [jasmine_downloads]: https://github.com/pivotal/jasmine/downloads
  115. [contrib]: https://github.com/pivotal/jasmine/blob/master/CONTRIBUTING.md
  116. [travis]: http://travis-ci.org
  117. [travis_jasmine]: http://travis-ci.org/jasmine
  118. [sauce]: http://saucelabs.com
  119. [node_suite]: https://github.com/pivotal/jasmine/blob/master/spec/node_suite.js
  120. [intro]: http://jasmine.github.io/2.0/introduction.html
  121. ------
  122. _Release Notes generated with [Anchorman](http://github.com/infews/anchorman)_