Compare commits
75 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a95c2cfe3f | ||
|
|
e2e2d1b343 | ||
|
|
3b53e469fd | ||
|
|
b3f69852c1 | ||
|
|
1613a376b1 | ||
|
|
1e35e8ba95 | ||
|
|
a6b209bc2f | ||
|
|
2301914549 | ||
|
|
320c42b6cc | ||
|
|
df45b4fede | ||
|
|
c1ab3c9cbe | ||
|
|
d2f2e2b870 | ||
|
|
0f6a7f04b3 | ||
|
|
728af5e556 | ||
|
|
018fd53c10 | ||
|
|
25d73515f3 | ||
|
|
8e317d4026 | ||
|
|
ea4c44904d | ||
|
|
77514bbb80 | ||
|
|
a85c3a4da8 | ||
|
|
0b1e1a0401 | ||
|
|
3374415add | ||
|
|
c2ae3b6b12 | ||
|
|
110cacab19 | ||
|
|
db7879a478 | ||
|
|
a81466d9e7 | ||
|
|
48f42eaa7d | ||
|
|
e5c2572753 | ||
|
|
141fd910f2 | ||
|
|
a93bfd2120 | ||
|
|
4221b2d2c4 | ||
|
|
6ee7fd6ced | ||
|
|
878325e2cf | ||
|
|
80c4f87dd5 | ||
|
|
3f3fa484b2 | ||
|
|
d0ad9b98cd | ||
|
|
375a6f9fda | ||
|
|
c017f0000d | ||
|
|
4097718b66 | ||
|
|
825dab32ff | ||
|
|
f3a7396845 | ||
|
|
850bee5492 | ||
|
|
6028a5d92c | ||
|
|
93a13ab791 | ||
|
|
542f483228 | ||
|
|
459b4c29b6 | ||
|
|
750a9aac6d | ||
|
|
cd55f03912 | ||
|
|
79954311fb | ||
|
|
3f71bcdb2d | ||
|
|
06f05ac57b | ||
|
|
5ea5ec6004 | ||
|
|
f7033f6551 | ||
|
|
7e6e905814 | ||
|
|
a6a1962924 | ||
|
|
50944fea6f | ||
|
|
7bfc4c0a45 | ||
|
|
4be2079482 | ||
|
|
d6f47ea886 | ||
|
|
5061dd066c | ||
|
|
2a847a67e3 | ||
|
|
50223d97d6 | ||
|
|
302e78f1df | ||
|
|
42ad12ec52 | ||
|
|
c41fa7d156 | ||
|
|
0b1449228f | ||
|
|
65a6decd6d | ||
|
|
7cbd86357d | ||
|
|
4f278be2c2 | ||
|
|
f2bc9b5bd8 | ||
|
|
e9d79bc946 | ||
|
|
0b2097b616 | ||
|
|
f02824ae52 | ||
|
|
225c7bdda3 | ||
|
|
e855c898d1 |
11
.travis.yml
11
.travis.yml
@@ -17,11 +17,18 @@ env:
|
|||||||
- secure: WSPWhlnC4mWSnSPquX+m1/BCu5ch5NygkaHuM2Nea7lD8oS3XLX8QncZZAsQ4lnNfqoDDuBOizG0AESiqNvE4y6x5qvLLTS6q+ce255ZEMZ71TBdZgDEEvGMEjOPPsVXiXyTQOP1lwOPlrbZvaPgWV7e11KIBab6DfFcQpnvDgo=
|
- secure: WSPWhlnC4mWSnSPquX+m1/BCu5ch5NygkaHuM2Nea7lD8oS3XLX8QncZZAsQ4lnNfqoDDuBOizG0AESiqNvE4y6x5qvLLTS6q+ce255ZEMZ71TBdZgDEEvGMEjOPPsVXiXyTQOP1lwOPlrbZvaPgWV7e11KIBab6DfFcQpnvDgo=
|
||||||
- secure: SW7CJhZnwaNT749Gdnhvqb5rbXlAOsygUAzh9qhtyvbqXKkmJdBIEsO01YF6pbju1X2twE9JvWCOxeZju43NgQChJlPsGbjY2j3k/TdQeTAJesQe2K7ytwghunI30gjEovtRH0T3w1EmcKPH8yj5eBIcB2OYoJHx8KEC7e68q1g=
|
- secure: SW7CJhZnwaNT749Gdnhvqb5rbXlAOsygUAzh9qhtyvbqXKkmJdBIEsO01YF6pbju1X2twE9JvWCOxeZju43NgQChJlPsGbjY2j3k/TdQeTAJesQe2K7ytwghunI30gjEovtRH0T3w1EmcKPH8yj5eBIcB2OYoJHx8KEC7e68q1g=
|
||||||
|
|
||||||
|
addons:
|
||||||
|
sauce_connect: true
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- env:
|
- env:
|
||||||
- USE_SAUCE=false
|
- USE_SAUCE=false
|
||||||
- TEST_COMMAND="bash travis-node-script.sh"
|
- TEST_COMMAND="bash travis-node-script.sh"
|
||||||
|
- env:
|
||||||
|
- JASMINE_BROWSER="safari"
|
||||||
|
- SAUCE_OS="OS X 10.11"
|
||||||
|
- SAUCE_BROWSER_VERSION=9
|
||||||
- env:
|
- env:
|
||||||
- JASMINE_BROWSER="safari"
|
- JASMINE_BROWSER="safari"
|
||||||
- SAUCE_OS="OS X 10.10"
|
- SAUCE_OS="OS X 10.10"
|
||||||
@@ -34,10 +41,6 @@ matrix:
|
|||||||
- JASMINE_BROWSER="safari"
|
- JASMINE_BROWSER="safari"
|
||||||
- SAUCE_OS="OS X 10.8"
|
- SAUCE_OS="OS X 10.8"
|
||||||
- SAUCE_BROWSER_VERSION=6
|
- SAUCE_BROWSER_VERSION=6
|
||||||
- env:
|
|
||||||
- JASMINE_BROWSER="safari"
|
|
||||||
- SAUCE_OS="OS X 10.6"
|
|
||||||
- SAUCE_BROWSER_VERSION=5
|
|
||||||
- env:
|
- env:
|
||||||
- JASMINE_BROWSER="internet explorer"
|
- JASMINE_BROWSER="internet explorer"
|
||||||
- SAUCE_OS="Windows 8.1"
|
- SAUCE_OS="Windows 8.1"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Developing for Jasmine Core
|
# Developing for Jasmine Core
|
||||||
|
|
||||||
We welcome your contributions! Thanks for helping make Jasmine a better project for everyone. Please review the backlog and discussion lists before starting work. What you're looking for may already have been done. If it hasn't, the community can help make your contribution better.
|
We welcome your contributions! Thanks for helping make Jasmine a better project for everyone. Please review the backlog and discussion lists before starting work. What you're looking for may already have been done. If it hasn't, the community can help make your contribution better. If you want to contribute but don't know what to work on, [issues tagged ready for work](https://github.com/jasmine/jasmine/labels/ready%20for%20work) should have enough detail to get started.
|
||||||
|
|
||||||
## Links
|
## Links
|
||||||
|
|
||||||
@@ -82,11 +82,11 @@ To install the Node dependencies, you will need Node.js, Npm, and [Grunt](http:/
|
|||||||
|
|
||||||
$ npm install --local
|
$ npm install --local
|
||||||
|
|
||||||
...will install all of the node modules locally. If when you run
|
...will install all of the node modules locally. Now run
|
||||||
|
|
||||||
$ grunt
|
$ grunt
|
||||||
|
|
||||||
...you see that JSHint runs your system is ready.
|
...if you see that JSHint runs, your system is ready.
|
||||||
|
|
||||||
### How to write new Jasmine code
|
### How to write new Jasmine code
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ Follow these tips and your pull request, patch, or suggestion is much more likel
|
|||||||
|
|
||||||
Jasmine uses the [Jasmine Ruby gem](http://github.com/jasmine/jasmine-gem) to test itself in browser.
|
Jasmine uses the [Jasmine Ruby gem](http://github.com/jasmine/jasmine-gem) to test itself in browser.
|
||||||
|
|
||||||
$ rake jasmine
|
$ bundle exec rake jasmine
|
||||||
|
|
||||||
...and then visit `http://localhost:8888` to run specs.
|
...and then visit `http://localhost:8888` to run specs.
|
||||||
|
|
||||||
|
|||||||
64
GOALS_2.0.md
64
GOALS_2.0.md
@@ -1,64 +0,0 @@
|
|||||||
# (Vague) Jasmine 2.0 Goals/(Guidelines)
|
|
||||||
|
|
||||||
1. No globals!
|
|
||||||
* jasmine library is entirely inside `jasmine` namespace
|
|
||||||
* globals required for backwards compatibility should be added in `boot.js` (EG, var describe = jasmine.getCurrentEnv().describe lives in boot.js)
|
|
||||||
1. Don't use properties as getters. Use methods.
|
|
||||||
* Properties aren't encapsulated -- can be mutated, unsafe.
|
|
||||||
1. Reporters get data objects (no methods).
|
|
||||||
* easier to refactor as needed
|
|
||||||
1. More unit tests - fewer nasty integration tests
|
|
||||||
|
|
||||||
## Remaining non-story-able work:
|
|
||||||
* Make a `TODO` list
|
|
||||||
|
|
||||||
### Hard
|
|
||||||
* Finish killing Globals
|
|
||||||
* Guidelines:
|
|
||||||
* New objects can have constructors on `jasmine`
|
|
||||||
* Top level functions can live on `jasmine`
|
|
||||||
* Top level (i.e., any `jasmine` property) should only be referenced inside the `Env` constructor
|
|
||||||
* should better allow any object to get jasmine code (Node-friendly)
|
|
||||||
* review everything in base.js
|
|
||||||
* Remove isA functions:
|
|
||||||
* isArray_ - used in matchers and spies
|
|
||||||
* isString_
|
|
||||||
* isDOMNode_
|
|
||||||
* isA_
|
|
||||||
* unimplementedMethod_, used by PrettyPrinter
|
|
||||||
* jasmine.util should be util closure inside of env or something
|
|
||||||
* argsToArray is used for Spies and matching (and can be replaced)
|
|
||||||
* inherit is only for PrettyPrinter now
|
|
||||||
* formatException is used only inside Env/spec
|
|
||||||
* htmlEscape is for messages in matchers - should this be HTML at all?
|
|
||||||
* Pretty printing
|
|
||||||
* move away from pretty printer and to a JSON.stringify implementation?
|
|
||||||
* jasmineToString vs. custom toString ?
|
|
||||||
|
|
||||||
### Easy
|
|
||||||
|
|
||||||
* unify params to ctors: options vs. attrs.
|
|
||||||
* This will be a lot of the TODOs, but clean up & simplify Env.js (is this a 2.1 task?)
|
|
||||||
|
|
||||||
### DONE
|
|
||||||
* Matchers improvements
|
|
||||||
* unit testable DONE
|
|
||||||
* better equality (from Underscore) DONE
|
|
||||||
* addCustomMatchers doesn't explode stack DONE
|
|
||||||
* refactor equals function so that it just loops & recurses over a list of fns (custom and built-in) - 2.1? (Tracker story)
|
|
||||||
* Spies
|
|
||||||
* break these out into their own tests/file DONE
|
|
||||||
|
|
||||||
|
|
||||||
## Other Topics
|
|
||||||
|
|
||||||
* Docs
|
|
||||||
* Docco has gone over well. Should we annotate all the sources and then have Pages be more complex, having tutorials and annotated source like Backbone? Are we small enough?
|
|
||||||
* Need examples for:
|
|
||||||
* How to build a Custom Matcher
|
|
||||||
* How to add a custom equality tester
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
23
README.md
23
README.md
@@ -1,6 +1,7 @@
|
|||||||
<a name="README">[<img src="https://rawgithub.com/jasmine/jasmine/master/images/jasmine-horizontal.svg" width="400px" />](http://jasmine.github.io)</a>
|
<a name="README">[<img src="https://rawgithub.com/jasmine/jasmine/master/images/jasmine-horizontal.svg" width="400px" />](http://jasmine.github.io)</a>
|
||||||
|
|
||||||
[](https://travis-ci.org/jasmine/jasmine) [](https://codeclimate.com/github/pivotal/jasmine)
|
[](https://travis-ci.org/jasmine/jasmine)
|
||||||
|
[](https://codeclimate.com/github/pivotal/jasmine)
|
||||||
|
|
||||||
=======
|
=======
|
||||||
|
|
||||||
@@ -28,22 +29,24 @@ For the Jasmine Ruby Gem:<br>
|
|||||||
For the Jasmine Python Egg:<br>
|
For the Jasmine Python Egg:<br>
|
||||||
[https://github.com/jasmine/jasmine-py](https://github.com/jasmine/jasmine-py)
|
[https://github.com/jasmine/jasmine-py](https://github.com/jasmine/jasmine-py)
|
||||||
|
|
||||||
To install Jasmine on your local box:
|
To install Jasmine standalone on your local box:
|
||||||
|
|
||||||
* Clone Jasmine - `git clone https://github.com/jasmine/jasmine.git`
|
* Download the standalone distribution for your desired release from the [releases page](https://github.com/jasmine/jasmine/releases)
|
||||||
* Create a Jasmine directory in your project - `mkdir my-project/jasmine`
|
* Create a Jasmine directory in your project - `mkdir my-project/jasmine`
|
||||||
* Move latest dist to your project directory - `mv jasmine/dist/jasmine-standalone-2.0.0.zip my-project/jasmine`
|
* Move the dist to your project directory - `mv jasmine/dist/jasmine-standalone-2.0.0.zip my-project/jasmine`
|
||||||
* Change directory - `cd my-project/jasmine`
|
* Change directory - `cd my-project/jasmine`
|
||||||
* Unzip the dist - `unzip jasmine-standalone-2.0.0.zip`
|
* Unzip the dist - `unzip jasmine-standalone-2.0.0.zip`
|
||||||
|
|
||||||
Add the following to your HTML file:
|
Add the following to your HTML file:
|
||||||
|
|
||||||
<link rel="shortcut icon" type="image/png" href="jasmine/lib/jasmine-2.0.0/jasmine_favicon.png">
|
```html
|
||||||
<link rel="stylesheet" type="text/css" href="jasmine/lib/jasmine-2.0.0/jasmine.css">
|
<link rel="shortcut icon" type="image/png" href="jasmine/lib/jasmine-2.0.0/jasmine_favicon.png">
|
||||||
|
<link rel="stylesheet" type="text/css" href="jasmine/lib/jasmine-2.0.0/jasmine.css">
|
||||||
|
|
||||||
<script type="text/javascript" src="jasmine/lib/jasmine-2.0.0/jasmine.js"></script>
|
<script type="text/javascript" src="jasmine/lib/jasmine-2.0.0/jasmine.js"></script>
|
||||||
<script type="text/javascript" src="jasmine/lib/jasmine-2.0.0/jasmine-html.js"></script>
|
<script type="text/javascript" src="jasmine/lib/jasmine-2.0.0/jasmine-html.js"></script>
|
||||||
<script type="text/javascript" src="jasmine/lib/jasmine-2.0.0/boot.js"></script>
|
<script type="text/javascript" src="jasmine/lib/jasmine-2.0.0/boot.js"></script>
|
||||||
|
```
|
||||||
|
|
||||||
## Supported environments
|
## Supported environments
|
||||||
|
|
||||||
@@ -62,6 +65,8 @@ Jasmine tests itself across many browsers (Safari, Chrome, Firefox, PhantomJS, a
|
|||||||
* [Davis W. Frank](mailto:dwfrank@pivotal.io), Pivotal Labs
|
* [Davis W. Frank](mailto:dwfrank@pivotal.io), Pivotal Labs
|
||||||
* [Rajan Agaskar](mailto:rajan@pivotal.io), Pivotal Labs
|
* [Rajan Agaskar](mailto:rajan@pivotal.io), Pivotal Labs
|
||||||
* [Gregg Van Hove](mailto:gvanhove@pivotal.io), Pivotal Labs
|
* [Gregg Van Hove](mailto:gvanhove@pivotal.io), Pivotal Labs
|
||||||
|
* [Greg Cobb](mailto:gcobb@pivotal.io), Pivotal Labs
|
||||||
|
* [Chris Amavisca](mailto:camavisca@pivotal.io), Pivotal Labs
|
||||||
|
|
||||||
### Maintainers Emeritus
|
### Maintainers Emeritus
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ Please attempt to keep commits to `master` small, but cohesive. If a feature is
|
|||||||
|
|
||||||
We attempt to stick to [Semantic Versioning](http://semver.org/). Most of the time, development should be against a new minor version - fixing bugs and adding new features that are backwards compatible.
|
We attempt to stick to [Semantic Versioning](http://semver.org/). Most of the time, development should be against a new minor version - fixing bugs and adding new features that are backwards compatible.
|
||||||
|
|
||||||
The current version lives in the file `/package.json`. This version will be the version number that is currently released. When releasing a new version, update `package.json` and `bower.json` with the new version and `grunt build:copyVersionToGem` to update the gem version number.
|
The current version lives in the file `/package.json`. This version will be the version number that is currently released. When releasing a new version, update `package.json` with the new version and `grunt build:copyVersionToGem` to update the gem version number.
|
||||||
|
|
||||||
This version is used by both `jasmine.js` and the `jasmine-core` Ruby gem.
|
This version is used by both `jasmine.js` and the `jasmine-core` Ruby gem.
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "jasmine-core",
|
"name": "jasmine-core",
|
||||||
"version": "2.3.2",
|
|
||||||
"homepage": "http://jasmine.github.io",
|
"homepage": "http://jasmine.github.io",
|
||||||
"authors": [
|
"authors": [
|
||||||
"slackersoft <gregg@slackersoft.net>"
|
"slackersoft <gregg@slackersoft.net>"
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ module.exports = {
|
|||||||
'src/core/base.js',
|
'src/core/base.js',
|
||||||
'src/core/util.js',
|
'src/core/util.js',
|
||||||
'src/core/Spec.js',
|
'src/core/Spec.js',
|
||||||
|
'src/core/Order.js',
|
||||||
'src/core/Env.js',
|
'src/core/Env.js',
|
||||||
'src/core/JsApiReporter.js',
|
'src/core/JsApiReporter.js',
|
||||||
'src/core/PrettyPrinter',
|
'src/core/PrettyPrinter',
|
||||||
|
|||||||
@@ -77,6 +77,14 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||||||
var throwingExpectationFailures = queryString.getParam("throwFailures");
|
var throwingExpectationFailures = queryString.getParam("throwFailures");
|
||||||
env.throwOnExpectationFailure(throwingExpectationFailures);
|
env.throwOnExpectationFailure(throwingExpectationFailures);
|
||||||
|
|
||||||
|
var random = queryString.getParam("random");
|
||||||
|
env.randomizeTests(random);
|
||||||
|
|
||||||
|
var seed = queryString.getParam("seed");
|
||||||
|
if (seed) {
|
||||||
|
env.seed(seed);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ## Reporters
|
* ## Reporters
|
||||||
* The `HtmlReporter` builds all of the HTML UI for the runner page. This reporter paints the dots, stars, and x's for specs, as well as all spec names and all failures (if any).
|
* The `HtmlReporter` builds all of the HTML UI for the runner page. This reporter paints the dots, stars, and x's for specs, as well as all spec names and all failures (if any).
|
||||||
@@ -85,6 +93,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||||||
env: env,
|
env: env,
|
||||||
onRaiseExceptionsClick: function() { queryString.navigateWithNewParam("catch", !env.catchingExceptions()); },
|
onRaiseExceptionsClick: function() { queryString.navigateWithNewParam("catch", !env.catchingExceptions()); },
|
||||||
onThrowExpectationsClick: function() { queryString.navigateWithNewParam("throwFailures", !env.throwingExpectationFailures()); },
|
onThrowExpectationsClick: function() { queryString.navigateWithNewParam("throwFailures", !env.throwingExpectationFailures()); },
|
||||||
|
onRandomClick: function() { queryString.navigateWithNewParam("random", !env.randomTests()); },
|
||||||
addToExistingQueryString: function(key, value) { return queryString.fullStringWithNewParam(key, value); },
|
addToExistingQueryString: function(key, value) { return queryString.fullStringWithNewParam(key, value); },
|
||||||
getContainer: function() { return document.body; },
|
getContainer: function() { return document.body; },
|
||||||
createElement: function() { return document.createElement.apply(document, arguments); },
|
createElement: function() { return document.createElement.apply(document, arguments); },
|
||||||
|
|||||||
@@ -55,6 +55,14 @@
|
|||||||
var throwingExpectationFailures = queryString.getParam("throwFailures");
|
var throwingExpectationFailures = queryString.getParam("throwFailures");
|
||||||
env.throwOnExpectationFailure(throwingExpectationFailures);
|
env.throwOnExpectationFailure(throwingExpectationFailures);
|
||||||
|
|
||||||
|
var random = queryString.getParam("random");
|
||||||
|
env.randomizeTests(random);
|
||||||
|
|
||||||
|
var seed = queryString.getParam("seed");
|
||||||
|
if (seed) {
|
||||||
|
env.seed(seed);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ## Reporters
|
* ## Reporters
|
||||||
* The `HtmlReporter` builds all of the HTML UI for the runner page. This reporter paints the dots, stars, and x's for specs, as well as all spec names and all failures (if any).
|
* The `HtmlReporter` builds all of the HTML UI for the runner page. This reporter paints the dots, stars, and x's for specs, as well as all spec names and all failures (if any).
|
||||||
@@ -63,6 +71,7 @@
|
|||||||
env: env,
|
env: env,
|
||||||
onRaiseExceptionsClick: function() { queryString.navigateWithNewParam("catch", !env.catchingExceptions()); },
|
onRaiseExceptionsClick: function() { queryString.navigateWithNewParam("catch", !env.catchingExceptions()); },
|
||||||
onThrowExpectationsClick: function() { queryString.navigateWithNewParam("throwFailures", !env.throwingExpectationFailures()); },
|
onThrowExpectationsClick: function() { queryString.navigateWithNewParam("throwFailures", !env.throwingExpectationFailures()); },
|
||||||
|
onRandomClick: function() { queryString.navigateWithNewParam("random", !env.randomTests()); },
|
||||||
addToExistingQueryString: function(key, value) { return queryString.fullStringWithNewParam(key, value); },
|
addToExistingQueryString: function(key, value) { return queryString.fullStringWithNewParam(key, value); },
|
||||||
getContainer: function() { return document.body; },
|
getContainer: function() { return document.body; },
|
||||||
createElement: function() { return document.createElement.apply(document, arguments); },
|
createElement: function() { return document.createElement.apply(document, arguments); },
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
createTextNode = options.createTextNode,
|
createTextNode = options.createTextNode,
|
||||||
onRaiseExceptionsClick = options.onRaiseExceptionsClick || function() {},
|
onRaiseExceptionsClick = options.onRaiseExceptionsClick || function() {},
|
||||||
onThrowExpectationsClick = options.onThrowExpectationsClick || function() {},
|
onThrowExpectationsClick = options.onThrowExpectationsClick || function() {},
|
||||||
|
onRandomClick = options.onRandomClick || function() {},
|
||||||
addToExistingQueryString = options.addToExistingQueryString || defaultQueryString,
|
addToExistingQueryString = options.addToExistingQueryString || defaultQueryString,
|
||||||
timer = options.timer || noopTimer,
|
timer = options.timer || noopTimer,
|
||||||
results = [],
|
results = [],
|
||||||
@@ -54,19 +55,17 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
this.initialize = function() {
|
this.initialize = function() {
|
||||||
clearPrior();
|
clearPrior();
|
||||||
htmlReporterMain = createDom('div', {className: 'jasmine_html-reporter'},
|
htmlReporterMain = createDom('div', {className: 'jasmine_html-reporter'},
|
||||||
createDom('div', {className: 'banner'},
|
createDom('div', {className: 'jasmine-banner'},
|
||||||
createDom('a', {className: 'title', href: 'http://jasmine.github.io/', target: '_blank'}),
|
createDom('a', {className: 'jasmine-title', href: 'http://jasmine.github.io/', target: '_blank'}),
|
||||||
createDom('span', {className: 'version'}, j$.version)
|
createDom('span', {className: 'jasmine-version'}, j$.version)
|
||||||
),
|
),
|
||||||
createDom('ul', {className: 'symbol-summary'}),
|
createDom('ul', {className: 'jasmine-symbol-summary'}),
|
||||||
createDom('div', {className: 'alert'}),
|
createDom('div', {className: 'jasmine-alert'}),
|
||||||
createDom('div', {className: 'results'},
|
createDom('div', {className: 'jasmine-results'},
|
||||||
createDom('div', {className: 'failures'})
|
createDom('div', {className: 'jasmine-failures'})
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
getContainer().appendChild(htmlReporterMain);
|
getContainer().appendChild(htmlReporterMain);
|
||||||
|
|
||||||
symbols = find('.symbol-summary');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var totalSpecsDefined;
|
var totalSpecsDefined;
|
||||||
@@ -75,7 +74,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
timer.start();
|
timer.start();
|
||||||
};
|
};
|
||||||
|
|
||||||
var summary = createDom('div', {className: 'summary'});
|
var summary = createDom('div', {className: 'jasmine-summary'});
|
||||||
|
|
||||||
var topResults = new j$.ResultsNode({}, '', null),
|
var topResults = new j$.ResultsNode({}, '', null),
|
||||||
currentParent = topResults;
|
currentParent = topResults;
|
||||||
@@ -111,8 +110,12 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
specsExecuted++;
|
specsExecuted++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!symbols){
|
||||||
|
symbols = find('.jasmine-symbol-summary');
|
||||||
|
}
|
||||||
|
|
||||||
symbols.appendChild(createDom('li', {
|
symbols.appendChild(createDom('li', {
|
||||||
className: noExpectations(result) ? 'empty' : result.status,
|
className: noExpectations(result) ? 'jasmine-empty' : 'jasmine-' + result.status,
|
||||||
id: 'spec_' + result.id,
|
id: 'spec_' + result.id,
|
||||||
title: result.fullName
|
title: result.fullName
|
||||||
}
|
}
|
||||||
@@ -122,18 +125,18 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
failureCount++;
|
failureCount++;
|
||||||
|
|
||||||
var failure =
|
var failure =
|
||||||
createDom('div', {className: 'spec-detail failed'},
|
createDom('div', {className: 'jasmine-spec-detail jasmine-failed'},
|
||||||
createDom('div', {className: 'description'},
|
createDom('div', {className: 'jasmine-description'},
|
||||||
createDom('a', {title: result.fullName, href: specHref(result)}, result.fullName)
|
createDom('a', {title: result.fullName, href: specHref(result)}, result.fullName)
|
||||||
),
|
),
|
||||||
createDom('div', {className: 'messages'})
|
createDom('div', {className: 'jasmine-messages'})
|
||||||
);
|
);
|
||||||
var messages = failure.childNodes[1];
|
var messages = failure.childNodes[1];
|
||||||
|
|
||||||
for (var i = 0; i < result.failedExpectations.length; i++) {
|
for (var i = 0; i < result.failedExpectations.length; i++) {
|
||||||
var expectation = result.failedExpectations[i];
|
var expectation = result.failedExpectations[i];
|
||||||
messages.appendChild(createDom('div', {className: 'result-message'}, expectation.message));
|
messages.appendChild(createDom('div', {className: 'jasmine-result-message'}, expectation.message));
|
||||||
messages.appendChild(createDom('div', {className: 'stack-trace'}, expectation.stack));
|
messages.appendChild(createDom('div', {className: 'jasmine-stack-trace'}, expectation.stack));
|
||||||
}
|
}
|
||||||
|
|
||||||
failures.push(failure);
|
failures.push(failure);
|
||||||
@@ -144,86 +147,106 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.jasmineDone = function() {
|
this.jasmineDone = function(doneResult) {
|
||||||
var banner = find('.banner');
|
var banner = find('.jasmine-banner');
|
||||||
var alert = find('.alert');
|
var alert = find('.jasmine-alert');
|
||||||
alert.appendChild(createDom('span', {className: 'duration'}, 'finished in ' + timer.elapsed() / 1000 + 's'));
|
var order = doneResult && doneResult.order;
|
||||||
|
alert.appendChild(createDom('span', {className: 'jasmine-duration'}, 'finished in ' + timer.elapsed() / 1000 + 's'));
|
||||||
|
|
||||||
banner.appendChild(
|
banner.appendChild(
|
||||||
createDom('div', { className: 'run-options' },
|
createDom('div', { className: 'jasmine-run-options' },
|
||||||
createDom('span', { className: 'trigger' }, 'Options'),
|
createDom('span', { className: 'jasmine-trigger' }, 'Options'),
|
||||||
createDom('div', { className: 'payload' },
|
createDom('div', { className: 'jasmine-payload' },
|
||||||
createDom('div', { className: 'exceptions' },
|
createDom('div', { className: 'jasmine-exceptions' },
|
||||||
createDom('input', {
|
createDom('input', {
|
||||||
className: 'raise',
|
className: 'jasmine-raise',
|
||||||
id: 'raise-exceptions',
|
id: 'jasmine-raise-exceptions',
|
||||||
type: 'checkbox'
|
type: 'checkbox'
|
||||||
}),
|
}),
|
||||||
createDom('label', { className: 'label', 'for': 'raise-exceptions' }, 'raise exceptions')),
|
createDom('label', { className: 'jasmine-label', 'for': 'jasmine-raise-exceptions' }, 'raise exceptions')),
|
||||||
createDom('div', { className: 'throw-failures' },
|
createDom('div', { className: 'jasmine-throw-failures' },
|
||||||
createDom('input', {
|
createDom('input', {
|
||||||
className: 'throw',
|
className: 'jasmine-throw',
|
||||||
id: 'throw-failures',
|
id: 'jasmine-throw-failures',
|
||||||
type: 'checkbox'
|
type: 'checkbox'
|
||||||
}),
|
}),
|
||||||
createDom('label', { className: 'label', 'for': 'throw-failures' }, 'stop spec on expectation failure'))
|
createDom('label', { className: 'jasmine-label', 'for': 'jasmine-throw-failures' }, 'stop spec on expectation failure')),
|
||||||
|
createDom('div', { className: 'jasmine-random-order' },
|
||||||
|
createDom('input', {
|
||||||
|
className: 'jasmine-random',
|
||||||
|
id: 'jasmine-random-order',
|
||||||
|
type: 'checkbox'
|
||||||
|
}),
|
||||||
|
createDom('label', { className: 'jasmine-label', 'for': 'jasmine-random-order' }, 'run tests in random order'))
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
var raiseCheckbox = find('#raise-exceptions');
|
var raiseCheckbox = find('#jasmine-raise-exceptions');
|
||||||
|
|
||||||
raiseCheckbox.checked = !env.catchingExceptions();
|
raiseCheckbox.checked = !env.catchingExceptions();
|
||||||
raiseCheckbox.onclick = onRaiseExceptionsClick;
|
raiseCheckbox.onclick = onRaiseExceptionsClick;
|
||||||
|
|
||||||
var throwCheckbox = find('#throw-failures');
|
var throwCheckbox = find('#jasmine-throw-failures');
|
||||||
throwCheckbox.checked = env.throwingExpectationFailures();
|
throwCheckbox.checked = env.throwingExpectationFailures();
|
||||||
throwCheckbox.onclick = onThrowExpectationsClick;
|
throwCheckbox.onclick = onThrowExpectationsClick;
|
||||||
|
|
||||||
var optionsMenu = find('.run-options'),
|
var randomCheckbox = find('#jasmine-random-order');
|
||||||
optionsTrigger = optionsMenu.querySelector('.trigger'),
|
randomCheckbox.checked = env.randomTests();
|
||||||
optionsPayload = optionsMenu.querySelector('.payload'),
|
randomCheckbox.onclick = onRandomClick;
|
||||||
isOpen = /\bopen\b/;
|
|
||||||
|
var optionsMenu = find('.jasmine-run-options'),
|
||||||
|
optionsTrigger = optionsMenu.querySelector('.jasmine-trigger'),
|
||||||
|
optionsPayload = optionsMenu.querySelector('.jasmine-payload'),
|
||||||
|
isOpen = /\bjasmine-open\b/;
|
||||||
|
|
||||||
optionsTrigger.onclick = function() {
|
optionsTrigger.onclick = function() {
|
||||||
if (isOpen.test(optionsPayload.className)) {
|
if (isOpen.test(optionsPayload.className)) {
|
||||||
optionsPayload.className = optionsPayload.className.replace(isOpen, '');
|
optionsPayload.className = optionsPayload.className.replace(isOpen, '');
|
||||||
} else {
|
} else {
|
||||||
optionsPayload.className += ' open';
|
optionsPayload.className += ' jasmine-open';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (specsExecuted < totalSpecsDefined) {
|
if (specsExecuted < totalSpecsDefined) {
|
||||||
var skippedMessage = 'Ran ' + specsExecuted + ' of ' + totalSpecsDefined + ' specs - run all';
|
var skippedMessage = 'Ran ' + specsExecuted + ' of ' + totalSpecsDefined + ' specs - run all';
|
||||||
alert.appendChild(
|
alert.appendChild(
|
||||||
createDom('span', {className: 'bar skipped'},
|
createDom('span', {className: 'jasmine-bar jasmine-skipped'},
|
||||||
createDom('a', {href: '?', title: 'Run all specs'}, skippedMessage)
|
createDom('a', {href: '?', title: 'Run all specs'}, skippedMessage)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
var statusBarMessage = '';
|
var statusBarMessage = '';
|
||||||
var statusBarClassName = 'bar ';
|
var statusBarClassName = 'jasmine-bar ';
|
||||||
|
|
||||||
if (totalSpecsDefined > 0) {
|
if (totalSpecsDefined > 0) {
|
||||||
statusBarMessage += pluralize('spec', specsExecuted) + ', ' + pluralize('failure', failureCount);
|
statusBarMessage += pluralize('spec', specsExecuted) + ', ' + pluralize('failure', failureCount);
|
||||||
if (pendingSpecCount) { statusBarMessage += ', ' + pluralize('pending spec', pendingSpecCount); }
|
if (pendingSpecCount) { statusBarMessage += ', ' + pluralize('pending spec', pendingSpecCount); }
|
||||||
statusBarClassName += (failureCount > 0) ? 'failed' : 'passed';
|
statusBarClassName += (failureCount > 0) ? 'jasmine-failed' : 'jasmine-passed';
|
||||||
} else {
|
} else {
|
||||||
statusBarClassName += 'skipped';
|
statusBarClassName += 'jasmine-skipped';
|
||||||
statusBarMessage += 'No specs found';
|
statusBarMessage += 'No specs found';
|
||||||
}
|
}
|
||||||
|
|
||||||
alert.appendChild(createDom('span', {className: statusBarClassName}, statusBarMessage));
|
var seedBar;
|
||||||
|
if (order && order.random) {
|
||||||
|
seedBar = createDom('span', {className: 'jasmine-seed-bar'},
|
||||||
|
', randomized with seed ',
|
||||||
|
createDom('a', {title: 'randomized with seed ' + order.seed, href: seedHref(order.seed)}, order.seed)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
alert.appendChild(createDom('span', {className: statusBarClassName}, statusBarMessage, seedBar));
|
||||||
|
|
||||||
for(i = 0; i < failedSuites.length; i++) {
|
for(i = 0; i < failedSuites.length; i++) {
|
||||||
var failedSuite = failedSuites[i];
|
var failedSuite = failedSuites[i];
|
||||||
for(var j = 0; j < failedSuite.failedExpectations.length; j++) {
|
for(var j = 0; j < failedSuite.failedExpectations.length; j++) {
|
||||||
var errorBarMessage = 'AfterAll ' + failedSuite.failedExpectations[j].message;
|
var errorBarMessage = 'AfterAll ' + failedSuite.failedExpectations[j].message;
|
||||||
var errorBarClassName = 'bar errored';
|
var errorBarClassName = 'jasmine-bar jasmine-errored';
|
||||||
alert.appendChild(createDom('span', {className: errorBarClassName}, errorBarMessage));
|
alert.appendChild(createDom('span', {className: errorBarClassName}, errorBarMessage));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var results = find('.results');
|
var results = find('.jasmine-results');
|
||||||
results.appendChild(summary);
|
results.appendChild(summary);
|
||||||
|
|
||||||
summaryList(topResults, summary);
|
summaryList(topResults, summary);
|
||||||
@@ -233,8 +256,8 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
for (var i = 0; i < resultsTree.children.length; i++) {
|
for (var i = 0; i < resultsTree.children.length; i++) {
|
||||||
var resultNode = resultsTree.children[i];
|
var resultNode = resultsTree.children[i];
|
||||||
if (resultNode.type == 'suite') {
|
if (resultNode.type == 'suite') {
|
||||||
var suiteListNode = createDom('ul', {className: 'suite', id: 'suite-' + resultNode.result.id},
|
var suiteListNode = createDom('ul', {className: 'jasmine-suite', id: 'suite-' + resultNode.result.id},
|
||||||
createDom('li', {className: 'suite-detail'},
|
createDom('li', {className: 'jasmine-suite-detail'},
|
||||||
createDom('a', {href: specHref(resultNode.result)}, resultNode.result.description)
|
createDom('a', {href: specHref(resultNode.result)}, resultNode.result.description)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -243,8 +266,8 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
domParent.appendChild(suiteListNode);
|
domParent.appendChild(suiteListNode);
|
||||||
}
|
}
|
||||||
if (resultNode.type == 'spec') {
|
if (resultNode.type == 'spec') {
|
||||||
if (domParent.getAttribute('class') != 'specs') {
|
if (domParent.getAttribute('class') != 'jasmine-specs') {
|
||||||
specListNode = createDom('ul', {className: 'specs'});
|
specListNode = createDom('ul', {className: 'jasmine-specs'});
|
||||||
domParent.appendChild(specListNode);
|
domParent.appendChild(specListNode);
|
||||||
}
|
}
|
||||||
var specDescription = resultNode.result.description;
|
var specDescription = resultNode.result.description;
|
||||||
@@ -256,7 +279,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
}
|
}
|
||||||
specListNode.appendChild(
|
specListNode.appendChild(
|
||||||
createDom('li', {
|
createDom('li', {
|
||||||
className: resultNode.result.status,
|
className: 'jasmine-' + resultNode.result.status,
|
||||||
id: 'spec-' + resultNode.result.id
|
id: 'spec-' + resultNode.result.id
|
||||||
},
|
},
|
||||||
createDom('a', {href: specHref(resultNode.result)}, specDescription)
|
createDom('a', {href: specHref(resultNode.result)}, specDescription)
|
||||||
@@ -268,24 +291,24 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
|
|
||||||
if (failures.length) {
|
if (failures.length) {
|
||||||
alert.appendChild(
|
alert.appendChild(
|
||||||
createDom('span', {className: 'menu bar spec-list'},
|
createDom('span', {className: 'jasmine-menu jasmine-bar jasmine-spec-list'},
|
||||||
createDom('span', {}, 'Spec List | '),
|
createDom('span', {}, 'Spec List | '),
|
||||||
createDom('a', {className: 'failures-menu', href: '#'}, 'Failures')));
|
createDom('a', {className: 'jasmine-failures-menu', href: '#'}, 'Failures')));
|
||||||
alert.appendChild(
|
alert.appendChild(
|
||||||
createDom('span', {className: 'menu bar failure-list'},
|
createDom('span', {className: 'jasmine-menu jasmine-bar jasmine-failure-list'},
|
||||||
createDom('a', {className: 'spec-list-menu', href: '#'}, 'Spec List'),
|
createDom('a', {className: 'jasmine-spec-list-menu', href: '#'}, 'Spec List'),
|
||||||
createDom('span', {}, ' | Failures ')));
|
createDom('span', {}, ' | Failures ')));
|
||||||
|
|
||||||
find('.failures-menu').onclick = function() {
|
find('.jasmine-failures-menu').onclick = function() {
|
||||||
setMenuModeTo('failure-list');
|
setMenuModeTo('jasmine-failure-list');
|
||||||
};
|
};
|
||||||
find('.spec-list-menu').onclick = function() {
|
find('.jasmine-spec-list-menu').onclick = function() {
|
||||||
setMenuModeTo('spec-list');
|
setMenuModeTo('jasmine-spec-list');
|
||||||
};
|
};
|
||||||
|
|
||||||
setMenuModeTo('failure-list');
|
setMenuModeTo('jasmine-failure-list');
|
||||||
|
|
||||||
var failureNode = find('.failures');
|
var failureNode = find('.jasmine-failures');
|
||||||
for (var i = 0; i < failures.length; i++) {
|
for (var i = 0; i < failures.length; i++) {
|
||||||
failureNode.appendChild(failures[i]);
|
failureNode.appendChild(failures[i]);
|
||||||
}
|
}
|
||||||
@@ -343,6 +366,10 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
return addToExistingQueryString('spec', result.fullName);
|
return addToExistingQueryString('spec', result.fullName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function seedHref(seed) {
|
||||||
|
return addToExistingQueryString('seed', seed);
|
||||||
|
}
|
||||||
|
|
||||||
function defaultQueryString(key, value) {
|
function defaultQueryString(key, value) {
|
||||||
return '?' + key + '=' + value;
|
return '?' + key + '=' + value;
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -24,7 +24,11 @@ var getJasmineRequireObj = (function (jasmineGlobal) {
|
|||||||
var jasmineRequire;
|
var jasmineRequire;
|
||||||
|
|
||||||
if (typeof module !== 'undefined' && module.exports) {
|
if (typeof module !== 'undefined' && module.exports) {
|
||||||
jasmineGlobal = global;
|
if (typeof global !== 'undefined') {
|
||||||
|
jasmineGlobal = global;
|
||||||
|
} else {
|
||||||
|
jasmineGlobal = {};
|
||||||
|
}
|
||||||
jasmineRequire = exports;
|
jasmineRequire = exports;
|
||||||
} else {
|
} else {
|
||||||
if (typeof window !== 'undefined' && typeof window.toString === 'function' && window.toString() === '[object GjsGlobal]') {
|
if (typeof window !== 'undefined' && typeof window.toString === 'function' && window.toString() === '[object GjsGlobal]') {
|
||||||
@@ -68,6 +72,7 @@ var getJasmineRequireObj = (function (jasmineGlobal) {
|
|||||||
j$.Timer = jRequire.Timer();
|
j$.Timer = jRequire.Timer();
|
||||||
j$.TreeProcessor = jRequire.TreeProcessor();
|
j$.TreeProcessor = jRequire.TreeProcessor();
|
||||||
j$.version = jRequire.version();
|
j$.version = jRequire.version();
|
||||||
|
j$.Order = jRequire.Order();
|
||||||
|
|
||||||
j$.matchers = jRequire.requireMatchers(jRequire, j$);
|
j$.matchers = jRequire.requireMatchers(jRequire, j$);
|
||||||
|
|
||||||
@@ -93,6 +98,7 @@ getJasmineRequireObj().requireMatchers = function(jRequire, j$) {
|
|||||||
'toEqual',
|
'toEqual',
|
||||||
'toHaveBeenCalled',
|
'toHaveBeenCalled',
|
||||||
'toHaveBeenCalledWith',
|
'toHaveBeenCalledWith',
|
||||||
|
'toHaveBeenCalledTimes',
|
||||||
'toMatch',
|
'toMatch',
|
||||||
'toThrow',
|
'toThrow',
|
||||||
'toThrowError'
|
'toThrowError'
|
||||||
@@ -447,6 +453,53 @@ if (typeof window == void 0 && typeof exports == 'object') {
|
|||||||
exports.Spec = jasmineRequire.Spec;
|
exports.Spec = jasmineRequire.Spec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*jshint bitwise: false*/
|
||||||
|
|
||||||
|
getJasmineRequireObj().Order = function() {
|
||||||
|
function Order(options) {
|
||||||
|
this.random = 'random' in options ? options.random : true;
|
||||||
|
var seed = this.seed = options.seed || generateSeed();
|
||||||
|
this.sort = this.random ? randomOrder : naturalOrder;
|
||||||
|
|
||||||
|
function naturalOrder(items) {
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
|
function randomOrder(items) {
|
||||||
|
var copy = items.slice();
|
||||||
|
copy.sort(function(a, b) {
|
||||||
|
return jenkinsHash(seed + a.id) - jenkinsHash(seed + b.id);
|
||||||
|
});
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
function generateSeed() {
|
||||||
|
return String(Math.random()).slice(-5);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bob Jenkins One-at-a-Time Hash algorithm is a non-cryptographic hash function
|
||||||
|
// used to get a different output when the key changes slighly.
|
||||||
|
// We use your return to sort the children randomly in a consistent way when
|
||||||
|
// used in conjunction with a seed
|
||||||
|
|
||||||
|
function jenkinsHash(key) {
|
||||||
|
var hash, i;
|
||||||
|
for(hash = i = 0; i < key.length; ++i) {
|
||||||
|
hash += key.charCodeAt(i);
|
||||||
|
hash += (hash << 10);
|
||||||
|
hash ^= (hash >> 6);
|
||||||
|
}
|
||||||
|
hash += (hash << 3);
|
||||||
|
hash ^= (hash >> 11);
|
||||||
|
hash += (hash << 15);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return Order;
|
||||||
|
};
|
||||||
|
|
||||||
getJasmineRequireObj().Env = function(j$) {
|
getJasmineRequireObj().Env = function(j$) {
|
||||||
function Env(options) {
|
function Env(options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
@@ -469,6 +522,8 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
var currentlyExecutingSuites = [];
|
var currentlyExecutingSuites = [];
|
||||||
var currentDeclarationSuite = null;
|
var currentDeclarationSuite = null;
|
||||||
var throwOnExpectationFailure = false;
|
var throwOnExpectationFailure = false;
|
||||||
|
var random = false;
|
||||||
|
var seed = null;
|
||||||
|
|
||||||
var currentSuite = function() {
|
var currentSuite = function() {
|
||||||
return currentlyExecutingSuites[currentlyExecutingSuites.length - 1];
|
return currentlyExecutingSuites[currentlyExecutingSuites.length - 1];
|
||||||
@@ -618,6 +673,21 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
return throwOnExpectationFailure;
|
return throwOnExpectationFailure;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.randomizeTests = function(value) {
|
||||||
|
random = !!value;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.randomTests = function() {
|
||||||
|
return random;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.seed = function(value) {
|
||||||
|
if (value) {
|
||||||
|
seed = value;
|
||||||
|
}
|
||||||
|
return seed;
|
||||||
|
};
|
||||||
|
|
||||||
var queueRunnerFactory = function(options) {
|
var queueRunnerFactory = function(options) {
|
||||||
options.catchException = catchException;
|
options.catchException = catchException;
|
||||||
options.clearStack = options.clearStack || clearStack;
|
options.clearStack = options.clearStack || clearStack;
|
||||||
@@ -649,6 +719,12 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
runnablesToRun = [topSuite.id];
|
runnablesToRun = [topSuite.id];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var order = new j$.Order({
|
||||||
|
random: random,
|
||||||
|
seed: seed
|
||||||
|
});
|
||||||
|
|
||||||
var processor = new j$.TreeProcessor({
|
var processor = new j$.TreeProcessor({
|
||||||
tree: topSuite,
|
tree: topSuite,
|
||||||
runnableIds: runnablesToRun,
|
runnableIds: runnablesToRun,
|
||||||
@@ -664,6 +740,9 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
}
|
}
|
||||||
currentlyExecutingSuites.pop();
|
currentlyExecutingSuites.pop();
|
||||||
reporter.suiteDone(result);
|
reporter.suiteDone(result);
|
||||||
|
},
|
||||||
|
orderChildren: function(node) {
|
||||||
|
return order.sort(node.children);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -675,7 +754,11 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
totalSpecsDefined: totalSpecsDefined
|
totalSpecsDefined: totalSpecsDefined
|
||||||
});
|
});
|
||||||
|
|
||||||
processor.execute(reporter.jasmineDone);
|
processor.execute(function() {
|
||||||
|
reporter.jasmineDone({
|
||||||
|
order: order
|
||||||
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.addReporter = function(reporterToAdd) {
|
this.addReporter = function(reporterToAdd) {
|
||||||
@@ -710,13 +793,20 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
|
|
||||||
this.describe = function(description, specDefinitions) {
|
this.describe = function(description, specDefinitions) {
|
||||||
var suite = suiteFactory(description);
|
var suite = suiteFactory(description);
|
||||||
|
if (specDefinitions.length > 0) {
|
||||||
|
throw new Error('describe does not expect a done parameter');
|
||||||
|
}
|
||||||
|
if (currentDeclarationSuite.markedPending) {
|
||||||
|
suite.pend();
|
||||||
|
}
|
||||||
addSpecsToSuite(suite, specDefinitions);
|
addSpecsToSuite(suite, specDefinitions);
|
||||||
return suite;
|
return suite;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.xdescribe = function(description, specDefinitions) {
|
this.xdescribe = function(description, specDefinitions) {
|
||||||
var suite = this.describe(description, specDefinitions);
|
var suite = suiteFactory(description);
|
||||||
suite.disable();
|
suite.pend();
|
||||||
|
addSpecsToSuite(suite, specDefinitions);
|
||||||
return suite;
|
return suite;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -822,19 +912,22 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
|
|
||||||
this.it = function(description, fn, timeout) {
|
this.it = function(description, fn, timeout) {
|
||||||
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
|
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
|
||||||
|
if (currentDeclarationSuite.markedPending) {
|
||||||
|
spec.pend();
|
||||||
|
}
|
||||||
currentDeclarationSuite.addChild(spec);
|
currentDeclarationSuite.addChild(spec);
|
||||||
return spec;
|
return spec;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.xit = function() {
|
this.xit = function() {
|
||||||
var spec = this.it.apply(this, arguments);
|
var spec = this.it.apply(this, arguments);
|
||||||
spec.pend();
|
spec.pend('Temporarily disabled with xit');
|
||||||
return spec;
|
return spec;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.fit = function(){
|
this.fit = function(description, fn, timeout){
|
||||||
var spec = this.it.apply(this, arguments);
|
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
|
||||||
|
currentDeclarationSuite.addChild(spec);
|
||||||
focusedRunnables.push(spec.id);
|
focusedRunnables.push(spec.id);
|
||||||
unfocusAncestor();
|
unfocusAncestor();
|
||||||
return spec;
|
return spec;
|
||||||
@@ -918,6 +1011,7 @@ getJasmineRequireObj().JsApiReporter = function() {
|
|||||||
|
|
||||||
this.started = false;
|
this.started = false;
|
||||||
this.finished = false;
|
this.finished = false;
|
||||||
|
this.runDetails = {};
|
||||||
|
|
||||||
this.jasmineStarted = function() {
|
this.jasmineStarted = function() {
|
||||||
this.started = true;
|
this.started = true;
|
||||||
@@ -927,8 +1021,9 @@ getJasmineRequireObj().JsApiReporter = function() {
|
|||||||
|
|
||||||
var executionTime;
|
var executionTime;
|
||||||
|
|
||||||
this.jasmineDone = function() {
|
this.jasmineDone = function(runDetails) {
|
||||||
this.finished = true;
|
this.finished = true;
|
||||||
|
this.runDetails = runDetails;
|
||||||
executionTime = timer.elapsed();
|
executionTime = timer.elapsed();
|
||||||
status = 'done';
|
status = 'done';
|
||||||
};
|
};
|
||||||
@@ -1606,6 +1701,8 @@ getJasmineRequireObj().pp = function(j$) {
|
|||||||
this.emitScalar('HTMLNode');
|
this.emitScalar('HTMLNode');
|
||||||
} else if (value instanceof Date) {
|
} else if (value instanceof Date) {
|
||||||
this.emitScalar('Date(' + value + ')');
|
this.emitScalar('Date(' + value + ')');
|
||||||
|
} else if (value.toString && typeof value === 'object' && !(value instanceof Array) && value.toString !== Object.prototype.toString) {
|
||||||
|
this.emitScalar(value.toString());
|
||||||
} else if (j$.util.arrayContains(this.seen, value)) {
|
} else if (j$.util.arrayContains(this.seen, value)) {
|
||||||
this.emitScalar('<circular reference: ' + (j$.isArray_(value) ? 'Array' : 'Object') + '>');
|
this.emitScalar('<circular reference: ' + (j$.isArray_(value) ? 'Array' : 'Object') + '>');
|
||||||
} else if (j$.isArray_(value) || j$.isA_('Object', value)) {
|
} else if (j$.isArray_(value) || j$.isA_('Object', value)) {
|
||||||
@@ -1810,7 +1907,7 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
|||||||
if (queueableFn.timeout) {
|
if (queueableFn.timeout) {
|
||||||
timeoutId = Function.prototype.apply.apply(self.timeout.setTimeout, [j$.getGlobal(), [function() {
|
timeoutId = Function.prototype.apply.apply(self.timeout.setTimeout, [j$.getGlobal(), [function() {
|
||||||
var error = new Error('Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.');
|
var error = new Error('Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.');
|
||||||
onException(error, queueableFn);
|
onException(error);
|
||||||
next();
|
next();
|
||||||
}, queueableFn.timeout()]]);
|
}, queueableFn.timeout()]]);
|
||||||
}
|
}
|
||||||
@@ -1823,12 +1920,12 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onException(e, queueableFn) {
|
function onException(e) {
|
||||||
self.onException(e);
|
self.onException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleException(e, queueableFn) {
|
function handleException(e, queueableFn) {
|
||||||
onException(e, queueableFn);
|
onException(e);
|
||||||
if (!self.catchException(e)) {
|
if (!self.catchException(e)) {
|
||||||
//TODO: set a var when we catch an exception and
|
//TODO: set a var when we catch an exception and
|
||||||
//use a finally block to close the loop in a nice way..
|
//use a finally block to close the loop in a nice way..
|
||||||
@@ -1900,6 +1997,17 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
|
|||||||
throw new Error(methodName + ' has already been spied upon');
|
throw new Error(methodName + ' has already been spied upon');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var descriptor;
|
||||||
|
try {
|
||||||
|
descriptor = Object.getOwnPropertyDescriptor(obj, methodName);
|
||||||
|
} catch(e) {
|
||||||
|
// IE 8 doesn't support `definePropery` on non-DOM nodes
|
||||||
|
}
|
||||||
|
|
||||||
|
if (descriptor && !(descriptor.writable || descriptor.set)) {
|
||||||
|
throw new Error(methodName + ' is not declared writable or has no setter');
|
||||||
|
}
|
||||||
|
|
||||||
var spy = j$.createSpy(methodName, obj[methodName]);
|
var spy = j$.createSpy(methodName, obj[methodName]);
|
||||||
|
|
||||||
currentSpies().push({
|
currentSpies().push({
|
||||||
@@ -2030,6 +2138,10 @@ getJasmineRequireObj().Suite = function(j$) {
|
|||||||
this.disabled = true;
|
this.disabled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Suite.prototype.pend = function(message) {
|
||||||
|
this.markedPending = true;
|
||||||
|
};
|
||||||
|
|
||||||
Suite.prototype.beforeEach = function(fn) {
|
Suite.prototype.beforeEach = function(fn) {
|
||||||
this.beforeFns.unshift(fn);
|
this.beforeFns.unshift(fn);
|
||||||
};
|
};
|
||||||
@@ -2055,6 +2167,10 @@ getJasmineRequireObj().Suite = function(j$) {
|
|||||||
return 'disabled';
|
return 'disabled';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.markedPending) {
|
||||||
|
return 'pending';
|
||||||
|
}
|
||||||
|
|
||||||
if (this.result.failedExpectations.length > 0) {
|
if (this.result.failedExpectations.length > 0) {
|
||||||
return 'failed';
|
return 'failed';
|
||||||
} else {
|
} else {
|
||||||
@@ -2184,6 +2300,7 @@ getJasmineRequireObj().TreeProcessor = function() {
|
|||||||
queueRunnerFactory = attrs.queueRunnerFactory,
|
queueRunnerFactory = attrs.queueRunnerFactory,
|
||||||
nodeStart = attrs.nodeStart || function() {},
|
nodeStart = attrs.nodeStart || function() {},
|
||||||
nodeComplete = attrs.nodeComplete || function() {},
|
nodeComplete = attrs.nodeComplete || function() {},
|
||||||
|
orderChildren = attrs.orderChildren || function(node) { return node.children; },
|
||||||
stats = { valid: true },
|
stats = { valid: true },
|
||||||
processed = false,
|
processed = false,
|
||||||
defaultMin = Infinity,
|
defaultMin = Infinity,
|
||||||
@@ -2208,6 +2325,7 @@ getJasmineRequireObj().TreeProcessor = function() {
|
|||||||
|
|
||||||
queueRunnerFactory({
|
queueRunnerFactory({
|
||||||
queueableFns: childFns,
|
queueableFns: childFns,
|
||||||
|
userContext: tree.sharedUserContext(),
|
||||||
onException: function() {
|
onException: function() {
|
||||||
tree.onException.apply(tree, arguments);
|
tree.onException.apply(tree, arguments);
|
||||||
},
|
},
|
||||||
@@ -2246,8 +2364,10 @@ getJasmineRequireObj().TreeProcessor = function() {
|
|||||||
} else {
|
} else {
|
||||||
var hasExecutableChild = false;
|
var hasExecutableChild = false;
|
||||||
|
|
||||||
for (var i = 0; i < node.children.length; i++) {
|
var orderedChildren = orderChildren(node);
|
||||||
var child = node.children[i];
|
|
||||||
|
for (var i = 0; i < orderedChildren.length; i++) {
|
||||||
|
var child = orderedChildren[i];
|
||||||
|
|
||||||
processNode(child, parentEnabled);
|
processNode(child, parentEnabled);
|
||||||
|
|
||||||
@@ -2264,7 +2384,7 @@ getJasmineRequireObj().TreeProcessor = function() {
|
|||||||
executable: hasExecutableChild
|
executable: hasExecutableChild
|
||||||
};
|
};
|
||||||
|
|
||||||
segmentChildren(node, stats[node.id], executableIndex);
|
segmentChildren(node, orderedChildren, stats[node.id], executableIndex);
|
||||||
|
|
||||||
if (!node.canBeReentered() && stats[node.id].segments.length > 1) {
|
if (!node.canBeReentered() && stats[node.id].segments.length > 1) {
|
||||||
stats = { valid: false };
|
stats = { valid: false };
|
||||||
@@ -2280,11 +2400,11 @@ getJasmineRequireObj().TreeProcessor = function() {
|
|||||||
return executableIndex === undefined ? defaultMax : executableIndex;
|
return executableIndex === undefined ? defaultMax : executableIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
function segmentChildren(node, nodeStats, executableIndex) {
|
function segmentChildren(node, orderedChildren, nodeStats, executableIndex) {
|
||||||
var currentSegment = { index: 0, owner: node, nodes: [], min: startingMin(executableIndex), max: startingMax(executableIndex) },
|
var currentSegment = { index: 0, owner: node, nodes: [], min: startingMin(executableIndex), max: startingMax(executableIndex) },
|
||||||
result = [currentSegment],
|
result = [currentSegment],
|
||||||
lastMax = defaultMax,
|
lastMax = defaultMax,
|
||||||
orderedChildSegments = orderChildSegments(node.children);
|
orderedChildSegments = orderChildSegments(orderedChildren);
|
||||||
|
|
||||||
function isSegmentBoundary(minIndex) {
|
function isSegmentBoundary(minIndex) {
|
||||||
return lastMax !== defaultMax && minIndex !== defaultMin && lastMax < minIndex - 1;
|
return lastMax !== defaultMax && minIndex !== defaultMin && lastMax < minIndex - 1;
|
||||||
@@ -2310,30 +2430,29 @@ getJasmineRequireObj().TreeProcessor = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function orderChildSegments(children) {
|
function orderChildSegments(children) {
|
||||||
var result = [];
|
var specifiedOrder = [],
|
||||||
|
unspecifiedOrder = [];
|
||||||
|
|
||||||
for (var i = 0; i < children.length; i++) {
|
for (var i = 0; i < children.length; i++) {
|
||||||
var child = children[i],
|
var child = children[i],
|
||||||
segments = stats[child.id].segments;
|
segments = stats[child.id].segments;
|
||||||
|
|
||||||
for (var j = 0; j < segments.length; j++) {
|
for (var j = 0; j < segments.length; j++) {
|
||||||
result.push(segments[j]);
|
var seg = segments[j];
|
||||||
|
|
||||||
|
if (seg.min === defaultMin) {
|
||||||
|
unspecifiedOrder.push(seg);
|
||||||
|
} else {
|
||||||
|
specifiedOrder.push(seg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result.sort(function(a, b) {
|
specifiedOrder.sort(function(a, b) {
|
||||||
if (a.min === null) {
|
|
||||||
return b.min === null ? 0 : 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (b.min === null) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return a.min - b.min;
|
return a.min - b.min;
|
||||||
});
|
});
|
||||||
|
|
||||||
return result;
|
return specifiedOrder.concat(unspecifiedOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
function executeNode(node, segmentNumber) {
|
function executeNode(node, segmentNumber) {
|
||||||
@@ -2384,6 +2503,12 @@ getJasmineRequireObj().TreeProcessor = function() {
|
|||||||
getJasmineRequireObj().Any = function(j$) {
|
getJasmineRequireObj().Any = function(j$) {
|
||||||
|
|
||||||
function Any(expectedObject) {
|
function Any(expectedObject) {
|
||||||
|
if (typeof expectedObject === 'undefined') {
|
||||||
|
throw new TypeError(
|
||||||
|
'jasmine.any() expects to be passed a constructor function. ' +
|
||||||
|
'Please pass one or use jasmine.anything() to match any object.'
|
||||||
|
);
|
||||||
|
}
|
||||||
this.expectedObject = expectedObject;
|
this.expectedObject = expectedObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2976,6 +3101,37 @@ getJasmineRequireObj().toHaveBeenCalled = function(j$) {
|
|||||||
return toHaveBeenCalled;
|
return toHaveBeenCalled;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
getJasmineRequireObj().toHaveBeenCalledTimes = function(j$) {
|
||||||
|
|
||||||
|
function toHaveBeenCalledTimes() {
|
||||||
|
return {
|
||||||
|
compare: function(actual, expected) {
|
||||||
|
if (!j$.isSpy(actual)) {
|
||||||
|
throw new Error('Expected a spy, but got ' + j$.pp(actual) + '.');
|
||||||
|
}
|
||||||
|
|
||||||
|
var args = Array.prototype.slice.call(arguments, 0),
|
||||||
|
result = { pass: false };
|
||||||
|
|
||||||
|
if(!expected){
|
||||||
|
throw new Error('Expected times failed is required as an argument.');
|
||||||
|
}
|
||||||
|
|
||||||
|
actual = args[0];
|
||||||
|
var calls = actual.calls.count();
|
||||||
|
var timesMessage = expected === 1 ? 'once' : expected + ' times';
|
||||||
|
result.pass = calls === expected;
|
||||||
|
result.message = result.pass ?
|
||||||
|
'Expected spy ' + actual.and.identity() + ' not to have been called ' + timesMessage + '. It was called ' + calls + ' times.' :
|
||||||
|
'Expected spy ' + actual.and.identity() + ' to have been called ' + timesMessage + '. It was called ' + calls + ' times.';
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return toHaveBeenCalledTimes;
|
||||||
|
};
|
||||||
|
|
||||||
getJasmineRequireObj().toHaveBeenCalledWith = function(j$) {
|
getJasmineRequireObj().toHaveBeenCalledWith = function(j$) {
|
||||||
|
|
||||||
function toHaveBeenCalledWith(util, customEqualityTesters) {
|
function toHaveBeenCalledWith(util, customEqualityTesters) {
|
||||||
@@ -3079,7 +3235,7 @@ getJasmineRequireObj().toThrow = function(j$) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
getJasmineRequireObj().toThrowError = function(j$) {
|
getJasmineRequireObj().toThrowError = function(j$) {
|
||||||
function toThrowError (util) {
|
function toThrowError () {
|
||||||
return {
|
return {
|
||||||
compare: function(actual) {
|
compare: function(actual) {
|
||||||
var threw = false,
|
var threw = false,
|
||||||
@@ -3294,5 +3450,5 @@ getJasmineRequireObj().interface = function(jasmine, env) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
getJasmineRequireObj().version = function() {
|
getJasmineRequireObj().version = function() {
|
||||||
return '2.3.2';
|
return '2.4.1';
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,6 +4,6 @@
|
|||||||
#
|
#
|
||||||
module Jasmine
|
module Jasmine
|
||||||
module Core
|
module Core
|
||||||
VERSION = "2.3.2"
|
VERSION = "2.4.1"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "jasmine-core",
|
"name": "jasmine-core",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"version": "2.3.2",
|
"version": "2.4.1",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/jasmine/jasmine.git"
|
"url": "https://github.com/jasmine/jasmine.git"
|
||||||
@@ -19,14 +19,14 @@
|
|||||||
"homepage": "http://jasmine.github.io",
|
"homepage": "http://jasmine.github.io",
|
||||||
"main": "./lib/jasmine-core.js",
|
"main": "./lib/jasmine-core.js",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"glob": "~3.2.9",
|
"glob": "~5.0.13",
|
||||||
"grunt": "~0.4.1",
|
"grunt": "~0.4.1",
|
||||||
"grunt-cli": "^0.1.13",
|
"grunt-cli": "^0.1.13",
|
||||||
"grunt-contrib-compass": "~0.6.0",
|
"grunt-contrib-compass": "~0.6.0",
|
||||||
"grunt-contrib-compress": "~0.5.2",
|
"grunt-contrib-compress": "~0.5.2",
|
||||||
"grunt-contrib-concat": "~0.3.0",
|
"grunt-contrib-concat": "~0.3.0",
|
||||||
"grunt-contrib-jshint": "~0.7.0",
|
"grunt-contrib-jshint": "~0.7.0",
|
||||||
"jasmine": "https://github.com/jasmine/jasmine-npm/archive/master.tar.gz",
|
"jasmine": "git://github.com/jasmine/jasmine-npm.git",
|
||||||
"load-grunt-tasks": "^0.4.0",
|
"load-grunt-tasks": "^0.4.0",
|
||||||
"shelljs": "~0.1.4",
|
"shelljs": "~0.1.4",
|
||||||
"temp": "~0.8.1"
|
"temp": "~0.8.1"
|
||||||
|
|||||||
14
release_notes/2.3.3.md
Normal file
14
release_notes/2.3.3.md
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# Jasmine 2.3.3 Release Notes
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
|
||||||
|
This is a hotfix release to fix a regression with the execution context for `beforeAll`
|
||||||
|
|
||||||
|
## Pull Requests & Issues
|
||||||
|
|
||||||
|
* Set the shared user context correctly when executing the top level suite
|
||||||
|
- Fixes [#846](https://github.com/jasmine/jasmine/issues/846)
|
||||||
|
|
||||||
|
------
|
||||||
|
|
||||||
|
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
||||||
22
release_notes/2.3.4.md
Normal file
22
release_notes/2.3.4.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# Jasmine 2.3.4 Release Notes
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
|
||||||
|
This is a hotfix release to fix a regression with execution ordering
|
||||||
|
|
||||||
|
## Pull Requests & Issues
|
||||||
|
|
||||||
|
* Fix ordering for suites with more than 11 direct children.
|
||||||
|
- Fixes [#850](https://github.com/jasmine/jasmine/issues/850)
|
||||||
|
|
||||||
|
* Update standalone installation instructions to reference the releases page
|
||||||
|
- Fixes [#603](https://github.com/jasmine/jasmine/issues/603)
|
||||||
|
|
||||||
|
* Remove dead CSS class styles
|
||||||
|
- Merges [#849](https://github.com/jasmine/jasmine/issues/849) from @prather-mcs
|
||||||
|
- Merges [#848](https://github.com/jasmine/jasmine/issues/848) from @prather-mcs
|
||||||
|
- Fixes [#847](https://github.com/jasmine/jasmine/issues/847)
|
||||||
|
|
||||||
|
------
|
||||||
|
|
||||||
|
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
||||||
91
release_notes/2.4.0.md
Normal file
91
release_notes/2.4.0.md
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
# Jasmine Core 2.4.0 Release Notes
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
|
||||||
|
This release contains a number of fixes and pull requests.
|
||||||
|
The most notable is probably that Jasmine now supports randomization of spec order
|
||||||
|
|
||||||
|
## Changes
|
||||||
|
|
||||||
|
* Run jasmine's specs in random order
|
||||||
|
* Add support for returning run details for reporting randomness
|
||||||
|
* Use className instead of class when creating DOM elements
|
||||||
|
|
||||||
|
|
||||||
|
## Pull Requests & Issues
|
||||||
|
|
||||||
|
* Syntax highlighting in README.md
|
||||||
|
- Merges [#973](https://github.com/jasmine/jasmine/issues/973) from @brunoqc
|
||||||
|
|
||||||
|
* Added a throw error block in describe incase a function with arguments is passed in describe
|
||||||
|
- Fixes [#896](https://github.com/jasmine/jasmine/issues/896)
|
||||||
|
- Merges [#955](https://github.com/jasmine/jasmine/issues/955) from @himajasuman
|
||||||
|
|
||||||
|
* Remove unused `queueableFn` arg from `onException`
|
||||||
|
- Fixes [#958](https://github.com/jasmine/jasmine/issues/958)
|
||||||
|
|
||||||
|
* Remove unused parameter from toThrowError
|
||||||
|
- Merges [#957](https://github.com/jasmine/jasmine/issues/957) from @FuzzySockets
|
||||||
|
|
||||||
|
* Abort spying when the target cannot be spied upon
|
||||||
|
- Fixes [#948](https://github.com/jasmine/jasmine/issues/948)
|
||||||
|
- Merges [#949](https://github.com/jasmine/jasmine/issues/949) from @StephanBijzitter
|
||||||
|
|
||||||
|
* Removed GOALS_2.0.md, doesn't seem to be needed anymore
|
||||||
|
- Merges [#954](https://github.com/jasmine/jasmine/issues/954) from @matthewhuff89
|
||||||
|
|
||||||
|
* Change #xit so that it will output a more BDD-style pending message
|
||||||
|
- Merges [#942](https://github.com/jasmine/jasmine/issues/942) from @lalunamel
|
||||||
|
- Fixes [#930](https://github.com/jasmine/jasmine/issues/930)
|
||||||
|
- Fixes [#912](https://github.com/jasmine/jasmine/issues/912)
|
||||||
|
|
||||||
|
* Allow tests to run in random order
|
||||||
|
- Merges [#927](https://github.com/jasmine/jasmine/issues/927) from @marcioj
|
||||||
|
|
||||||
|
* Use toString for objects if it has been overriden
|
||||||
|
- Merges [#929](https://github.com/jasmine/jasmine/issues/929) from @myitcv
|
||||||
|
- Fixes [#928](https://github.com/jasmine/jasmine/issues/928)
|
||||||
|
|
||||||
|
* Fix circles/x from getting cut off on Mac/chrome
|
||||||
|
- Merges [#932](https://github.com/jasmine/jasmine/issues/932) from @James-Dunn
|
||||||
|
|
||||||
|
* Postpone find() until it is needed
|
||||||
|
- Merges [#924](https://github.com/jasmine/jasmine/issues/924) from @danielalexiuc
|
||||||
|
- Fixes [#917](https://github.com/jasmine/jasmine/issues/917)
|
||||||
|
|
||||||
|
* check for global before assigning
|
||||||
|
* Reverse suite afterEach behavior to match semantics?
|
||||||
|
- Merges [#908](https://github.com/jasmine/jasmine/issues/908) from @mcamac
|
||||||
|
|
||||||
|
* Use badges from shields.io
|
||||||
|
- Merges [#902](https://github.com/jasmine/jasmine/issues/902) from @SimenB
|
||||||
|
|
||||||
|
* xdescribe marks pending, plus associated tests.
|
||||||
|
- Merges [#869](https://github.com/jasmine/jasmine/issues/869) from @ljwall
|
||||||
|
- Fixes [#855](https://github.com/jasmine/jasmine/issues/855)
|
||||||
|
|
||||||
|
* Update glob to latest
|
||||||
|
- Merge [#892](https://github.com/jasmine/jasmine/issues/892) from @obastemur
|
||||||
|
- Fixes [#891](https://github.com/jasmine/jasmine/issues/891)
|
||||||
|
|
||||||
|
* Remove moot `version` property from bower.json
|
||||||
|
- Merges [#874](https://github.com/jasmine/jasmine/issues/874) from @kkirsche
|
||||||
|
|
||||||
|
* add toHaveBeenCalledTimes matcher
|
||||||
|
- Merges [#871](https://github.com/jasmine/jasmine/issues/871) from @logankd
|
||||||
|
- Fixes [#853](https://github.com/jasmine/jasmine/issues/853)
|
||||||
|
|
||||||
|
* Update CONTRIBUTING.md
|
||||||
|
- Merges [#856](https://github.com/jasmine/jasmine/issues/856) from @lpww
|
||||||
|
|
||||||
|
* Make the HtmlReport CSS classes "unique enough"
|
||||||
|
- Merges [#851](https://github.com/jasmine/jasmine/issues/851) from @prather-mcs
|
||||||
|
- Fixes [#844](https://github.com/jasmine/jasmine/issues/844)
|
||||||
|
|
||||||
|
* Raise an error when jasmine.any() isn't passed a constructor
|
||||||
|
- Merges [#854](https://github.com/jasmine/jasmine/issues/854) from @danfinnie
|
||||||
|
- Fixes [#852](https://github.com/jasmine/jasmine/issues/852)
|
||||||
|
|
||||||
|
------
|
||||||
|
|
||||||
|
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
||||||
11
release_notes/2.4.1.md
Normal file
11
release_notes/2.4.1.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# Jasmine Core 2.4.1 Release Notes
|
||||||
|
|
||||||
|
## Changes
|
||||||
|
|
||||||
|
* Run `afterEach` in reverse order declared as before
|
||||||
|
- Reverts [#908](https://github.com/jasmine/jasmine/issues/908)
|
||||||
|
|
||||||
|
|
||||||
|
------
|
||||||
|
|
||||||
|
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
||||||
@@ -26,6 +26,15 @@ describe("Env", function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('#describe', function () {
|
||||||
|
var spec = function(done){};
|
||||||
|
it("throws the error", function() {
|
||||||
|
expect(function() {
|
||||||
|
env.describe('done method', spec);
|
||||||
|
}).toThrow(new Error('describe does not expect a done parameter'));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('can configure specs to throw errors on expectation failures', function() {
|
it('can configure specs to throw errors on expectation failures', function() {
|
||||||
env.throwOnExpectationFailure(true);
|
env.throwOnExpectationFailure(true);
|
||||||
|
|
||||||
@@ -45,4 +54,15 @@ describe("Env", function() {
|
|||||||
throwOnExpectationFailure: true
|
throwOnExpectationFailure: true
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('#xit', function() {
|
||||||
|
it('calls spec.pend with "Temporarily disabled with xit"', function() {
|
||||||
|
var pendSpy = jasmine.createSpy();
|
||||||
|
spyOn(env, 'it').and.returnValue({
|
||||||
|
pend: pendSpy
|
||||||
|
});
|
||||||
|
env.xit();
|
||||||
|
expect(pendSpy).toHaveBeenCalledWith('Temporarily disabled with xit');
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -248,4 +248,12 @@ describe("JsApiReporter", function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('#runDetails', function() {
|
||||||
|
it('should have details about the run', function() {
|
||||||
|
var reporter = new j$.JsApiReporter({});
|
||||||
|
reporter.jasmineDone({some: {run: 'details'}});
|
||||||
|
expect(reporter.runDetails).toEqual({some: {run: 'details'}});
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -181,6 +181,14 @@ describe("j$.pp", function () {
|
|||||||
expect(j$.pp(obj)).toEqual("strung");
|
expect(j$.pp(obj)).toEqual("strung");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should stringify objects that implement custom toString", function () {
|
||||||
|
var obj = {
|
||||||
|
toString: function () { return "my toString"; }
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(j$.pp(obj)).toEqual("my toString");
|
||||||
|
});
|
||||||
|
|
||||||
it("should handle objects with null prototype", function() {
|
it("should handle objects with null prototype", function() {
|
||||||
if (jasmine.getEnv().ieVersion < 9) { return; }
|
if (jasmine.getEnv().ieVersion < 9) { return; }
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,35 @@ describe("SpyRegistry", function() {
|
|||||||
}).toThrowError(/has already been spied upon/);
|
}).toThrowError(/has already been spied upon/);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("checks if it can be spied upon", function() {
|
||||||
|
// IE 8 doesn't support `definePropery` on non-DOM nodes
|
||||||
|
if (jasmine.getEnv().ieVersion < 9) { return; }
|
||||||
|
|
||||||
|
var scope = {};
|
||||||
|
|
||||||
|
function myFunc() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.defineProperty(scope, 'myFunc', {
|
||||||
|
get: function() {
|
||||||
|
return myFunc;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var spies = [],
|
||||||
|
spyRegistry = new j$.SpyRegistry({currentSpies: function() { return spies; }}),
|
||||||
|
subject = { spiedFunc: scope.myFunc };
|
||||||
|
|
||||||
|
expect(function() {
|
||||||
|
spyRegistry.spyOn(scope, 'myFunc');
|
||||||
|
}).toThrowError(/is not declared writable or has no setter/);
|
||||||
|
|
||||||
|
expect(function() {
|
||||||
|
spyRegistry.spyOn(subject, 'spiedFunc');
|
||||||
|
}).not.toThrowError(/is not declared writable or has no setter/);
|
||||||
|
});
|
||||||
|
|
||||||
it("overrides the method on the object and returns the spy", function() {
|
it("overrides the method on the object and returns the spy", function() {
|
||||||
var originalFunctionWasCalled = false,
|
var originalFunctionWasCalled = false,
|
||||||
spyRegistry = new j$.SpyRegistry(),
|
spyRegistry = new j$.SpyRegistry(),
|
||||||
|
|||||||
@@ -90,6 +90,21 @@ describe("Suite", function() {
|
|||||||
expect(suite.getResult().status).toBe('disabled');
|
expect(suite.getResult().status).toBe('disabled');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("retrieves a result with pending status", function() {
|
||||||
|
var suite = new j$.Suite({});
|
||||||
|
suite.pend();
|
||||||
|
|
||||||
|
expect(suite.getResult().status).toBe('pending');
|
||||||
|
});
|
||||||
|
|
||||||
|
it("priviledges a disabled status over pending status", function() {
|
||||||
|
var suite = new j$.Suite({});
|
||||||
|
suite.disable();
|
||||||
|
suite.pend();
|
||||||
|
|
||||||
|
expect(suite.getResult().status).toBe('disabled');
|
||||||
|
});
|
||||||
|
|
||||||
it("is executable if not disabled", function() {
|
it("is executable if not disabled", function() {
|
||||||
var suite = new j$.Suite({});
|
var suite = new j$.Suite({});
|
||||||
|
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ describe("TreeProcessor", function() {
|
|||||||
|
|
||||||
it("runs a single leaf", function() {
|
it("runs a single leaf", function() {
|
||||||
var leaf = new Leaf(),
|
var leaf = new Leaf(),
|
||||||
node = new Node({ children: [leaf] }),
|
node = new Node({ children: [leaf], userContext: { root: 'context' } }),
|
||||||
queueRunner = jasmine.createSpy('queueRunner'),
|
queueRunner = jasmine.createSpy('queueRunner'),
|
||||||
processor = new j$.TreeProcessor({ tree: node, runnableIds: [leaf.id], queueRunnerFactory: queueRunner }),
|
processor = new j$.TreeProcessor({ tree: node, runnableIds: [leaf.id], queueRunnerFactory: queueRunner }),
|
||||||
treeComplete = jasmine.createSpy('treeComplete');
|
treeComplete = jasmine.createSpy('treeComplete');
|
||||||
@@ -212,6 +212,7 @@ describe("TreeProcessor", function() {
|
|||||||
expect(queueRunner).toHaveBeenCalledWith({
|
expect(queueRunner).toHaveBeenCalledWith({
|
||||||
onComplete: treeComplete,
|
onComplete: treeComplete,
|
||||||
onException: jasmine.any(Function),
|
onException: jasmine.any(Function),
|
||||||
|
userContext: { root: 'context' },
|
||||||
queueableFns: [{ fn: jasmine.any(Function) }]
|
queueableFns: [{ fn: jasmine.any(Function) }]
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -222,7 +223,7 @@ describe("TreeProcessor", function() {
|
|||||||
|
|
||||||
it("runs a node with no children", function() {
|
it("runs a node with no children", function() {
|
||||||
var node = new Node({ userContext: { node: 'context' } }),
|
var node = new Node({ userContext: { node: 'context' } }),
|
||||||
root = new Node({ children: [node] }),
|
root = new Node({ children: [node], userContext: { root: 'context' } }),
|
||||||
nodeStart = jasmine.createSpy('nodeStart'),
|
nodeStart = jasmine.createSpy('nodeStart'),
|
||||||
nodeComplete = jasmine.createSpy('nodeComplete'),
|
nodeComplete = jasmine.createSpy('nodeComplete'),
|
||||||
queueRunner = jasmine.createSpy('queueRunner'),
|
queueRunner = jasmine.createSpy('queueRunner'),
|
||||||
@@ -241,6 +242,7 @@ describe("TreeProcessor", function() {
|
|||||||
expect(queueRunner).toHaveBeenCalledWith({
|
expect(queueRunner).toHaveBeenCalledWith({
|
||||||
onComplete: treeComplete,
|
onComplete: treeComplete,
|
||||||
onException: jasmine.any(Function),
|
onException: jasmine.any(Function),
|
||||||
|
userContext: { root: 'context' },
|
||||||
queueableFns: [{ fn: jasmine.any(Function) }]
|
queueableFns: [{ fn: jasmine.any(Function) }]
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -630,4 +632,125 @@ describe("TreeProcessor", function() {
|
|||||||
childFns[1].fn();
|
childFns[1].fn();
|
||||||
expect(leaf3.execute).toHaveBeenCalled();
|
expect(leaf3.execute).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("runs large segments of nodes in the order they were declared", function() {
|
||||||
|
var leaf1 = new Leaf(),
|
||||||
|
leaf2 = new Leaf(),
|
||||||
|
leaf3 = new Leaf(),
|
||||||
|
leaf4 = new Leaf(),
|
||||||
|
leaf5 = new Leaf(),
|
||||||
|
leaf6 = new Leaf(),
|
||||||
|
leaf7 = new Leaf(),
|
||||||
|
leaf8 = new Leaf(),
|
||||||
|
leaf9 = new Leaf(),
|
||||||
|
leaf10 = new Leaf(),
|
||||||
|
leaf11 = new Leaf(),
|
||||||
|
root = new Node({ children: [leaf1, leaf2, leaf3, leaf4, leaf5, leaf6, leaf7, leaf8, leaf9, leaf10, leaf11] }),
|
||||||
|
queueRunner = jasmine.createSpy('queueRunner'),
|
||||||
|
processor = new j$.TreeProcessor({
|
||||||
|
tree: root,
|
||||||
|
runnableIds: [root.id],
|
||||||
|
queueRunnerFactory: queueRunner
|
||||||
|
});
|
||||||
|
|
||||||
|
processor.execute();
|
||||||
|
var queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
|
||||||
|
expect(queueableFns.length).toBe(11);
|
||||||
|
|
||||||
|
queueableFns[0].fn();
|
||||||
|
expect(leaf1.execute).toHaveBeenCalled();
|
||||||
|
|
||||||
|
queueableFns[1].fn();
|
||||||
|
expect(leaf2.execute).toHaveBeenCalled();
|
||||||
|
|
||||||
|
queueableFns[2].fn();
|
||||||
|
expect(leaf3.execute).toHaveBeenCalled();
|
||||||
|
|
||||||
|
queueableFns[3].fn();
|
||||||
|
expect(leaf4.execute).toHaveBeenCalled();
|
||||||
|
|
||||||
|
queueableFns[4].fn();
|
||||||
|
expect(leaf5.execute).toHaveBeenCalled();
|
||||||
|
|
||||||
|
queueableFns[5].fn();
|
||||||
|
expect(leaf6.execute).toHaveBeenCalled();
|
||||||
|
|
||||||
|
queueableFns[6].fn();
|
||||||
|
expect(leaf7.execute).toHaveBeenCalled();
|
||||||
|
|
||||||
|
queueableFns[7].fn();
|
||||||
|
expect(leaf8.execute).toHaveBeenCalled();
|
||||||
|
|
||||||
|
queueableFns[8].fn();
|
||||||
|
expect(leaf9.execute).toHaveBeenCalled();
|
||||||
|
|
||||||
|
queueableFns[9].fn();
|
||||||
|
expect(leaf10.execute).toHaveBeenCalled();
|
||||||
|
|
||||||
|
queueableFns[10].fn();
|
||||||
|
expect(leaf11.execute).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("runs nodes in a custom order when orderChildren is overrided", function() {
|
||||||
|
var leaf1 = new Leaf(),
|
||||||
|
leaf2 = new Leaf(),
|
||||||
|
leaf3 = new Leaf(),
|
||||||
|
leaf4 = new Leaf(),
|
||||||
|
leaf5 = new Leaf(),
|
||||||
|
leaf6 = new Leaf(),
|
||||||
|
leaf7 = new Leaf(),
|
||||||
|
leaf8 = new Leaf(),
|
||||||
|
leaf9 = new Leaf(),
|
||||||
|
leaf10 = new Leaf(),
|
||||||
|
leaf11 = new Leaf(),
|
||||||
|
root = new Node({ children: [leaf1, leaf2, leaf3, leaf4, leaf5, leaf6, leaf7, leaf8, leaf9, leaf10, leaf11] }),
|
||||||
|
queueRunner = jasmine.createSpy('queueRunner'),
|
||||||
|
processor = new j$.TreeProcessor({
|
||||||
|
tree: root,
|
||||||
|
runnableIds: [root.id],
|
||||||
|
queueRunnerFactory: queueRunner,
|
||||||
|
orderChildren: function(node) {
|
||||||
|
var children = node.children.slice();
|
||||||
|
return children.reverse();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
processor.execute();
|
||||||
|
var queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
|
||||||
|
expect(queueableFns.length).toBe(11);
|
||||||
|
|
||||||
|
queueableFns[0].fn();
|
||||||
|
expect(leaf11.execute).toHaveBeenCalled();
|
||||||
|
|
||||||
|
queueableFns[1].fn();
|
||||||
|
expect(leaf10.execute).toHaveBeenCalled();
|
||||||
|
|
||||||
|
queueableFns[2].fn();
|
||||||
|
expect(leaf9.execute).toHaveBeenCalled();
|
||||||
|
|
||||||
|
queueableFns[3].fn();
|
||||||
|
expect(leaf8.execute).toHaveBeenCalled();
|
||||||
|
|
||||||
|
queueableFns[4].fn();
|
||||||
|
expect(leaf7.execute).toHaveBeenCalled();
|
||||||
|
|
||||||
|
queueableFns[5].fn();
|
||||||
|
expect(leaf6.execute).toHaveBeenCalled();
|
||||||
|
|
||||||
|
queueableFns[6].fn();
|
||||||
|
expect(leaf5.execute).toHaveBeenCalled();
|
||||||
|
|
||||||
|
queueableFns[7].fn();
|
||||||
|
expect(leaf4.execute).toHaveBeenCalled();
|
||||||
|
|
||||||
|
queueableFns[8].fn();
|
||||||
|
expect(leaf3.execute).toHaveBeenCalled();
|
||||||
|
|
||||||
|
queueableFns[9].fn();
|
||||||
|
expect(leaf2.execute).toHaveBeenCalled();
|
||||||
|
|
||||||
|
queueableFns[10].fn();
|
||||||
|
expect(leaf1.execute).toHaveBeenCalled();
|
||||||
|
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -42,4 +42,11 @@ describe("Any", function() {
|
|||||||
expect(any.jasmineToString()).toEqual('<jasmine.any(Number)>');
|
expect(any.jasmineToString()).toEqual('<jasmine.any(Number)>');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("when called without an argument", function() {
|
||||||
|
it("tells the user to pass a constructor or use jasmine.anything()", function() {
|
||||||
|
expect(function() {
|
||||||
|
new j$.Any();
|
||||||
|
}).toThrowError(TypeError, /constructor.*anything/);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -207,7 +207,6 @@ describe("Env integration", function() {
|
|||||||
var env = new j$.Env();
|
var env = new j$.Env();
|
||||||
|
|
||||||
env.addReporter({jasmineDone: done});
|
env.addReporter({jasmineDone: done});
|
||||||
|
|
||||||
env.describe("tests", function() {
|
env.describe("tests", function() {
|
||||||
var firstTimeThrough = true, firstSpecContext, secondSpecContext;
|
var firstTimeThrough = true, firstSpecContext, secondSpecContext;
|
||||||
|
|
||||||
@@ -1115,6 +1114,78 @@ describe("Env integration", function() {
|
|||||||
|
|
||||||
env.execute();
|
env.execute();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should run focused tests inside an xdescribe', function(done) {
|
||||||
|
var env = new j$.Env(),
|
||||||
|
reporter = jasmine.createSpyObj('fakeReporter', [
|
||||||
|
"jasmineStarted",
|
||||||
|
"jasmineDone",
|
||||||
|
"suiteStarted",
|
||||||
|
"suiteDone",
|
||||||
|
"specStarted",
|
||||||
|
"specDone"
|
||||||
|
]);
|
||||||
|
|
||||||
|
reporter.jasmineDone.and.callFake(function() {
|
||||||
|
expect(reporter.jasmineStarted).toHaveBeenCalledWith({
|
||||||
|
totalSpecsDefined: 1
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(reporter.specDone).toHaveBeenCalledWith(jasmine.objectContaining({
|
||||||
|
description: 'with a fit spec',
|
||||||
|
status: 'failed'
|
||||||
|
}));
|
||||||
|
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
env.addReporter(reporter);
|
||||||
|
|
||||||
|
env.xdescribe("xd suite", function() {
|
||||||
|
env.fit("with a fit spec", function() {
|
||||||
|
env.expect(true).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
env.execute();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should run focused suites inside an xdescribe', function(done) {
|
||||||
|
var env = new j$.Env(),
|
||||||
|
reporter = jasmine.createSpyObj('fakeReporter', [
|
||||||
|
"jasmineStarted",
|
||||||
|
"jasmineDone",
|
||||||
|
"suiteStarted",
|
||||||
|
"suiteDone",
|
||||||
|
"specStarted",
|
||||||
|
"specDone"
|
||||||
|
]);
|
||||||
|
|
||||||
|
reporter.jasmineDone.and.callFake(function() {
|
||||||
|
expect(reporter.jasmineStarted).toHaveBeenCalledWith({
|
||||||
|
totalSpecsDefined: 1
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(reporter.specDone).toHaveBeenCalledWith(jasmine.objectContaining({
|
||||||
|
description: 'with a spec',
|
||||||
|
status: 'failed'
|
||||||
|
}));
|
||||||
|
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
env.addReporter(reporter);
|
||||||
|
|
||||||
|
env.xdescribe("xd suite", function() {
|
||||||
|
env.fdescribe("fd suite", function() {
|
||||||
|
env.it("with a spec", function() {
|
||||||
|
env.expect(true).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
env.execute();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should report as expected", function(done) {
|
it("should report as expected", function(done) {
|
||||||
@@ -1227,9 +1298,10 @@ describe("Env integration", function() {
|
|||||||
totalSpecsDefined: 1
|
totalSpecsDefined: 1
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(reporter.specDone).toHaveBeenCalledWith(jasmine.objectContaining({ status: 'disabled' }));
|
expect(reporter.specDone).toHaveBeenCalledWith(jasmine.objectContaining({ status: 'pending' }));
|
||||||
expect(reporter.suiteDone.calls.count()).toBe(3);
|
expect(reporter.suiteDone).toHaveBeenCalledWith(jasmine.objectContaining({ description: 'xd out', status: 'pending' }));
|
||||||
|
expect(reporter.suiteDone.calls.count()).toBe(4);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1238,8 +1310,10 @@ describe("Env integration", function() {
|
|||||||
env.describe("A Suite", function() {
|
env.describe("A Suite", function() {
|
||||||
env.describe("nested", function() {
|
env.describe("nested", function() {
|
||||||
env.xdescribe("xd out", function() {
|
env.xdescribe("xd out", function() {
|
||||||
env.it("with a spec", function() {
|
env.describe("nested again", function() {
|
||||||
env.expect(true).toBe(false);
|
env.it("with a spec", function() {
|
||||||
|
env.expect(true).toBe(false);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ describe("jasmine spec running", function () {
|
|||||||
env.execute();
|
env.execute();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should run multiple befores and afters in the order they are declared", function(done) {
|
it("should run multiple befores and afters ordered so functions declared later are treated as more specific", function(done) {
|
||||||
var actions = [];
|
var actions = [];
|
||||||
|
|
||||||
env.beforeEach(function () {
|
env.beforeEach(function () {
|
||||||
@@ -696,4 +696,103 @@ describe("jasmine spec running", function () {
|
|||||||
env.execute([spec2.id, spec3.id, spec1.id]);
|
env.execute([spec2.id, spec3.id, spec1.id]);
|
||||||
}).toThrowError(/afterAll/);
|
}).toThrowError(/afterAll/);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should run the tests in a consistent order when a seed is supplied", function(done) {
|
||||||
|
var actions = [];
|
||||||
|
env.randomizeTests(true);
|
||||||
|
env.seed('123456');
|
||||||
|
|
||||||
|
env.beforeEach(function () {
|
||||||
|
actions.push('topSuite beforeEach');
|
||||||
|
});
|
||||||
|
|
||||||
|
env.afterEach(function () {
|
||||||
|
actions.push('topSuite afterEach');
|
||||||
|
});
|
||||||
|
|
||||||
|
env.describe('Something', function() {
|
||||||
|
env.beforeEach(function() {
|
||||||
|
actions.push('outer beforeEach');
|
||||||
|
});
|
||||||
|
|
||||||
|
env.afterEach(function() {
|
||||||
|
actions.push('outer afterEach');
|
||||||
|
});
|
||||||
|
|
||||||
|
env.it('does it 1', function() {
|
||||||
|
actions.push('outer it 1');
|
||||||
|
});
|
||||||
|
|
||||||
|
env.describe('Inner 1', function() {
|
||||||
|
env.beforeEach(function() {
|
||||||
|
actions.push('inner 1 beforeEach');
|
||||||
|
});
|
||||||
|
|
||||||
|
env.afterEach(function() {
|
||||||
|
actions.push('inner 1 afterEach');
|
||||||
|
});
|
||||||
|
|
||||||
|
env.it('does it 2', function() {
|
||||||
|
actions.push('inner 1 it');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
env.it('does it 3', function() {
|
||||||
|
actions.push('outer it 2');
|
||||||
|
});
|
||||||
|
|
||||||
|
env.describe('Inner 2', function() {
|
||||||
|
env.beforeEach(function() {
|
||||||
|
actions.push('inner 2 beforeEach');
|
||||||
|
});
|
||||||
|
|
||||||
|
env.afterEach(function() {
|
||||||
|
actions.push('inner 2 afterEach');
|
||||||
|
});
|
||||||
|
|
||||||
|
env.it('does it 2', function() {
|
||||||
|
actions.push('inner 2 it');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
var assertions = function() {
|
||||||
|
var expected = [
|
||||||
|
'topSuite beforeEach',
|
||||||
|
'outer beforeEach',
|
||||||
|
'outer it 2',
|
||||||
|
'outer afterEach',
|
||||||
|
'topSuite afterEach',
|
||||||
|
|
||||||
|
'topSuite beforeEach',
|
||||||
|
'outer beforeEach',
|
||||||
|
'inner 2 beforeEach',
|
||||||
|
'inner 2 it',
|
||||||
|
'inner 2 afterEach',
|
||||||
|
'outer afterEach',
|
||||||
|
'topSuite afterEach',
|
||||||
|
|
||||||
|
'topSuite beforeEach',
|
||||||
|
'outer beforeEach',
|
||||||
|
'inner 1 beforeEach',
|
||||||
|
'inner 1 it',
|
||||||
|
'inner 1 afterEach',
|
||||||
|
'outer afterEach',
|
||||||
|
'topSuite afterEach',
|
||||||
|
|
||||||
|
'topSuite beforeEach',
|
||||||
|
'outer beforeEach',
|
||||||
|
'outer it 1',
|
||||||
|
'outer afterEach',
|
||||||
|
'topSuite afterEach'
|
||||||
|
];
|
||||||
|
expect(actions).toEqual(expected);
|
||||||
|
done();
|
||||||
|
};
|
||||||
|
|
||||||
|
env.addReporter({jasmineDone: assertions});
|
||||||
|
|
||||||
|
env.execute();
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
81
spec/core/matchers/toHaveBeenCalledTimesSpec.js
Normal file
81
spec/core/matchers/toHaveBeenCalledTimesSpec.js
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
describe("toHaveBeenCalledTimes", function() {
|
||||||
|
it("passes when the actual matches the expected", function() {
|
||||||
|
var matcher = j$.matchers.toHaveBeenCalledTimes(),
|
||||||
|
calledSpy = j$.createSpy('called-spy'),
|
||||||
|
result;
|
||||||
|
calledSpy();
|
||||||
|
|
||||||
|
result = matcher.compare(calledSpy, 1);
|
||||||
|
expect(result.pass).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("fails when expected numbers is not supplied", function(){
|
||||||
|
var matcher = j$.matchers.toHaveBeenCalledTimes(),
|
||||||
|
spy = j$.createSpy('spy'),
|
||||||
|
result;
|
||||||
|
|
||||||
|
spy();
|
||||||
|
expect(function() {
|
||||||
|
matcher.compare(spy);
|
||||||
|
}).toThrowError('Expected times failed is required as an argument.');
|
||||||
|
});
|
||||||
|
|
||||||
|
it("fails when the actual was called less than the expected", function() {
|
||||||
|
var matcher = j$.matchers.toHaveBeenCalledTimes(),
|
||||||
|
uncalledSpy = j$.createSpy('uncalled spy'),
|
||||||
|
result;
|
||||||
|
|
||||||
|
result = matcher.compare(uncalledSpy, 2);
|
||||||
|
expect(result.pass).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("fails when the actual was called more than expected", function() {
|
||||||
|
var matcher = j$.matchers.toHaveBeenCalledTimes(),
|
||||||
|
uncalledSpy = j$.createSpy('uncalled spy'),
|
||||||
|
result;
|
||||||
|
|
||||||
|
uncalledSpy();
|
||||||
|
uncalledSpy();
|
||||||
|
|
||||||
|
result = matcher.compare(uncalledSpy, 1);
|
||||||
|
expect(result.pass).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("throws an exception when the actual is not a spy", function() {
|
||||||
|
var matcher = j$.matchers.toHaveBeenCalledTimes(),
|
||||||
|
fn = function() {};
|
||||||
|
|
||||||
|
expect(function() {
|
||||||
|
matcher.compare(fn);
|
||||||
|
}).toThrowError("Expected a spy, but got Function.");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("has a custom message on failure that tells it was called only once", function() {
|
||||||
|
var matcher = j$.matchers.toHaveBeenCalledTimes(),
|
||||||
|
spy = j$.createSpy('sample-spy'),
|
||||||
|
result;
|
||||||
|
spy();
|
||||||
|
spy();
|
||||||
|
spy();
|
||||||
|
spy();
|
||||||
|
|
||||||
|
result = matcher.compare(spy, 1);
|
||||||
|
|
||||||
|
expect(result.message).toEqual('Expected spy sample-spy to have been called once. It was called ' + 4 + ' times.');
|
||||||
|
});
|
||||||
|
|
||||||
|
it("has a custom message on failure that tells how many times it was called", function() {
|
||||||
|
var matcher = j$.matchers.toHaveBeenCalledTimes(),
|
||||||
|
spy = j$.createSpy('sample-spy'),
|
||||||
|
result;
|
||||||
|
spy();
|
||||||
|
spy();
|
||||||
|
spy();
|
||||||
|
spy();
|
||||||
|
|
||||||
|
result = matcher.compare(spy, 2);
|
||||||
|
|
||||||
|
expect(result.message).toEqual('Expected spy sample-spy to have been called 2 times. It was called ' + 4 + ' times.');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
@@ -146,7 +146,7 @@ describe("toThrowError", function() {
|
|||||||
var util = {
|
var util = {
|
||||||
equals: jasmine.createSpy('delegated-equal').and.returnValue(true)
|
equals: jasmine.createSpy('delegated-equal').and.returnValue(true)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toThrowError(util),
|
matcher = j$.matchers.toThrowError(),
|
||||||
fn = function() {
|
fn = function() {
|
||||||
throw new Error();
|
throw new Error();
|
||||||
},
|
},
|
||||||
@@ -162,7 +162,7 @@ describe("toThrowError", function() {
|
|||||||
var util = {
|
var util = {
|
||||||
equals: jasmine.createSpy('delegated-equal').and.returnValue(true)
|
equals: jasmine.createSpy('delegated-equal').and.returnValue(true)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toThrowError(util),
|
matcher = j$.matchers.toThrowError(),
|
||||||
CustomError = function CustomError(arg) { arg.x },
|
CustomError = function CustomError(arg) { arg.x },
|
||||||
fn = function() {
|
fn = function() {
|
||||||
throw new CustomError({ x: 1 });
|
throw new CustomError({ x: 1 });
|
||||||
@@ -181,7 +181,7 @@ describe("toThrowError", function() {
|
|||||||
var util = {
|
var util = {
|
||||||
equals: jasmine.createSpy('delegated-equal').and.returnValue(false)
|
equals: jasmine.createSpy('delegated-equal').and.returnValue(false)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toThrowError(util),
|
matcher = j$.matchers.toThrowError(),
|
||||||
fn = function() {
|
fn = function() {
|
||||||
throw new Error();
|
throw new Error();
|
||||||
},
|
},
|
||||||
@@ -197,7 +197,7 @@ describe("toThrowError", function() {
|
|||||||
var util = {
|
var util = {
|
||||||
equals: jasmine.createSpy('delegated-equal').and.returnValue(true)
|
equals: jasmine.createSpy('delegated-equal').and.returnValue(true)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toThrowError(util),
|
matcher = j$.matchers.toThrowError(),
|
||||||
fn = function() {
|
fn = function() {
|
||||||
throw new TypeError("foo");
|
throw new TypeError("foo");
|
||||||
},
|
},
|
||||||
@@ -213,7 +213,7 @@ describe("toThrowError", function() {
|
|||||||
var util = {
|
var util = {
|
||||||
equals: jasmine.createSpy('delegated-equal').and.returnValue(true)
|
equals: jasmine.createSpy('delegated-equal').and.returnValue(true)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toThrowError(util),
|
matcher = j$.matchers.toThrowError(),
|
||||||
CustomError = function CustomError(arg) { this.message = arg.message },
|
CustomError = function CustomError(arg) { this.message = arg.message },
|
||||||
fn = function() {
|
fn = function() {
|
||||||
throw new CustomError({message: "foo"});
|
throw new CustomError({message: "foo"});
|
||||||
@@ -232,7 +232,7 @@ describe("toThrowError", function() {
|
|||||||
var util = {
|
var util = {
|
||||||
equals: jasmine.createSpy('delegated-equal').and.returnValue(false)
|
equals: jasmine.createSpy('delegated-equal').and.returnValue(false)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toThrowError(util),
|
matcher = j$.matchers.toThrowError(),
|
||||||
fn = function() {
|
fn = function() {
|
||||||
throw new TypeError("foo");
|
throw new TypeError("foo");
|
||||||
},
|
},
|
||||||
@@ -248,7 +248,7 @@ describe("toThrowError", function() {
|
|||||||
var util = {
|
var util = {
|
||||||
equals: jasmine.createSpy('delegated-equal').and.returnValue(true)
|
equals: jasmine.createSpy('delegated-equal').and.returnValue(true)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toThrowError(util),
|
matcher = j$.matchers.toThrowError(),
|
||||||
fn = function() {
|
fn = function() {
|
||||||
throw new TypeError("foo");
|
throw new TypeError("foo");
|
||||||
},
|
},
|
||||||
@@ -264,7 +264,7 @@ describe("toThrowError", function() {
|
|||||||
var util = {
|
var util = {
|
||||||
equals: jasmine.createSpy('delegated-equal').and.returnValue(false)
|
equals: jasmine.createSpy('delegated-equal').and.returnValue(false)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toThrowError(util),
|
matcher = j$.matchers.toThrowError(),
|
||||||
fn = function() {
|
fn = function() {
|
||||||
throw new TypeError("foo");
|
throw new TypeError("foo");
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -14,20 +14,20 @@ describe("New HtmlReporter", function() {
|
|||||||
|
|
||||||
// Main top-level elements
|
// Main top-level elements
|
||||||
expect(container.querySelector("div.jasmine_html-reporter")).toBeTruthy();
|
expect(container.querySelector("div.jasmine_html-reporter")).toBeTruthy();
|
||||||
expect(container.querySelector("div.banner")).toBeTruthy();
|
expect(container.querySelector("div.jasmine-banner")).toBeTruthy();
|
||||||
expect(container.querySelector("div.alert")).toBeTruthy();
|
expect(container.querySelector("div.jasmine-alert")).toBeTruthy();
|
||||||
expect(container.querySelector("div.results")).toBeTruthy();
|
expect(container.querySelector("div.jasmine-results")).toBeTruthy();
|
||||||
|
|
||||||
expect(container.querySelector("ul.symbol-summary")).toBeTruthy();
|
expect(container.querySelector("ul.jasmine-symbol-summary")).toBeTruthy();
|
||||||
|
|
||||||
// title banner
|
// title banner
|
||||||
var banner = container.querySelector(".banner");
|
var banner = container.querySelector(".jasmine-banner");
|
||||||
|
|
||||||
var title = banner.querySelector("a.title");
|
var title = banner.querySelector("a.jasmine-title");
|
||||||
expect(title.getAttribute('href')).toEqual('http://jasmine.github.io/');
|
expect(title.getAttribute('href')).toEqual('http://jasmine.github.io/');
|
||||||
expect(title.getAttribute('target')).toEqual('_blank');
|
expect(title.getAttribute('target')).toEqual('_blank');
|
||||||
|
|
||||||
var version = banner.querySelector(".version"),
|
var version = banner.querySelector(".jasmine-version"),
|
||||||
versionText = 'textContent' in version ? version.textContent : version.innerText;
|
versionText = 'textContent' in version ? version.textContent : version.innerText;
|
||||||
expect(versionText).toEqual(j$.version);
|
expect(versionText).toEqual(j$.version);
|
||||||
});
|
});
|
||||||
@@ -90,8 +90,8 @@ describe("New HtmlReporter", function() {
|
|||||||
failedExpectations: []
|
failedExpectations: []
|
||||||
});
|
});
|
||||||
expect(console.error).toHaveBeenCalledWith("Spec \'Some Name\' has no expectations.");
|
expect(console.error).toHaveBeenCalledWith("Spec \'Some Name\' has no expectations.");
|
||||||
var specEl = container.querySelector('.symbol-summary li');
|
var specEl = container.querySelector('.jasmine-symbol-summary li');
|
||||||
expect(specEl.getAttribute("class")).toEqual("empty");
|
expect(specEl.getAttribute("class")).toEqual("jasmine-empty");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("reports the status symbol of a disabled spec", function() {
|
it("reports the status symbol of a disabled spec", function() {
|
||||||
@@ -108,8 +108,8 @@ describe("New HtmlReporter", function() {
|
|||||||
|
|
||||||
reporter.specDone({id: 789, status: "disabled", fullName: "symbols should have titles", passedExpectations: [], failedExpectations: []});
|
reporter.specDone({id: 789, status: "disabled", fullName: "symbols should have titles", passedExpectations: [], failedExpectations: []});
|
||||||
|
|
||||||
var specEl = container.querySelector('.symbol-summary li');
|
var specEl = container.querySelector('.jasmine-symbol-summary li');
|
||||||
expect(specEl.getAttribute("class")).toEqual("disabled");
|
expect(specEl.getAttribute("class")).toEqual("jasmine-disabled");
|
||||||
expect(specEl.getAttribute("id")).toEqual("spec_789");
|
expect(specEl.getAttribute("id")).toEqual("spec_789");
|
||||||
expect(specEl.getAttribute("title")).toEqual("symbols should have titles");
|
expect(specEl.getAttribute("title")).toEqual("symbols should have titles");
|
||||||
});
|
});
|
||||||
@@ -128,8 +128,8 @@ describe("New HtmlReporter", function() {
|
|||||||
|
|
||||||
reporter.specDone({id: 789, status: "pending", passedExpectations: [], failedExpectations: []});
|
reporter.specDone({id: 789, status: "pending", passedExpectations: [], failedExpectations: []});
|
||||||
|
|
||||||
var specEl = container.querySelector('.symbol-summary li');
|
var specEl = container.querySelector('.jasmine-symbol-summary li');
|
||||||
expect(specEl.getAttribute("class")).toEqual("pending");
|
expect(specEl.getAttribute("class")).toEqual("jasmine-pending");
|
||||||
expect(specEl.getAttribute("id")).toEqual("spec_789");
|
expect(specEl.getAttribute("id")).toEqual("spec_789");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -147,9 +147,9 @@ describe("New HtmlReporter", function() {
|
|||||||
|
|
||||||
reporter.specDone({id: 123, status: "passed", passedExpectations: [{passed: true}], failedExpectations: []});
|
reporter.specDone({id: 123, status: "passed", passedExpectations: [{passed: true}], failedExpectations: []});
|
||||||
|
|
||||||
var statuses = container.querySelector(".symbol-summary");
|
var statuses = container.querySelector(".jasmine-symbol-summary");
|
||||||
var specEl = statuses.querySelector("li");
|
var specEl = statuses.querySelector("li");
|
||||||
expect(specEl.getAttribute("class")).toEqual("passed");
|
expect(specEl.getAttribute("class")).toEqual("jasmine-passed");
|
||||||
expect(specEl.getAttribute("id")).toEqual("spec_123");
|
expect(specEl.getAttribute("id")).toEqual("spec_123");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -173,8 +173,8 @@ describe("New HtmlReporter", function() {
|
|||||||
passedExpectations: []
|
passedExpectations: []
|
||||||
});
|
});
|
||||||
|
|
||||||
var specEl = container.querySelector(".symbol-summary li");
|
var specEl = container.querySelector(".jasmine-symbol-summary li");
|
||||||
expect(specEl.getAttribute("class")).toEqual("failed");
|
expect(specEl.getAttribute("class")).toEqual("jasmine-failed");
|
||||||
expect(specEl.getAttribute("id")).toEqual("spec_345");
|
expect(specEl.getAttribute("id")).toEqual("spec_345");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -198,11 +198,11 @@ describe("New HtmlReporter", function() {
|
|||||||
reporter.suiteDone({ status: 'failed', failedExpectations: [{ message: 'My Other Exception' }] });
|
reporter.suiteDone({ status: 'failed', failedExpectations: [{ message: 'My Other Exception' }] });
|
||||||
reporter.jasmineDone({});
|
reporter.jasmineDone({});
|
||||||
|
|
||||||
var alertBars = container.querySelectorAll(".alert .bar");
|
var alertBars = container.querySelectorAll(".jasmine-alert .jasmine-bar");
|
||||||
|
|
||||||
expect(alertBars.length).toEqual(3);
|
expect(alertBars.length).toEqual(3);
|
||||||
expect(alertBars[1].innerHTML).toMatch(/My After All Exception/);
|
expect(alertBars[1].innerHTML).toMatch(/My After All Exception/);
|
||||||
expect(alertBars[1].getAttribute("class")).toEqual('bar errored');
|
expect(alertBars[1].getAttribute("class")).toEqual('jasmine-bar jasmine-errored');
|
||||||
expect(alertBars[2].innerHTML).toMatch(/My Other Exception/);
|
expect(alertBars[2].innerHTML).toMatch(/My Other Exception/);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -238,7 +238,7 @@ describe("New HtmlReporter", function() {
|
|||||||
reporter.suiteDone({id: 1});
|
reporter.suiteDone({id: 1});
|
||||||
reporter.jasmineDone({});
|
reporter.jasmineDone({});
|
||||||
|
|
||||||
var summary = container.querySelector('.summary');
|
var summary = container.querySelector('.jasmine-summary');
|
||||||
var suite = summary.childNodes[0];
|
var suite = summary.childNodes[0];
|
||||||
var specs = suite.childNodes[1];
|
var specs = suite.childNodes[1];
|
||||||
var spec = specs.childNodes[0];
|
var spec = specs.childNodes[0];
|
||||||
@@ -266,7 +266,7 @@ describe("New HtmlReporter", function() {
|
|||||||
timer.elapsed.and.returnValue(100);
|
timer.elapsed.and.returnValue(100);
|
||||||
reporter.jasmineDone();
|
reporter.jasmineDone();
|
||||||
|
|
||||||
var duration = container.querySelector(".alert .duration");
|
var duration = container.querySelector(".jasmine-alert .jasmine-duration");
|
||||||
expect(duration.innerHTML).toMatch(/finished in 0.1s/);
|
expect(duration.innerHTML).toMatch(/finished in 0.1s/);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -334,7 +334,7 @@ describe("New HtmlReporter", function() {
|
|||||||
reporter.suiteDone({id: 1});
|
reporter.suiteDone({id: 1});
|
||||||
|
|
||||||
reporter.jasmineDone({});
|
reporter.jasmineDone({});
|
||||||
var summary = container.querySelector(".summary");
|
var summary = container.querySelector(".jasmine-summary");
|
||||||
|
|
||||||
expect(summary.childNodes.length).toEqual(1);
|
expect(summary.childNodes.length).toEqual(1);
|
||||||
|
|
||||||
@@ -346,7 +346,7 @@ describe("New HtmlReporter", function() {
|
|||||||
var node = outerSuite.childNodes[i];
|
var node = outerSuite.childNodes[i];
|
||||||
classes.push(node.getAttribute("class"));
|
classes.push(node.getAttribute("class"));
|
||||||
}
|
}
|
||||||
expect(classes).toEqual(["suite-detail", "specs", "suite", "specs"]);
|
expect(classes).toEqual(["jasmine-suite-detail", "jasmine-specs", "jasmine-suite", "jasmine-specs"]);
|
||||||
|
|
||||||
var suiteDetail = outerSuite.childNodes[0];
|
var suiteDetail = outerSuite.childNodes[0];
|
||||||
var suiteLink = suiteDetail.childNodes[0];
|
var suiteLink = suiteDetail.childNodes[0];
|
||||||
@@ -355,7 +355,7 @@ describe("New HtmlReporter", function() {
|
|||||||
|
|
||||||
var specs = outerSuite.childNodes[1];
|
var specs = outerSuite.childNodes[1];
|
||||||
var spec = specs.childNodes[0];
|
var spec = specs.childNodes[0];
|
||||||
expect(spec.getAttribute("class")).toEqual("passed");
|
expect(spec.getAttribute("class")).toEqual("jasmine-passed");
|
||||||
expect(spec.getAttribute("id")).toEqual("spec-123");
|
expect(spec.getAttribute("id")).toEqual("spec-123");
|
||||||
|
|
||||||
var specLink = spec.childNodes[0];
|
var specLink = spec.childNodes[0];
|
||||||
@@ -384,18 +384,18 @@ describe("New HtmlReporter", function() {
|
|||||||
reporter.initialize();
|
reporter.initialize();
|
||||||
reporter.jasmineDone({});
|
reporter.jasmineDone({});
|
||||||
|
|
||||||
var trigger = container.querySelector('.run-options .trigger'),
|
var trigger = container.querySelector('.jasmine-run-options .jasmine-trigger'),
|
||||||
payload = container.querySelector('.run-options .payload');
|
payload = container.querySelector('.jasmine-run-options .jasmine-payload');
|
||||||
|
|
||||||
expect(payload.className).not.toContain('open');
|
expect(payload.className).not.toContain('jasmine-open');
|
||||||
|
|
||||||
trigger.onclick();
|
trigger.onclick();
|
||||||
|
|
||||||
expect(payload.className).toContain('open');
|
expect(payload.className).toContain('jasmine-open');
|
||||||
|
|
||||||
trigger.onclick();
|
trigger.onclick();
|
||||||
|
|
||||||
expect(payload.className).not.toContain('open');
|
expect(payload.className).not.toContain('jasmine-open');
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("UI for raising/catching exceptions", function() {
|
describe("UI for raising/catching exceptions", function() {
|
||||||
@@ -419,7 +419,7 @@ describe("New HtmlReporter", function() {
|
|||||||
reporter.initialize();
|
reporter.initialize();
|
||||||
reporter.jasmineDone({});
|
reporter.jasmineDone({});
|
||||||
|
|
||||||
var raisingExceptionsUI = container.querySelector(".raise");
|
var raisingExceptionsUI = container.querySelector(".jasmine-raise");
|
||||||
expect(raisingExceptionsUI.checked).toBe(false);
|
expect(raisingExceptionsUI.checked).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -444,7 +444,7 @@ describe("New HtmlReporter", function() {
|
|||||||
env.catchExceptions(false);
|
env.catchExceptions(false);
|
||||||
reporter.jasmineDone({});
|
reporter.jasmineDone({});
|
||||||
|
|
||||||
var raisingExceptionsUI = container.querySelector(".raise");
|
var raisingExceptionsUI = container.querySelector(".jasmine-raise");
|
||||||
expect(raisingExceptionsUI.checked).toBe(true);
|
expect(raisingExceptionsUI.checked).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -470,7 +470,7 @@ describe("New HtmlReporter", function() {
|
|||||||
reporter.initialize();
|
reporter.initialize();
|
||||||
reporter.jasmineDone({});
|
reporter.jasmineDone({});
|
||||||
|
|
||||||
var input = container.querySelector(".raise");
|
var input = container.querySelector(".jasmine-raise");
|
||||||
input.click();
|
input.click();
|
||||||
expect(exceptionsClickHandler).toHaveBeenCalled();
|
expect(exceptionsClickHandler).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
@@ -497,7 +497,7 @@ describe("New HtmlReporter", function() {
|
|||||||
reporter.initialize();
|
reporter.initialize();
|
||||||
reporter.jasmineDone({});
|
reporter.jasmineDone({});
|
||||||
|
|
||||||
var throwingExpectationsUI = container.querySelector(".throw");
|
var throwingExpectationsUI = container.querySelector(".jasmine-throw");
|
||||||
expect(throwingExpectationsUI.checked).toBe(false);
|
expect(throwingExpectationsUI.checked).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -523,7 +523,7 @@ describe("New HtmlReporter", function() {
|
|||||||
reporter.initialize();
|
reporter.initialize();
|
||||||
reporter.jasmineDone({});
|
reporter.jasmineDone({});
|
||||||
|
|
||||||
var throwingExpectationsUI = container.querySelector(".throw");
|
var throwingExpectationsUI = container.querySelector(".jasmine-throw");
|
||||||
expect(throwingExpectationsUI.checked).toBe(true);
|
expect(throwingExpectationsUI.checked).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -549,13 +549,149 @@ describe("New HtmlReporter", function() {
|
|||||||
reporter.initialize();
|
reporter.initialize();
|
||||||
reporter.jasmineDone({});
|
reporter.jasmineDone({});
|
||||||
|
|
||||||
var throwingExpectationsUI = container.querySelector(".throw");
|
var throwingExpectationsUI = container.querySelector(".jasmine-throw");
|
||||||
throwingExpectationsUI.click();
|
throwingExpectationsUI.click();
|
||||||
|
|
||||||
expect(throwingExceptionHandler).toHaveBeenCalled();
|
expect(throwingExceptionHandler).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("UI for running tests in random order", function() {
|
||||||
|
it("should be unchecked if not randomizing", function() {
|
||||||
|
var env = new j$.Env(),
|
||||||
|
container = document.createElement("div"),
|
||||||
|
getContainer = function() {
|
||||||
|
return container;
|
||||||
|
},
|
||||||
|
reporter = new j$.HtmlReporter({
|
||||||
|
env: env,
|
||||||
|
getContainer: getContainer,
|
||||||
|
createElement: function() {
|
||||||
|
return document.createElement.apply(document, arguments);
|
||||||
|
},
|
||||||
|
createTextNode: function() {
|
||||||
|
return document.createTextNode.apply(document, arguments);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
reporter.initialize();
|
||||||
|
reporter.jasmineDone({});
|
||||||
|
|
||||||
|
var randomUI = container.querySelector(".jasmine-random");
|
||||||
|
expect(randomUI.checked).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should be checked if randomizing", function() {
|
||||||
|
var env = new j$.Env(),
|
||||||
|
container = document.createElement("div"),
|
||||||
|
getContainer = function() {
|
||||||
|
return container;
|
||||||
|
},
|
||||||
|
reporter = new j$.HtmlReporter({
|
||||||
|
env: env,
|
||||||
|
getContainer: getContainer,
|
||||||
|
createElement: function() {
|
||||||
|
return document.createElement.apply(document, arguments);
|
||||||
|
},
|
||||||
|
createTextNode: function() {
|
||||||
|
return document.createTextNode.apply(document, arguments);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
env.randomizeTests(true);
|
||||||
|
reporter.initialize();
|
||||||
|
reporter.jasmineDone({});
|
||||||
|
|
||||||
|
var randomUI = container.querySelector(".jasmine-random");
|
||||||
|
expect(randomUI.checked).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should affect the query param for random tests", function() {
|
||||||
|
var env = new j$.Env(),
|
||||||
|
container = document.createElement("div"),
|
||||||
|
randomHandler = jasmine.createSpy('randomHandler'),
|
||||||
|
getContainer = function() {
|
||||||
|
return container;
|
||||||
|
},
|
||||||
|
reporter = new j$.HtmlReporter({
|
||||||
|
env: env,
|
||||||
|
getContainer: getContainer,
|
||||||
|
onRandomClick: randomHandler,
|
||||||
|
createElement: function() {
|
||||||
|
return document.createElement.apply(document, arguments);
|
||||||
|
},
|
||||||
|
createTextNode: function() {
|
||||||
|
return document.createTextNode.apply(document, arguments);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
reporter.initialize();
|
||||||
|
reporter.jasmineDone({});
|
||||||
|
|
||||||
|
var randomUI = container.querySelector(".jasmine-random");
|
||||||
|
randomUI.click();
|
||||||
|
|
||||||
|
expect(randomHandler).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should show the seed bar if randomizing", function() {
|
||||||
|
var env = new j$.Env(),
|
||||||
|
container = document.createElement("div"),
|
||||||
|
getContainer = function() {
|
||||||
|
return container;
|
||||||
|
},
|
||||||
|
reporter = new j$.HtmlReporter({
|
||||||
|
env: env,
|
||||||
|
getContainer: getContainer,
|
||||||
|
createElement: function() {
|
||||||
|
return document.createElement.apply(document, arguments);
|
||||||
|
},
|
||||||
|
createTextNode: function() {
|
||||||
|
return document.createTextNode.apply(document, arguments);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
reporter.initialize();
|
||||||
|
reporter.jasmineDone({
|
||||||
|
order: {
|
||||||
|
random: true,
|
||||||
|
seed: '424242'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var seedBar = container.querySelector(".jasmine-seed-bar");
|
||||||
|
var seedBarText = 'textContent' in seedBar ? seedBar.textContent : seedBar.innerText;
|
||||||
|
expect(seedBarText).toBe(', randomized with seed 424242');
|
||||||
|
var seedLink = container.querySelector(".jasmine-seed-bar a");
|
||||||
|
expect(seedLink.getAttribute('href')).toBe('?seed=424242');
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should not show the current seed bar if not randomizing", function() {
|
||||||
|
var env = new j$.Env(),
|
||||||
|
container = document.createElement("div"),
|
||||||
|
getContainer = function() {
|
||||||
|
return container;
|
||||||
|
},
|
||||||
|
reporter = new j$.HtmlReporter({
|
||||||
|
env: env,
|
||||||
|
getContainer: getContainer,
|
||||||
|
createElement: function() {
|
||||||
|
return document.createElement.apply(document, arguments);
|
||||||
|
},
|
||||||
|
createTextNode: function() {
|
||||||
|
return document.createTextNode.apply(document, arguments);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
reporter.initialize();
|
||||||
|
reporter.jasmineDone();
|
||||||
|
|
||||||
|
var seedBar = container.querySelector(".jasmine-seed-bar");
|
||||||
|
expect(seedBar).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
it("shows a message if no specs are run", function(){
|
it("shows a message if no specs are run", function(){
|
||||||
var env, container, reporter;
|
var env, container, reporter;
|
||||||
env = new j$.Env();
|
env = new j$.Env();
|
||||||
@@ -572,8 +708,8 @@ describe("New HtmlReporter", function() {
|
|||||||
reporter.jasmineStarted({});
|
reporter.jasmineStarted({});
|
||||||
reporter.jasmineDone({});
|
reporter.jasmineDone({});
|
||||||
|
|
||||||
var alertBars = container.querySelectorAll(".alert .bar");
|
var alertBars = container.querySelectorAll(".jasmine-alert .jasmine-bar");
|
||||||
expect(alertBars[0].getAttribute('class')).toMatch(/skipped/);
|
expect(alertBars[0].getAttribute('class')).toMatch(/jasmine-skipped/);
|
||||||
expect(alertBars[0].innerHTML).toMatch(/No specs found/);
|
expect(alertBars[0].innerHTML).toMatch(/No specs found/);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -612,21 +748,21 @@ describe("New HtmlReporter", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("reports the specs counts", function() {
|
it("reports the specs counts", function() {
|
||||||
var alertBars = container.querySelectorAll(".alert .bar");
|
var alertBars = container.querySelectorAll(".jasmine-alert .jasmine-bar");
|
||||||
|
|
||||||
expect(alertBars.length).toEqual(1);
|
expect(alertBars.length).toEqual(1);
|
||||||
expect(alertBars[0].getAttribute('class')).toMatch(/passed/);
|
expect(alertBars[0].getAttribute('class')).toMatch(/jasmine-passed/);
|
||||||
expect(alertBars[0].innerHTML).toMatch(/2 specs, 0 failures/);
|
expect(alertBars[0].innerHTML).toMatch(/2 specs, 0 failures/);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("reports no failure details", function() {
|
it("reports no failure details", function() {
|
||||||
var specFailure = container.querySelector(".failures");
|
var specFailure = container.querySelector(".jasmine-failures");
|
||||||
|
|
||||||
expect(specFailure.childNodes.length).toEqual(0);
|
expect(specFailure.childNodes.length).toEqual(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("reports no pending specs", function() {
|
it("reports no pending specs", function() {
|
||||||
var alertBar = container.querySelector(".alert .bar");
|
var alertBar = container.querySelector(".jasmine-alert .jasmine-bar");
|
||||||
|
|
||||||
expect(alertBar.innerHTML).not.toMatch(/pending spec[s]/);
|
expect(alertBar.innerHTML).not.toMatch(/pending spec[s]/);
|
||||||
});
|
});
|
||||||
@@ -662,19 +798,19 @@ describe("New HtmlReporter", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("reports the pending specs count", function() {
|
it("reports the pending specs count", function() {
|
||||||
var alertBar = container.querySelector(".alert .bar");
|
var alertBar = container.querySelector(".jasmine-alert .jasmine-bar");
|
||||||
|
|
||||||
expect(alertBar.innerHTML).toMatch(/1 spec, 0 failures, 1 pending spec/);
|
expect(alertBar.innerHTML).toMatch(/1 spec, 0 failures, 1 pending spec/);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("reports no failure details", function() {
|
it("reports no failure details", function() {
|
||||||
var specFailure = container.querySelector(".failures");
|
var specFailure = container.querySelector(".jasmine-failures");
|
||||||
|
|
||||||
expect(specFailure.childNodes.length).toEqual(0);
|
expect(specFailure.childNodes.length).toEqual(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("displays the custom pending reason", function() {
|
it("displays the custom pending reason", function() {
|
||||||
var pendingDetails = container.querySelector(".summary .pending");
|
var pendingDetails = container.querySelector(".jasmine-summary .jasmine-pending");
|
||||||
|
|
||||||
expect(pendingDetails.innerHTML).toContain("my custom pending reason");
|
expect(pendingDetails.innerHTML).toContain("my custom pending reason");
|
||||||
});
|
});
|
||||||
@@ -721,37 +857,37 @@ describe("New HtmlReporter", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("reports the specs counts", function() {
|
it("reports the specs counts", function() {
|
||||||
var alertBar = container.querySelector(".alert .bar");
|
var alertBar = container.querySelector(".jasmine-alert .jasmine-bar");
|
||||||
|
|
||||||
expect(alertBar.getAttribute('class')).toMatch(/failed/);
|
expect(alertBar.getAttribute('class')).toMatch(/jasmine-failed/);
|
||||||
expect(alertBar.innerHTML).toMatch(/2 specs, 1 failure/);
|
expect(alertBar.innerHTML).toMatch(/2 specs, 1 failure/);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("reports failure messages and stack traces", function() {
|
it("reports failure messages and stack traces", function() {
|
||||||
var specFailures = container.querySelector(".failures");
|
var specFailures = container.querySelector(".jasmine-failures");
|
||||||
|
|
||||||
var failure = specFailures.childNodes[0];
|
var failure = specFailures.childNodes[0];
|
||||||
expect(failure.getAttribute("class")).toMatch(/failed/);
|
expect(failure.getAttribute("class")).toMatch(/jasmine-failed/);
|
||||||
expect(failure.getAttribute("class")).toMatch(/spec-detail/);
|
expect(failure.getAttribute("class")).toMatch(/jasmine-spec-detail/);
|
||||||
|
|
||||||
var specDiv = failure.childNodes[0];
|
var specDiv = failure.childNodes[0];
|
||||||
expect(specDiv.getAttribute("class")).toEqual("description");
|
expect(specDiv.getAttribute("class")).toEqual("jasmine-description");
|
||||||
|
|
||||||
var specLink = specDiv.childNodes[0];
|
var specLink = specDiv.childNodes[0];
|
||||||
expect(specLink.getAttribute("title")).toEqual("a suite with a failing spec");
|
expect(specLink.getAttribute("title")).toEqual("a suite with a failing spec");
|
||||||
expect(specLink.getAttribute("href")).toEqual("?foo=bar&spec=a suite with a failing spec");
|
expect(specLink.getAttribute("href")).toEqual("?foo=bar&spec=a suite with a failing spec");
|
||||||
|
|
||||||
var message = failure.childNodes[1].childNodes[0];
|
var message = failure.childNodes[1].childNodes[0];
|
||||||
expect(message.getAttribute("class")).toEqual("result-message");
|
expect(message.getAttribute("class")).toEqual("jasmine-result-message");
|
||||||
expect(message.innerHTML).toEqual("a failure message");
|
expect(message.innerHTML).toEqual("a failure message");
|
||||||
|
|
||||||
var stackTrace = failure.childNodes[1].childNodes[1];
|
var stackTrace = failure.childNodes[1].childNodes[1];
|
||||||
expect(stackTrace.getAttribute("class")).toEqual("stack-trace");
|
expect(stackTrace.getAttribute("class")).toEqual("jasmine-stack-trace");
|
||||||
expect(stackTrace.innerHTML).toEqual("a stack trace");
|
expect(stackTrace.innerHTML).toEqual("a stack trace");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("allows switching between failure details and the spec summary", function() {
|
it("allows switching between failure details and the spec summary", function() {
|
||||||
var menuBar = container.querySelectorAll(".bar")[1];
|
var menuBar = container.querySelectorAll(".jasmine-bar")[1];
|
||||||
|
|
||||||
expect(menuBar.getAttribute("class")).not.toMatch(/hidden/);
|
expect(menuBar.getAttribute("class")).not.toMatch(/hidden/);
|
||||||
|
|
||||||
@@ -762,7 +898,7 @@ describe("New HtmlReporter", function() {
|
|||||||
|
|
||||||
it("sets the reporter to 'Failures List' mode", function() {
|
it("sets the reporter to 'Failures List' mode", function() {
|
||||||
var reporterNode = container.querySelector(".jasmine_html-reporter");
|
var reporterNode = container.querySelector(".jasmine_html-reporter");
|
||||||
expect(reporterNode.getAttribute("class")).toMatch("failure-list");
|
expect(reporterNode.getAttribute("class")).toMatch("jasmine-failure-list");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,5 +5,6 @@
|
|||||||
],
|
],
|
||||||
"helper_files": [
|
"helper_files": [
|
||||||
"helpers/nodeDefineJasmineUnderTest.js"
|
"helpers/nodeDefineJasmineUnderTest.js"
|
||||||
]
|
],
|
||||||
|
"random": true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,3 +7,4 @@ helpers:
|
|||||||
spec_files:
|
spec_files:
|
||||||
- 'performance/performance_test.js'
|
- 'performance/performance_test.js'
|
||||||
spec_dir: spec
|
spec_dir: spec
|
||||||
|
random: true
|
||||||
|
|||||||
@@ -7,5 +7,6 @@
|
|||||||
],
|
],
|
||||||
"helpers": [
|
"helpers": [
|
||||||
"helpers/nodeDefineJasmineUnderTest.js"
|
"helpers/nodeDefineJasmineUnderTest.js"
|
||||||
]
|
],
|
||||||
|
"random": true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,5 +22,5 @@ spec_files:
|
|||||||
- '**/*[Ss]pec.js'
|
- '**/*[Ss]pec.js'
|
||||||
- '!npmPackage/**/*'
|
- '!npmPackage/**/*'
|
||||||
spec_dir: spec
|
spec_dir: spec
|
||||||
|
random: true
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
var currentlyExecutingSuites = [];
|
var currentlyExecutingSuites = [];
|
||||||
var currentDeclarationSuite = null;
|
var currentDeclarationSuite = null;
|
||||||
var throwOnExpectationFailure = false;
|
var throwOnExpectationFailure = false;
|
||||||
|
var random = false;
|
||||||
|
var seed = null;
|
||||||
|
|
||||||
var currentSuite = function() {
|
var currentSuite = function() {
|
||||||
return currentlyExecutingSuites[currentlyExecutingSuites.length - 1];
|
return currentlyExecutingSuites[currentlyExecutingSuites.length - 1];
|
||||||
@@ -169,6 +171,21 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
return throwOnExpectationFailure;
|
return throwOnExpectationFailure;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.randomizeTests = function(value) {
|
||||||
|
random = !!value;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.randomTests = function() {
|
||||||
|
return random;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.seed = function(value) {
|
||||||
|
if (value) {
|
||||||
|
seed = value;
|
||||||
|
}
|
||||||
|
return seed;
|
||||||
|
};
|
||||||
|
|
||||||
var queueRunnerFactory = function(options) {
|
var queueRunnerFactory = function(options) {
|
||||||
options.catchException = catchException;
|
options.catchException = catchException;
|
||||||
options.clearStack = options.clearStack || clearStack;
|
options.clearStack = options.clearStack || clearStack;
|
||||||
@@ -200,6 +217,12 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
runnablesToRun = [topSuite.id];
|
runnablesToRun = [topSuite.id];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var order = new j$.Order({
|
||||||
|
random: random,
|
||||||
|
seed: seed
|
||||||
|
});
|
||||||
|
|
||||||
var processor = new j$.TreeProcessor({
|
var processor = new j$.TreeProcessor({
|
||||||
tree: topSuite,
|
tree: topSuite,
|
||||||
runnableIds: runnablesToRun,
|
runnableIds: runnablesToRun,
|
||||||
@@ -215,6 +238,9 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
}
|
}
|
||||||
currentlyExecutingSuites.pop();
|
currentlyExecutingSuites.pop();
|
||||||
reporter.suiteDone(result);
|
reporter.suiteDone(result);
|
||||||
|
},
|
||||||
|
orderChildren: function(node) {
|
||||||
|
return order.sort(node.children);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -226,7 +252,11 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
totalSpecsDefined: totalSpecsDefined
|
totalSpecsDefined: totalSpecsDefined
|
||||||
});
|
});
|
||||||
|
|
||||||
processor.execute(reporter.jasmineDone);
|
processor.execute(function() {
|
||||||
|
reporter.jasmineDone({
|
||||||
|
order: order
|
||||||
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.addReporter = function(reporterToAdd) {
|
this.addReporter = function(reporterToAdd) {
|
||||||
@@ -261,13 +291,20 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
|
|
||||||
this.describe = function(description, specDefinitions) {
|
this.describe = function(description, specDefinitions) {
|
||||||
var suite = suiteFactory(description);
|
var suite = suiteFactory(description);
|
||||||
|
if (specDefinitions.length > 0) {
|
||||||
|
throw new Error('describe does not expect a done parameter');
|
||||||
|
}
|
||||||
|
if (currentDeclarationSuite.markedPending) {
|
||||||
|
suite.pend();
|
||||||
|
}
|
||||||
addSpecsToSuite(suite, specDefinitions);
|
addSpecsToSuite(suite, specDefinitions);
|
||||||
return suite;
|
return suite;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.xdescribe = function(description, specDefinitions) {
|
this.xdescribe = function(description, specDefinitions) {
|
||||||
var suite = this.describe(description, specDefinitions);
|
var suite = suiteFactory(description);
|
||||||
suite.disable();
|
suite.pend();
|
||||||
|
addSpecsToSuite(suite, specDefinitions);
|
||||||
return suite;
|
return suite;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -373,19 +410,22 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
|
|
||||||
this.it = function(description, fn, timeout) {
|
this.it = function(description, fn, timeout) {
|
||||||
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
|
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
|
||||||
|
if (currentDeclarationSuite.markedPending) {
|
||||||
|
spec.pend();
|
||||||
|
}
|
||||||
currentDeclarationSuite.addChild(spec);
|
currentDeclarationSuite.addChild(spec);
|
||||||
return spec;
|
return spec;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.xit = function() {
|
this.xit = function() {
|
||||||
var spec = this.it.apply(this, arguments);
|
var spec = this.it.apply(this, arguments);
|
||||||
spec.pend();
|
spec.pend('Temporarily disabled with xit');
|
||||||
return spec;
|
return spec;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.fit = function(){
|
this.fit = function(description, fn, timeout){
|
||||||
var spec = this.it.apply(this, arguments);
|
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
|
||||||
|
currentDeclarationSuite.addChild(spec);
|
||||||
focusedRunnables.push(spec.id);
|
focusedRunnables.push(spec.id);
|
||||||
unfocusAncestor();
|
unfocusAncestor();
|
||||||
return spec;
|
return spec;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ getJasmineRequireObj().JsApiReporter = function() {
|
|||||||
|
|
||||||
this.started = false;
|
this.started = false;
|
||||||
this.finished = false;
|
this.finished = false;
|
||||||
|
this.runDetails = {};
|
||||||
|
|
||||||
this.jasmineStarted = function() {
|
this.jasmineStarted = function() {
|
||||||
this.started = true;
|
this.started = true;
|
||||||
@@ -20,8 +21,9 @@ getJasmineRequireObj().JsApiReporter = function() {
|
|||||||
|
|
||||||
var executionTime;
|
var executionTime;
|
||||||
|
|
||||||
this.jasmineDone = function() {
|
this.jasmineDone = function(runDetails) {
|
||||||
this.finished = true;
|
this.finished = true;
|
||||||
|
this.runDetails = runDetails;
|
||||||
executionTime = timer.elapsed();
|
executionTime = timer.elapsed();
|
||||||
status = 'done';
|
status = 'done';
|
||||||
};
|
};
|
||||||
|
|||||||
46
src/core/Order.js
Normal file
46
src/core/Order.js
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/*jshint bitwise: false*/
|
||||||
|
|
||||||
|
getJasmineRequireObj().Order = function() {
|
||||||
|
function Order(options) {
|
||||||
|
this.random = 'random' in options ? options.random : true;
|
||||||
|
var seed = this.seed = options.seed || generateSeed();
|
||||||
|
this.sort = this.random ? randomOrder : naturalOrder;
|
||||||
|
|
||||||
|
function naturalOrder(items) {
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
|
function randomOrder(items) {
|
||||||
|
var copy = items.slice();
|
||||||
|
copy.sort(function(a, b) {
|
||||||
|
return jenkinsHash(seed + a.id) - jenkinsHash(seed + b.id);
|
||||||
|
});
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
function generateSeed() {
|
||||||
|
return String(Math.random()).slice(-5);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bob Jenkins One-at-a-Time Hash algorithm is a non-cryptographic hash function
|
||||||
|
// used to get a different output when the key changes slighly.
|
||||||
|
// We use your return to sort the children randomly in a consistent way when
|
||||||
|
// used in conjunction with a seed
|
||||||
|
|
||||||
|
function jenkinsHash(key) {
|
||||||
|
var hash, i;
|
||||||
|
for(hash = i = 0; i < key.length; ++i) {
|
||||||
|
hash += key.charCodeAt(i);
|
||||||
|
hash += (hash << 10);
|
||||||
|
hash ^= (hash >> 6);
|
||||||
|
}
|
||||||
|
hash += (hash << 3);
|
||||||
|
hash ^= (hash >> 11);
|
||||||
|
hash += (hash << 15);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return Order;
|
||||||
|
};
|
||||||
@@ -30,6 +30,8 @@ getJasmineRequireObj().pp = function(j$) {
|
|||||||
this.emitScalar('HTMLNode');
|
this.emitScalar('HTMLNode');
|
||||||
} else if (value instanceof Date) {
|
} else if (value instanceof Date) {
|
||||||
this.emitScalar('Date(' + value + ')');
|
this.emitScalar('Date(' + value + ')');
|
||||||
|
} else if (value.toString && typeof value === 'object' && !(value instanceof Array) && value.toString !== Object.prototype.toString) {
|
||||||
|
this.emitScalar(value.toString());
|
||||||
} else if (j$.util.arrayContains(this.seen, value)) {
|
} else if (j$.util.arrayContains(this.seen, value)) {
|
||||||
this.emitScalar('<circular reference: ' + (j$.isArray_(value) ? 'Array' : 'Object') + '>');
|
this.emitScalar('<circular reference: ' + (j$.isArray_(value) ? 'Array' : 'Object') + '>');
|
||||||
} else if (j$.isArray_(value) || j$.isA_('Object', value)) {
|
} else if (j$.isArray_(value) || j$.isA_('Object', value)) {
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
|||||||
if (queueableFn.timeout) {
|
if (queueableFn.timeout) {
|
||||||
timeoutId = Function.prototype.apply.apply(self.timeout.setTimeout, [j$.getGlobal(), [function() {
|
timeoutId = Function.prototype.apply.apply(self.timeout.setTimeout, [j$.getGlobal(), [function() {
|
||||||
var error = new Error('Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.');
|
var error = new Error('Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.');
|
||||||
onException(error, queueableFn);
|
onException(error);
|
||||||
next();
|
next();
|
||||||
}, queueableFn.timeout()]]);
|
}, queueableFn.timeout()]]);
|
||||||
}
|
}
|
||||||
@@ -86,12 +86,12 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onException(e, queueableFn) {
|
function onException(e) {
|
||||||
self.onException(e);
|
self.onException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleException(e, queueableFn) {
|
function handleException(e, queueableFn) {
|
||||||
onException(e, queueableFn);
|
onException(e);
|
||||||
if (!self.catchException(e)) {
|
if (!self.catchException(e)) {
|
||||||
//TODO: set a var when we catch an exception and
|
//TODO: set a var when we catch an exception and
|
||||||
//use a finally block to close the loop in a nice way..
|
//use a finally block to close the loop in a nice way..
|
||||||
|
|||||||
@@ -22,6 +22,17 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
|
|||||||
throw new Error(methodName + ' has already been spied upon');
|
throw new Error(methodName + ' has already been spied upon');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var descriptor;
|
||||||
|
try {
|
||||||
|
descriptor = Object.getOwnPropertyDescriptor(obj, methodName);
|
||||||
|
} catch(e) {
|
||||||
|
// IE 8 doesn't support `definePropery` on non-DOM nodes
|
||||||
|
}
|
||||||
|
|
||||||
|
if (descriptor && !(descriptor.writable || descriptor.set)) {
|
||||||
|
throw new Error(methodName + ' is not declared writable or has no setter');
|
||||||
|
}
|
||||||
|
|
||||||
var spy = j$.createSpy(methodName, obj[methodName]);
|
var spy = j$.createSpy(methodName, obj[methodName]);
|
||||||
|
|
||||||
currentSpies().push({
|
currentSpies().push({
|
||||||
|
|||||||
@@ -42,6 +42,10 @@ getJasmineRequireObj().Suite = function(j$) {
|
|||||||
this.disabled = true;
|
this.disabled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Suite.prototype.pend = function(message) {
|
||||||
|
this.markedPending = true;
|
||||||
|
};
|
||||||
|
|
||||||
Suite.prototype.beforeEach = function(fn) {
|
Suite.prototype.beforeEach = function(fn) {
|
||||||
this.beforeFns.unshift(fn);
|
this.beforeFns.unshift(fn);
|
||||||
};
|
};
|
||||||
@@ -67,6 +71,10 @@ getJasmineRequireObj().Suite = function(j$) {
|
|||||||
return 'disabled';
|
return 'disabled';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.markedPending) {
|
||||||
|
return 'pending';
|
||||||
|
}
|
||||||
|
|
||||||
if (this.result.failedExpectations.length > 0) {
|
if (this.result.failedExpectations.length > 0) {
|
||||||
return 'failed';
|
return 'failed';
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ getJasmineRequireObj().TreeProcessor = function() {
|
|||||||
queueRunnerFactory = attrs.queueRunnerFactory,
|
queueRunnerFactory = attrs.queueRunnerFactory,
|
||||||
nodeStart = attrs.nodeStart || function() {},
|
nodeStart = attrs.nodeStart || function() {},
|
||||||
nodeComplete = attrs.nodeComplete || function() {},
|
nodeComplete = attrs.nodeComplete || function() {},
|
||||||
|
orderChildren = attrs.orderChildren || function(node) { return node.children; },
|
||||||
stats = { valid: true },
|
stats = { valid: true },
|
||||||
processed = false,
|
processed = false,
|
||||||
defaultMin = Infinity,
|
defaultMin = Infinity,
|
||||||
@@ -29,6 +30,7 @@ getJasmineRequireObj().TreeProcessor = function() {
|
|||||||
|
|
||||||
queueRunnerFactory({
|
queueRunnerFactory({
|
||||||
queueableFns: childFns,
|
queueableFns: childFns,
|
||||||
|
userContext: tree.sharedUserContext(),
|
||||||
onException: function() {
|
onException: function() {
|
||||||
tree.onException.apply(tree, arguments);
|
tree.onException.apply(tree, arguments);
|
||||||
},
|
},
|
||||||
@@ -67,8 +69,10 @@ getJasmineRequireObj().TreeProcessor = function() {
|
|||||||
} else {
|
} else {
|
||||||
var hasExecutableChild = false;
|
var hasExecutableChild = false;
|
||||||
|
|
||||||
for (var i = 0; i < node.children.length; i++) {
|
var orderedChildren = orderChildren(node);
|
||||||
var child = node.children[i];
|
|
||||||
|
for (var i = 0; i < orderedChildren.length; i++) {
|
||||||
|
var child = orderedChildren[i];
|
||||||
|
|
||||||
processNode(child, parentEnabled);
|
processNode(child, parentEnabled);
|
||||||
|
|
||||||
@@ -85,7 +89,7 @@ getJasmineRequireObj().TreeProcessor = function() {
|
|||||||
executable: hasExecutableChild
|
executable: hasExecutableChild
|
||||||
};
|
};
|
||||||
|
|
||||||
segmentChildren(node, stats[node.id], executableIndex);
|
segmentChildren(node, orderedChildren, stats[node.id], executableIndex);
|
||||||
|
|
||||||
if (!node.canBeReentered() && stats[node.id].segments.length > 1) {
|
if (!node.canBeReentered() && stats[node.id].segments.length > 1) {
|
||||||
stats = { valid: false };
|
stats = { valid: false };
|
||||||
@@ -101,11 +105,11 @@ getJasmineRequireObj().TreeProcessor = function() {
|
|||||||
return executableIndex === undefined ? defaultMax : executableIndex;
|
return executableIndex === undefined ? defaultMax : executableIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
function segmentChildren(node, nodeStats, executableIndex) {
|
function segmentChildren(node, orderedChildren, nodeStats, executableIndex) {
|
||||||
var currentSegment = { index: 0, owner: node, nodes: [], min: startingMin(executableIndex), max: startingMax(executableIndex) },
|
var currentSegment = { index: 0, owner: node, nodes: [], min: startingMin(executableIndex), max: startingMax(executableIndex) },
|
||||||
result = [currentSegment],
|
result = [currentSegment],
|
||||||
lastMax = defaultMax,
|
lastMax = defaultMax,
|
||||||
orderedChildSegments = orderChildSegments(node.children);
|
orderedChildSegments = orderChildSegments(orderedChildren);
|
||||||
|
|
||||||
function isSegmentBoundary(minIndex) {
|
function isSegmentBoundary(minIndex) {
|
||||||
return lastMax !== defaultMax && minIndex !== defaultMin && lastMax < minIndex - 1;
|
return lastMax !== defaultMax && minIndex !== defaultMin && lastMax < minIndex - 1;
|
||||||
@@ -131,30 +135,29 @@ getJasmineRequireObj().TreeProcessor = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function orderChildSegments(children) {
|
function orderChildSegments(children) {
|
||||||
var result = [];
|
var specifiedOrder = [],
|
||||||
|
unspecifiedOrder = [];
|
||||||
|
|
||||||
for (var i = 0; i < children.length; i++) {
|
for (var i = 0; i < children.length; i++) {
|
||||||
var child = children[i],
|
var child = children[i],
|
||||||
segments = stats[child.id].segments;
|
segments = stats[child.id].segments;
|
||||||
|
|
||||||
for (var j = 0; j < segments.length; j++) {
|
for (var j = 0; j < segments.length; j++) {
|
||||||
result.push(segments[j]);
|
var seg = segments[j];
|
||||||
|
|
||||||
|
if (seg.min === defaultMin) {
|
||||||
|
unspecifiedOrder.push(seg);
|
||||||
|
} else {
|
||||||
|
specifiedOrder.push(seg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result.sort(function(a, b) {
|
specifiedOrder.sort(function(a, b) {
|
||||||
if (a.min === null) {
|
|
||||||
return b.min === null ? 0 : 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (b.min === null) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return a.min - b.min;
|
return a.min - b.min;
|
||||||
});
|
});
|
||||||
|
|
||||||
return result;
|
return specifiedOrder.concat(unspecifiedOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
function executeNode(node, segmentNumber) {
|
function executeNode(node, segmentNumber) {
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
getJasmineRequireObj().Any = function(j$) {
|
getJasmineRequireObj().Any = function(j$) {
|
||||||
|
|
||||||
function Any(expectedObject) {
|
function Any(expectedObject) {
|
||||||
|
if (typeof expectedObject === 'undefined') {
|
||||||
|
throw new TypeError(
|
||||||
|
'jasmine.any() expects to be passed a constructor function. ' +
|
||||||
|
'Please pass one or use jasmine.anything() to match any object.'
|
||||||
|
);
|
||||||
|
}
|
||||||
this.expectedObject = expectedObject;
|
this.expectedObject = expectedObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ getJasmineRequireObj().requireMatchers = function(jRequire, j$) {
|
|||||||
'toEqual',
|
'toEqual',
|
||||||
'toHaveBeenCalled',
|
'toHaveBeenCalled',
|
||||||
'toHaveBeenCalledWith',
|
'toHaveBeenCalledWith',
|
||||||
|
'toHaveBeenCalledTimes',
|
||||||
'toMatch',
|
'toMatch',
|
||||||
'toThrow',
|
'toThrow',
|
||||||
'toThrowError'
|
'toThrowError'
|
||||||
|
|||||||
30
src/core/matchers/toHaveBeenCalledTimes..js
Normal file
30
src/core/matchers/toHaveBeenCalledTimes..js
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
getJasmineRequireObj().toHaveBeenCalledTimes = function(j$) {
|
||||||
|
|
||||||
|
function toHaveBeenCalledTimes() {
|
||||||
|
return {
|
||||||
|
compare: function(actual, expected) {
|
||||||
|
if (!j$.isSpy(actual)) {
|
||||||
|
throw new Error('Expected a spy, but got ' + j$.pp(actual) + '.');
|
||||||
|
}
|
||||||
|
|
||||||
|
var args = Array.prototype.slice.call(arguments, 0),
|
||||||
|
result = { pass: false };
|
||||||
|
|
||||||
|
if(!expected){
|
||||||
|
throw new Error('Expected times failed is required as an argument.');
|
||||||
|
}
|
||||||
|
|
||||||
|
actual = args[0];
|
||||||
|
var calls = actual.calls.count();
|
||||||
|
var timesMessage = expected === 1 ? 'once' : expected + ' times';
|
||||||
|
result.pass = calls === expected;
|
||||||
|
result.message = result.pass ?
|
||||||
|
'Expected spy ' + actual.and.identity() + ' not to have been called ' + timesMessage + '. It was called ' + calls + ' times.' :
|
||||||
|
'Expected spy ' + actual.and.identity() + ' to have been called ' + timesMessage + '. It was called ' + calls + ' times.';
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return toHaveBeenCalledTimes;
|
||||||
|
};
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
getJasmineRequireObj().toThrowError = function(j$) {
|
getJasmineRequireObj().toThrowError = function(j$) {
|
||||||
function toThrowError (util) {
|
function toThrowError () {
|
||||||
return {
|
return {
|
||||||
compare: function(actual) {
|
compare: function(actual) {
|
||||||
var threw = false,
|
var threw = false,
|
||||||
|
|||||||
@@ -2,7 +2,11 @@ var getJasmineRequireObj = (function (jasmineGlobal) {
|
|||||||
var jasmineRequire;
|
var jasmineRequire;
|
||||||
|
|
||||||
if (typeof module !== 'undefined' && module.exports) {
|
if (typeof module !== 'undefined' && module.exports) {
|
||||||
jasmineGlobal = global;
|
if (typeof global !== 'undefined') {
|
||||||
|
jasmineGlobal = global;
|
||||||
|
} else {
|
||||||
|
jasmineGlobal = {};
|
||||||
|
}
|
||||||
jasmineRequire = exports;
|
jasmineRequire = exports;
|
||||||
} else {
|
} else {
|
||||||
if (typeof window !== 'undefined' && typeof window.toString === 'function' && window.toString() === '[object GjsGlobal]') {
|
if (typeof window !== 'undefined' && typeof window.toString === 'function' && window.toString() === '[object GjsGlobal]') {
|
||||||
@@ -46,6 +50,7 @@ var getJasmineRequireObj = (function (jasmineGlobal) {
|
|||||||
j$.Timer = jRequire.Timer();
|
j$.Timer = jRequire.Timer();
|
||||||
j$.TreeProcessor = jRequire.TreeProcessor();
|
j$.TreeProcessor = jRequire.TreeProcessor();
|
||||||
j$.version = jRequire.version();
|
j$.version = jRequire.version();
|
||||||
|
j$.Order = jRequire.Order();
|
||||||
|
|
||||||
j$.matchers = jRequire.requireMatchers(jRequire, j$);
|
j$.matchers = jRequire.requireMatchers(jRequire, j$);
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
createTextNode = options.createTextNode,
|
createTextNode = options.createTextNode,
|
||||||
onRaiseExceptionsClick = options.onRaiseExceptionsClick || function() {},
|
onRaiseExceptionsClick = options.onRaiseExceptionsClick || function() {},
|
||||||
onThrowExpectationsClick = options.onThrowExpectationsClick || function() {},
|
onThrowExpectationsClick = options.onThrowExpectationsClick || function() {},
|
||||||
|
onRandomClick = options.onRandomClick || function() {},
|
||||||
addToExistingQueryString = options.addToExistingQueryString || defaultQueryString,
|
addToExistingQueryString = options.addToExistingQueryString || defaultQueryString,
|
||||||
timer = options.timer || noopTimer,
|
timer = options.timer || noopTimer,
|
||||||
results = [],
|
results = [],
|
||||||
@@ -25,19 +26,17 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
this.initialize = function() {
|
this.initialize = function() {
|
||||||
clearPrior();
|
clearPrior();
|
||||||
htmlReporterMain = createDom('div', {className: 'jasmine_html-reporter'},
|
htmlReporterMain = createDom('div', {className: 'jasmine_html-reporter'},
|
||||||
createDom('div', {className: 'banner'},
|
createDom('div', {className: 'jasmine-banner'},
|
||||||
createDom('a', {className: 'title', href: 'http://jasmine.github.io/', target: '_blank'}),
|
createDom('a', {className: 'jasmine-title', href: 'http://jasmine.github.io/', target: '_blank'}),
|
||||||
createDom('span', {className: 'version'}, j$.version)
|
createDom('span', {className: 'jasmine-version'}, j$.version)
|
||||||
),
|
),
|
||||||
createDom('ul', {className: 'symbol-summary'}),
|
createDom('ul', {className: 'jasmine-symbol-summary'}),
|
||||||
createDom('div', {className: 'alert'}),
|
createDom('div', {className: 'jasmine-alert'}),
|
||||||
createDom('div', {className: 'results'},
|
createDom('div', {className: 'jasmine-results'},
|
||||||
createDom('div', {className: 'failures'})
|
createDom('div', {className: 'jasmine-failures'})
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
getContainer().appendChild(htmlReporterMain);
|
getContainer().appendChild(htmlReporterMain);
|
||||||
|
|
||||||
symbols = find('.symbol-summary');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var totalSpecsDefined;
|
var totalSpecsDefined;
|
||||||
@@ -46,7 +45,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
timer.start();
|
timer.start();
|
||||||
};
|
};
|
||||||
|
|
||||||
var summary = createDom('div', {className: 'summary'});
|
var summary = createDom('div', {className: 'jasmine-summary'});
|
||||||
|
|
||||||
var topResults = new j$.ResultsNode({}, '', null),
|
var topResults = new j$.ResultsNode({}, '', null),
|
||||||
currentParent = topResults;
|
currentParent = topResults;
|
||||||
@@ -82,8 +81,12 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
specsExecuted++;
|
specsExecuted++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!symbols){
|
||||||
|
symbols = find('.jasmine-symbol-summary');
|
||||||
|
}
|
||||||
|
|
||||||
symbols.appendChild(createDom('li', {
|
symbols.appendChild(createDom('li', {
|
||||||
className: noExpectations(result) ? 'empty' : result.status,
|
className: noExpectations(result) ? 'jasmine-empty' : 'jasmine-' + result.status,
|
||||||
id: 'spec_' + result.id,
|
id: 'spec_' + result.id,
|
||||||
title: result.fullName
|
title: result.fullName
|
||||||
}
|
}
|
||||||
@@ -93,18 +96,18 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
failureCount++;
|
failureCount++;
|
||||||
|
|
||||||
var failure =
|
var failure =
|
||||||
createDom('div', {className: 'spec-detail failed'},
|
createDom('div', {className: 'jasmine-spec-detail jasmine-failed'},
|
||||||
createDom('div', {className: 'description'},
|
createDom('div', {className: 'jasmine-description'},
|
||||||
createDom('a', {title: result.fullName, href: specHref(result)}, result.fullName)
|
createDom('a', {title: result.fullName, href: specHref(result)}, result.fullName)
|
||||||
),
|
),
|
||||||
createDom('div', {className: 'messages'})
|
createDom('div', {className: 'jasmine-messages'})
|
||||||
);
|
);
|
||||||
var messages = failure.childNodes[1];
|
var messages = failure.childNodes[1];
|
||||||
|
|
||||||
for (var i = 0; i < result.failedExpectations.length; i++) {
|
for (var i = 0; i < result.failedExpectations.length; i++) {
|
||||||
var expectation = result.failedExpectations[i];
|
var expectation = result.failedExpectations[i];
|
||||||
messages.appendChild(createDom('div', {className: 'result-message'}, expectation.message));
|
messages.appendChild(createDom('div', {className: 'jasmine-result-message'}, expectation.message));
|
||||||
messages.appendChild(createDom('div', {className: 'stack-trace'}, expectation.stack));
|
messages.appendChild(createDom('div', {className: 'jasmine-stack-trace'}, expectation.stack));
|
||||||
}
|
}
|
||||||
|
|
||||||
failures.push(failure);
|
failures.push(failure);
|
||||||
@@ -115,86 +118,106 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.jasmineDone = function() {
|
this.jasmineDone = function(doneResult) {
|
||||||
var banner = find('.banner');
|
var banner = find('.jasmine-banner');
|
||||||
var alert = find('.alert');
|
var alert = find('.jasmine-alert');
|
||||||
alert.appendChild(createDom('span', {className: 'duration'}, 'finished in ' + timer.elapsed() / 1000 + 's'));
|
var order = doneResult && doneResult.order;
|
||||||
|
alert.appendChild(createDom('span', {className: 'jasmine-duration'}, 'finished in ' + timer.elapsed() / 1000 + 's'));
|
||||||
|
|
||||||
banner.appendChild(
|
banner.appendChild(
|
||||||
createDom('div', { className: 'run-options' },
|
createDom('div', { className: 'jasmine-run-options' },
|
||||||
createDom('span', { className: 'trigger' }, 'Options'),
|
createDom('span', { className: 'jasmine-trigger' }, 'Options'),
|
||||||
createDom('div', { className: 'payload' },
|
createDom('div', { className: 'jasmine-payload' },
|
||||||
createDom('div', { className: 'exceptions' },
|
createDom('div', { className: 'jasmine-exceptions' },
|
||||||
createDom('input', {
|
createDom('input', {
|
||||||
className: 'raise',
|
className: 'jasmine-raise',
|
||||||
id: 'raise-exceptions',
|
id: 'jasmine-raise-exceptions',
|
||||||
type: 'checkbox'
|
type: 'checkbox'
|
||||||
}),
|
}),
|
||||||
createDom('label', { className: 'label', 'for': 'raise-exceptions' }, 'raise exceptions')),
|
createDom('label', { className: 'jasmine-label', 'for': 'jasmine-raise-exceptions' }, 'raise exceptions')),
|
||||||
createDom('div', { className: 'throw-failures' },
|
createDom('div', { className: 'jasmine-throw-failures' },
|
||||||
createDom('input', {
|
createDom('input', {
|
||||||
className: 'throw',
|
className: 'jasmine-throw',
|
||||||
id: 'throw-failures',
|
id: 'jasmine-throw-failures',
|
||||||
type: 'checkbox'
|
type: 'checkbox'
|
||||||
}),
|
}),
|
||||||
createDom('label', { className: 'label', 'for': 'throw-failures' }, 'stop spec on expectation failure'))
|
createDom('label', { className: 'jasmine-label', 'for': 'jasmine-throw-failures' }, 'stop spec on expectation failure')),
|
||||||
|
createDom('div', { className: 'jasmine-random-order' },
|
||||||
|
createDom('input', {
|
||||||
|
className: 'jasmine-random',
|
||||||
|
id: 'jasmine-random-order',
|
||||||
|
type: 'checkbox'
|
||||||
|
}),
|
||||||
|
createDom('label', { className: 'jasmine-label', 'for': 'jasmine-random-order' }, 'run tests in random order'))
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
var raiseCheckbox = find('#raise-exceptions');
|
var raiseCheckbox = find('#jasmine-raise-exceptions');
|
||||||
|
|
||||||
raiseCheckbox.checked = !env.catchingExceptions();
|
raiseCheckbox.checked = !env.catchingExceptions();
|
||||||
raiseCheckbox.onclick = onRaiseExceptionsClick;
|
raiseCheckbox.onclick = onRaiseExceptionsClick;
|
||||||
|
|
||||||
var throwCheckbox = find('#throw-failures');
|
var throwCheckbox = find('#jasmine-throw-failures');
|
||||||
throwCheckbox.checked = env.throwingExpectationFailures();
|
throwCheckbox.checked = env.throwingExpectationFailures();
|
||||||
throwCheckbox.onclick = onThrowExpectationsClick;
|
throwCheckbox.onclick = onThrowExpectationsClick;
|
||||||
|
|
||||||
var optionsMenu = find('.run-options'),
|
var randomCheckbox = find('#jasmine-random-order');
|
||||||
optionsTrigger = optionsMenu.querySelector('.trigger'),
|
randomCheckbox.checked = env.randomTests();
|
||||||
optionsPayload = optionsMenu.querySelector('.payload'),
|
randomCheckbox.onclick = onRandomClick;
|
||||||
isOpen = /\bopen\b/;
|
|
||||||
|
var optionsMenu = find('.jasmine-run-options'),
|
||||||
|
optionsTrigger = optionsMenu.querySelector('.jasmine-trigger'),
|
||||||
|
optionsPayload = optionsMenu.querySelector('.jasmine-payload'),
|
||||||
|
isOpen = /\bjasmine-open\b/;
|
||||||
|
|
||||||
optionsTrigger.onclick = function() {
|
optionsTrigger.onclick = function() {
|
||||||
if (isOpen.test(optionsPayload.className)) {
|
if (isOpen.test(optionsPayload.className)) {
|
||||||
optionsPayload.className = optionsPayload.className.replace(isOpen, '');
|
optionsPayload.className = optionsPayload.className.replace(isOpen, '');
|
||||||
} else {
|
} else {
|
||||||
optionsPayload.className += ' open';
|
optionsPayload.className += ' jasmine-open';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (specsExecuted < totalSpecsDefined) {
|
if (specsExecuted < totalSpecsDefined) {
|
||||||
var skippedMessage = 'Ran ' + specsExecuted + ' of ' + totalSpecsDefined + ' specs - run all';
|
var skippedMessage = 'Ran ' + specsExecuted + ' of ' + totalSpecsDefined + ' specs - run all';
|
||||||
alert.appendChild(
|
alert.appendChild(
|
||||||
createDom('span', {className: 'bar skipped'},
|
createDom('span', {className: 'jasmine-bar jasmine-skipped'},
|
||||||
createDom('a', {href: '?', title: 'Run all specs'}, skippedMessage)
|
createDom('a', {href: '?', title: 'Run all specs'}, skippedMessage)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
var statusBarMessage = '';
|
var statusBarMessage = '';
|
||||||
var statusBarClassName = 'bar ';
|
var statusBarClassName = 'jasmine-bar ';
|
||||||
|
|
||||||
if (totalSpecsDefined > 0) {
|
if (totalSpecsDefined > 0) {
|
||||||
statusBarMessage += pluralize('spec', specsExecuted) + ', ' + pluralize('failure', failureCount);
|
statusBarMessage += pluralize('spec', specsExecuted) + ', ' + pluralize('failure', failureCount);
|
||||||
if (pendingSpecCount) { statusBarMessage += ', ' + pluralize('pending spec', pendingSpecCount); }
|
if (pendingSpecCount) { statusBarMessage += ', ' + pluralize('pending spec', pendingSpecCount); }
|
||||||
statusBarClassName += (failureCount > 0) ? 'failed' : 'passed';
|
statusBarClassName += (failureCount > 0) ? 'jasmine-failed' : 'jasmine-passed';
|
||||||
} else {
|
} else {
|
||||||
statusBarClassName += 'skipped';
|
statusBarClassName += 'jasmine-skipped';
|
||||||
statusBarMessage += 'No specs found';
|
statusBarMessage += 'No specs found';
|
||||||
}
|
}
|
||||||
|
|
||||||
alert.appendChild(createDom('span', {className: statusBarClassName}, statusBarMessage));
|
var seedBar;
|
||||||
|
if (order && order.random) {
|
||||||
|
seedBar = createDom('span', {className: 'jasmine-seed-bar'},
|
||||||
|
', randomized with seed ',
|
||||||
|
createDom('a', {title: 'randomized with seed ' + order.seed, href: seedHref(order.seed)}, order.seed)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
alert.appendChild(createDom('span', {className: statusBarClassName}, statusBarMessage, seedBar));
|
||||||
|
|
||||||
for(i = 0; i < failedSuites.length; i++) {
|
for(i = 0; i < failedSuites.length; i++) {
|
||||||
var failedSuite = failedSuites[i];
|
var failedSuite = failedSuites[i];
|
||||||
for(var j = 0; j < failedSuite.failedExpectations.length; j++) {
|
for(var j = 0; j < failedSuite.failedExpectations.length; j++) {
|
||||||
var errorBarMessage = 'AfterAll ' + failedSuite.failedExpectations[j].message;
|
var errorBarMessage = 'AfterAll ' + failedSuite.failedExpectations[j].message;
|
||||||
var errorBarClassName = 'bar errored';
|
var errorBarClassName = 'jasmine-bar jasmine-errored';
|
||||||
alert.appendChild(createDom('span', {className: errorBarClassName}, errorBarMessage));
|
alert.appendChild(createDom('span', {className: errorBarClassName}, errorBarMessage));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var results = find('.results');
|
var results = find('.jasmine-results');
|
||||||
results.appendChild(summary);
|
results.appendChild(summary);
|
||||||
|
|
||||||
summaryList(topResults, summary);
|
summaryList(topResults, summary);
|
||||||
@@ -204,8 +227,8 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
for (var i = 0; i < resultsTree.children.length; i++) {
|
for (var i = 0; i < resultsTree.children.length; i++) {
|
||||||
var resultNode = resultsTree.children[i];
|
var resultNode = resultsTree.children[i];
|
||||||
if (resultNode.type == 'suite') {
|
if (resultNode.type == 'suite') {
|
||||||
var suiteListNode = createDom('ul', {className: 'suite', id: 'suite-' + resultNode.result.id},
|
var suiteListNode = createDom('ul', {className: 'jasmine-suite', id: 'suite-' + resultNode.result.id},
|
||||||
createDom('li', {className: 'suite-detail'},
|
createDom('li', {className: 'jasmine-suite-detail'},
|
||||||
createDom('a', {href: specHref(resultNode.result)}, resultNode.result.description)
|
createDom('a', {href: specHref(resultNode.result)}, resultNode.result.description)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -214,8 +237,8 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
domParent.appendChild(suiteListNode);
|
domParent.appendChild(suiteListNode);
|
||||||
}
|
}
|
||||||
if (resultNode.type == 'spec') {
|
if (resultNode.type == 'spec') {
|
||||||
if (domParent.getAttribute('class') != 'specs') {
|
if (domParent.getAttribute('class') != 'jasmine-specs') {
|
||||||
specListNode = createDom('ul', {className: 'specs'});
|
specListNode = createDom('ul', {className: 'jasmine-specs'});
|
||||||
domParent.appendChild(specListNode);
|
domParent.appendChild(specListNode);
|
||||||
}
|
}
|
||||||
var specDescription = resultNode.result.description;
|
var specDescription = resultNode.result.description;
|
||||||
@@ -227,7 +250,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
}
|
}
|
||||||
specListNode.appendChild(
|
specListNode.appendChild(
|
||||||
createDom('li', {
|
createDom('li', {
|
||||||
className: resultNode.result.status,
|
className: 'jasmine-' + resultNode.result.status,
|
||||||
id: 'spec-' + resultNode.result.id
|
id: 'spec-' + resultNode.result.id
|
||||||
},
|
},
|
||||||
createDom('a', {href: specHref(resultNode.result)}, specDescription)
|
createDom('a', {href: specHref(resultNode.result)}, specDescription)
|
||||||
@@ -239,24 +262,24 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
|
|
||||||
if (failures.length) {
|
if (failures.length) {
|
||||||
alert.appendChild(
|
alert.appendChild(
|
||||||
createDom('span', {className: 'menu bar spec-list'},
|
createDom('span', {className: 'jasmine-menu jasmine-bar jasmine-spec-list'},
|
||||||
createDom('span', {}, 'Spec List | '),
|
createDom('span', {}, 'Spec List | '),
|
||||||
createDom('a', {className: 'failures-menu', href: '#'}, 'Failures')));
|
createDom('a', {className: 'jasmine-failures-menu', href: '#'}, 'Failures')));
|
||||||
alert.appendChild(
|
alert.appendChild(
|
||||||
createDom('span', {className: 'menu bar failure-list'},
|
createDom('span', {className: 'jasmine-menu jasmine-bar jasmine-failure-list'},
|
||||||
createDom('a', {className: 'spec-list-menu', href: '#'}, 'Spec List'),
|
createDom('a', {className: 'jasmine-spec-list-menu', href: '#'}, 'Spec List'),
|
||||||
createDom('span', {}, ' | Failures ')));
|
createDom('span', {}, ' | Failures ')));
|
||||||
|
|
||||||
find('.failures-menu').onclick = function() {
|
find('.jasmine-failures-menu').onclick = function() {
|
||||||
setMenuModeTo('failure-list');
|
setMenuModeTo('jasmine-failure-list');
|
||||||
};
|
};
|
||||||
find('.spec-list-menu').onclick = function() {
|
find('.jasmine-spec-list-menu').onclick = function() {
|
||||||
setMenuModeTo('spec-list');
|
setMenuModeTo('jasmine-spec-list');
|
||||||
};
|
};
|
||||||
|
|
||||||
setMenuModeTo('failure-list');
|
setMenuModeTo('jasmine-failure-list');
|
||||||
|
|
||||||
var failureNode = find('.failures');
|
var failureNode = find('.jasmine-failures');
|
||||||
for (var i = 0; i < failures.length; i++) {
|
for (var i = 0; i < failures.length; i++) {
|
||||||
failureNode.appendChild(failures[i]);
|
failureNode.appendChild(failures[i]);
|
||||||
}
|
}
|
||||||
@@ -314,6 +337,10 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
return addToExistingQueryString('spec', result.fullName);
|
return addToExistingQueryString('spec', result.fullName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function seedHref(seed) {
|
||||||
|
return addToExistingQueryString('seed', seed);
|
||||||
|
}
|
||||||
|
|
||||||
function defaultQueryString(key, value) {
|
function defaultQueryString(key, value) {
|
||||||
return '?' + key + '=' + value;
|
return '?' + key + '=' + value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,23 +46,23 @@ body {
|
|||||||
line-height: $line-height;
|
line-height: $line-height;
|
||||||
}
|
}
|
||||||
|
|
||||||
.banner,
|
.jasmine-banner,
|
||||||
.symbol-summary,
|
.jasmine-symbol-summary,
|
||||||
.summary,
|
.jasmine-summary,
|
||||||
.result-message,
|
.jasmine-result-message,
|
||||||
.spec .description,
|
.jasmine-spec .jasmine-description,
|
||||||
.spec-detail .description,
|
.jasmine-spec-detail .jasmine-description,
|
||||||
.alert .bar,
|
.jasmine-alert .jasmine-bar,
|
||||||
.stack-trace {
|
.jasmine-stack-trace {
|
||||||
padding-left: $margin-unit - 5px;
|
padding-left: $margin-unit - 5px;
|
||||||
padding-right: $margin-unit - 5px;
|
padding-right: $margin-unit - 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.banner {
|
.jasmine-banner {
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.banner .title {
|
.jasmine-banner .jasmine-title {
|
||||||
background: inline-image('jasmine-horizontal.png') no-repeat;
|
background: inline-image('jasmine-horizontal.png') no-repeat;
|
||||||
background: inline-image('jasmine-horizontal.svg') no-repeat, none;
|
background: inline-image('jasmine-horizontal.svg') no-repeat, none;
|
||||||
@include background-size(100%);
|
@include background-size(100%);
|
||||||
@@ -72,7 +72,7 @@ body {
|
|||||||
height: 25px;
|
height: 25px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.banner .version {
|
.jasmine-banner .jasmine-version {
|
||||||
margin-left: $margin-unit;
|
margin-left: $margin-unit;
|
||||||
position: relative;
|
position: relative;
|
||||||
top: 6px;
|
top: 6px;
|
||||||
@@ -85,17 +85,17 @@ body {
|
|||||||
right: 100%;
|
right: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.version {
|
.jasmine-version {
|
||||||
color: $faint-text-color;
|
color: $faint-text-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--- Banner ---//
|
//--- Banner ---//
|
||||||
|
|
||||||
.banner {
|
.jasmine-banner {
|
||||||
margin-top: $line-height;
|
margin-top: $line-height;
|
||||||
}
|
}
|
||||||
|
|
||||||
.duration {
|
.jasmine-duration {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
float: right;
|
float: right;
|
||||||
line-height: $line-height * 2;
|
line-height: $line-height * 2;
|
||||||
@@ -104,18 +104,18 @@ body {
|
|||||||
|
|
||||||
//--- Symbol summary ---//
|
//--- Symbol summary ---//
|
||||||
|
|
||||||
.symbol-summary {
|
.jasmine-symbol-summary {
|
||||||
@include clearfix;
|
@include clearfix;
|
||||||
margin: $line-height 0;
|
margin: $line-height 0;
|
||||||
|
|
||||||
li {
|
li {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
height: ($line-height / 2) + 1;
|
height: ($line-height / 2) + 3;
|
||||||
width: $line-height;
|
width: $line-height;
|
||||||
|
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
|
|
||||||
&.passed {
|
&.jasmine-passed {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
@@ -124,7 +124,7 @@ body {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.failed {
|
&.jasmine-failed {
|
||||||
line-height: ($line-height / 2) + 2;
|
line-height: ($line-height / 2) + 2;
|
||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
@@ -135,7 +135,7 @@ body {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.disabled {
|
&.jasmine-disabled {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
@@ -144,7 +144,7 @@ body {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.pending {
|
&.jasmine-pending {
|
||||||
line-height: 17px;
|
line-height: 17px;
|
||||||
&:before {
|
&:before {
|
||||||
color: $pending-color;
|
color: $pending-color;
|
||||||
@@ -152,7 +152,7 @@ body {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.empty {
|
&.jasmine-empty {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
@@ -163,7 +163,7 @@ body {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.run-options {
|
.jasmine-run-options {
|
||||||
float: right;
|
float: right;
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
border: 1px solid $jasmine-color;
|
border: 1px solid $jasmine-color;
|
||||||
@@ -171,12 +171,12 @@ body {
|
|||||||
position: relative;
|
position: relative;
|
||||||
line-height: 20px;
|
line-height: 20px;
|
||||||
|
|
||||||
.trigger {
|
.jasmine-trigger {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
padding: 8px 16px;
|
padding: 8px 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.payload {
|
.jasmine-payload {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
display: none;
|
display: none;
|
||||||
right: -1px;
|
right: -1px;
|
||||||
@@ -185,7 +185,7 @@ body {
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
padding: 4px 8px;
|
padding: 4px 8px;
|
||||||
|
|
||||||
&.open {
|
&.jasmine-open {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -193,30 +193,30 @@ body {
|
|||||||
|
|
||||||
//--- Alerts: status bars ---//
|
//--- Alerts: status bars ---//
|
||||||
|
|
||||||
.bar {
|
.jasmine-bar {
|
||||||
line-height: $line-height * 2;
|
line-height: $line-height * 2;
|
||||||
font-size: $large-font-size;
|
font-size: $large-font-size;
|
||||||
|
|
||||||
display: block;
|
display: block;
|
||||||
color: #eee;
|
color: #eee;
|
||||||
|
|
||||||
&.failed {
|
&.jasmine-failed {
|
||||||
background-color: $failing-color;
|
background-color: $failing-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.passed {
|
&.jasmine-passed {
|
||||||
background-color: $passing-color;
|
background-color: $passing-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.skipped {
|
&.jasmine-skipped {
|
||||||
background-color: $neutral-color;
|
background-color: $neutral-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.errored {
|
&.jasmine-errored {
|
||||||
background-color: $failing-color;
|
background-color: $failing-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.menu {
|
&.jasmine-menu {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
color: $faint-text-color;
|
color: $faint-text-color;
|
||||||
|
|
||||||
@@ -231,65 +231,29 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// simplify toggle control between the two menu bars
|
// simplify toggle control between the two menu bars
|
||||||
&.spec-list {
|
&.jasmine-spec-list {
|
||||||
.bar.menu.failure-list,
|
.jasmine-bar.jasmine-menu.jasmine-failure-list,
|
||||||
.results .failures {
|
.jasmine-results .jasmine-failures {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.failure-list {
|
&.jasmine-failure-list {
|
||||||
.bar.menu.spec-list,
|
.jasmine-bar.jasmine-menu.jasmine-spec-list,
|
||||||
.summary {
|
.jasmine-summary {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.running-alert {
|
|
||||||
background-color: $light-text-color;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--- Results ---//
|
//--- Results ---//
|
||||||
|
|
||||||
.results {
|
.jasmine-results {
|
||||||
margin-top: $line-height;
|
margin-top: $line-height;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--- Results menu ---//
|
|
||||||
|
|
||||||
&.showDetails {
|
|
||||||
|
|
||||||
.summaryMenuItem {
|
|
||||||
font-weight: normal;
|
|
||||||
text-decoration: inherit;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.detailsMenuItem {
|
|
||||||
font-weight: bold;
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
.summary {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#details {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.summaryMenuItem {
|
|
||||||
font-weight: bold;
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--- Results summary: Suites and Specs names/links ---//
|
//--- Results summary: Suites and Specs names/links ---//
|
||||||
|
|
||||||
.summary {
|
.jasmine-summary {
|
||||||
margin-top: $margin-unit;
|
margin-top: $margin-unit;
|
||||||
|
|
||||||
ul {
|
ul {
|
||||||
@@ -298,40 +262,40 @@ body {
|
|||||||
padding-top: 0;
|
padding-top: 0;
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
|
|
||||||
&.suite {
|
&.jasmine-suite {
|
||||||
margin-top: $margin-unit/2;
|
margin-top: $margin-unit/2;
|
||||||
margin-bottom: $margin-unit/2
|
margin-bottom: $margin-unit/2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
li {
|
li {
|
||||||
&.passed a {
|
&.jasmine-passed a {
|
||||||
color: $passing-color;
|
color: $passing-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.failed a {
|
&.jasmine-failed a {
|
||||||
color: $failing-color;
|
color: $failing-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.empty a {
|
&.jasmine-empty a {
|
||||||
color: $pending-color;
|
color: $pending-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.pending a {
|
&.jasmine-pending a {
|
||||||
color: $pending-color;
|
color: $pending-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.disabled a {
|
&.jasmine-disabled a {
|
||||||
color: $neutral-color;
|
color: $neutral-color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.description+.suite {
|
.jasmine-description + .jasmine-suite {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.suite {
|
.jasmine-suite {
|
||||||
margin-top: $margin-unit;
|
margin-top: $margin-unit;
|
||||||
|
|
||||||
a {
|
a {
|
||||||
@@ -341,11 +305,11 @@ body {
|
|||||||
|
|
||||||
//--- Failure details ---//
|
//--- Failure details ---//
|
||||||
|
|
||||||
.failures {
|
.jasmine-failures {
|
||||||
.spec-detail {
|
.jasmine-spec-detail {
|
||||||
margin-bottom: $line-height * 2;
|
margin-bottom: $line-height * 2;
|
||||||
|
|
||||||
.description {
|
.jasmine-description {
|
||||||
background-color: $failing-color;
|
background-color: $failing-color;
|
||||||
|
|
||||||
a {
|
a {
|
||||||
@@ -355,7 +319,7 @@ body {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.result-message {
|
.jasmine-result-message {
|
||||||
padding-top: $line-height;
|
padding-top: $line-height;
|
||||||
|
|
||||||
color: $text-color;
|
color: $text-color;
|
||||||
@@ -363,11 +327,11 @@ body {
|
|||||||
white-space: pre;
|
white-space: pre;
|
||||||
}
|
}
|
||||||
|
|
||||||
.result-message span.result {
|
.jasmine-result-message span.jasmine-result {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.stack-trace {
|
.jasmine-stack-trace {
|
||||||
margin: 5px 0 0 0;
|
margin: 5px 0 0 0;
|
||||||
max-height: $line-height * 16;
|
max-height: $line-height * 16;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
|||||||
@@ -2,10 +2,8 @@
|
|||||||
|
|
||||||
if [ $USE_SAUCE == true ]
|
if [ $USE_SAUCE == true ]
|
||||||
then
|
then
|
||||||
if [ $TRAVIS_SECURE_ENV_VARS == true ]
|
if [ $TRAVIS_SECURE_ENV_VARS != true ]
|
||||||
then
|
then
|
||||||
curl -L https://gist.github.com/santiycr/5139565/raw/sauce_connect_setup.sh | bash
|
|
||||||
else
|
|
||||||
echo "skipping tests since we can't use sauce"
|
echo "skipping tests since we can't use sauce"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user