133 lines
8.3 KiB
Markdown
133 lines
8.3 KiB
Markdown
# Jasmine Core 2.0 Release Notes
|
|
|
|
## Summary
|
|
|
|
These notes are for RC1 of Jasmine Core 2.0.
|
|
|
|
## Breaking Changes
|
|
|
|
These changes have breaking interface changes and are not backwards compatible with 1.x.
|
|
|
|
* New syntax for asynchronous specs
|
|
* New syntax for spies
|
|
* New interface for reporters
|
|
* Better Equals testing
|
|
* Easier custom matchers
|
|
* Change to `toThrow` matcher
|
|
|
|
### New syntax for asynchronous specs
|
|
|
|
Similar to [Mocha][mocha], Jasmine befores, specs, and afters 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 if a timeout is reached.
|
|
|
|
### New syntax for spies
|
|
|
|
Spies have a slightly modified syntax. The ideas came from a desire to preserve any of the properties on a spied-upon function and some better testing patterns.
|
|
|
|
### New interface for reporters
|
|
|
|
The reporter interface has changed. 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 and allows for less memory use overall. The full suite execution time is also reported.
|
|
|
|
### Better Equals testing
|
|
|
|
We have tossed 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.
|
|
|
|
### Easier custom matchers
|
|
|
|
Custom matchers have always been possible, but this was barely documented and clunky to test. We've changed how matchers are added and tested. Jasmine adds its own matchers by the same mechanism that your code uses.
|
|
|
|
### Change to `toThrow` matcher
|
|
|
|
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.
|
|
|
|
## Other Changes
|
|
|
|
* Massive refactoring and better testing
|
|
* `boot.js`
|
|
* Change in how Jasmine is loaded
|
|
* Change in how Jasmine is tested
|
|
* Better node.js support
|
|
* Better Continuous Integration Environment at Travis
|
|
* Support matrix updated
|
|
* Removed JsDoc
|
|
|
|
## Massive refactoring and better testing
|
|
|
|
This is the biggest set of changes. We've touched nearly every file and every object. We've slammed objects back together and pulled out new extractions. We've made the code more consistently styled. We've improved the tests nearly everywhere.
|
|
|
|
In general you will see more smaller, more-loosely-coupled objects, unit-tested with explicit dependencies injected as needed. This made tests easier to read and thus we were able to keep objects smaller. We know this has made it easier to make 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.
|
|
|
|
## Environment setup now in `boot.js`
|
|
|
|
Instantiation and setup of the Jasmine environment, including building reporters, exposing the "global" functions, and executing your 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.
|
|
|
|
For example, during development, Jasmine uses it's own `devboot.js` to load itself twice - once from `jasmine.js` and once from the source directories.
|
|
|
|
## Change in development system
|
|
|
|
We've moved away from Ruby and embraced Node.js 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 browser and in Node.js before submitting Pull Requests. There is more detail in the [Contributor's Guide][contrib].
|
|
|
|
## Change in how Jasmine is loaded
|
|
|
|
We did not want to add new run-time dependencies, yet we needed to be cleaner when loading Jasmine. So we wrote our own "require" "system" that works in Node.js and in browsers. This only affects you if your pull request adds files. So please be very careful in these cases. Again, the [Contributor's Guide][contrib] should help.
|
|
|
|
## Change in how Jasmine is tested with Jasmine
|
|
|
|
Writing our own (lightweight) require system helped use 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 your contributions.
|
|
|
|
## Better node.js support
|
|
|
|
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.
|
|
|
|
## Better Continuous Integration Environment at Travis
|
|
|
|
The [CI build at Travis][travis_jasmine] now runs not just the core, but a 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, Node.js, and IE versions 8, 9, and 10. Our thanks to [SauceLabs][sauce] for their support of open source projects. We will happily take pull requests for additional OS/Browser combos within our matrix.
|
|
|
|
## Support Matrix Updated
|
|
|
|
We're dropping support for IE < 8. Jasmine 1.x remains for projects supporting earlier versions of browsers.
|
|
|
|
## Removed JsDoc Pages
|
|
|
|
Comments in code are lies waiting to happen. And our 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.
|
|
|
|
Last year we put out the [`introduction.js`][intro] page to document the real, practical interface for projects to use. This page has received a lot of positive feedback and so we want to do more of it. We welcome pull requests that flesh out these pages.
|
|
|
|
## Pull Requests & Issues
|
|
|
|
The following Pull Requests were merged:
|
|
|
|
* ObjectContaining wrong filed value error message #[394](https://github.com/pivotal/jasmine/issues/394) from albertandrejev
|
|
* Removed unnecessary parameter from `suiteFactory()` call #[397](https://github.com/pivotal/jasmine/issues/397) from valera-rozuvan
|
|
* `jasmine.Any` supports `Boolean` #[392](https://github.com/pivotal/jasmine/issues/392) from albertandrejev
|
|
* Reporters get execution time #[30](https://github.com/pivotal/jasmine/issues/30)
|
|
* `toThrow` matchers handle falsy exceptions #[317](https://github.com/pivotal/jasmine/issues/371)
|
|
* Removed deprecated `jasmine.Matchers.pp` #[363](https://github.com/pivotal/jasmine/issues/363) from robinboehm
|
|
* Fix for Clock ticking to default to 0 #[340](https://github.com/pivotal/jasmine/issues/340) from Caio Cunha
|
|
* Whitespace failures should be easier to understand #[332](https://github.com/pivotal/jasmine/issues/332) from bjornblomqvist
|
|
* Fix for more markdown-y image for Build status #[329](https://github.com/pivotal/jasmine/issues/329) from sunliwen
|
|
* UTF-8 encoding fixes #[333](https://github.com/pivotal/jasmine/issues/333) from bjornblomqvist
|
|
|
|
## Other Bugs & Features
|
|
|
|
* HTML Reporter refactored for simplicity and performance
|
|
* Default character encoding on the HTML runner page is UTF-8
|
|
* [Escape special regex characters from the spec param](http://www.pivotaltracker.com/story/52731407)
|
|
* Favicon returns
|
|
* [Clock supports `eval`'d strings as functions](http://www.pivotaltracker.com/story/40853563)
|
|
* There should always be stack traces on failures
|
|
* Removed references to unused `jasmine.VERBOSE`
|
|
* Removed references to unused `jasmine.XmlHttpRequest`
|
|
|
|
------
|
|
|
|
_Release Notes generated with [Anchorman](http://github.com/infews/anchorman)_
|
|
|
|
[mocha]: http://visionmedia.github.io/mocha/
|
|
[underscore]: http://underscorejs.org/
|
|
[grunt]: http://gruntjs.com
|
|
[contrib]: https://github.com/pivotal/jasmine/blob/master/Contribute.markdown
|
|
[travis]: http://travis-ci.org
|
|
[travis_jasmine]: http://travis-ci.org/jasmine
|
|
[sauce]: http://saucelabs.com
|
|
[node_suite]: https://github.com/pivotal/jasmine/blob/master/spec/node_suite.js
|
|
[intro]: http://pivotal.github.com/jasmine/ |