jasmine-core
Advanced tools
Comparing version 2.8.0 to 2.9.0
@@ -19,3 +19,4 @@ # Developing for Jasmine Core | ||
git remote add upstream https://github.com/jasmine/jasmine.git # Assign original repository to a remote named 'upstream' | ||
git fetch upstream # Pull in changes not present in your local repository | ||
git fetch upstream # Fetch changes not present in your local repository | ||
git merge upstream/master # Sync local master with upstream repository | ||
git checkout -b my-new-feature # Create your feature branch | ||
@@ -44,5 +45,5 @@ git commit -am 'Add some feature' # Commit your changes | ||
Note that Jasmine tests itself. The files in `lib` are loaded first, defining the reference `jasmine`. Then the files in `src` are loaded, defining the reference `j$`. So there are two copies of the code loaded under test. | ||
Note that Jasmine tests itself. The files in `lib` are loaded first, defining the reference `jasmine`. Then the files in `src` are loaded, defining the reference `jasmineUnderTest`. So there are two copies of the code loaded under test. | ||
The tests should always use `j$` to refer to the objects and functions that are being tested. But the tests can use functions on `jasmine` as needed. _Be careful how you structure any new test code_. Copy the patterns you see in the existing code - this ensures that the code you're testing is not leaking into the `jasmine` reference and vice-versa. | ||
The tests should always use `jasmineUnderTest` to refer to the objects and functions that are being tested. But the tests can use functions on `jasmine` as needed. _Be careful how you structure any new test code_. Copy the patterns you see in the existing code - this ensures that the code you're testing is not leaking into the `jasmine` reference and vice-versa. | ||
@@ -134,9 +135,7 @@ ### `boot.js` | ||
1. Build `jasmine.js` with `grunt buildDistribution` and run all specs again - this ensures that your changes self-test well | ||
## Submitting a Pull Request | ||
1. Revert your changes to `jasmine.js` and `jasmine-html.js` | ||
* We do this because `jasmine.js` and `jasmine-html.js` are auto-generated (as you've seen in the previous steps) and accepting multiple pull requests when this auto-generated file changes causes lots of headaches | ||
1. When we accept your pull request, we will generate these files as a separate commit and merge the entire branch into master | ||
* We do this because `jasmine.js` and `jasmine-html.js` are auto-generated (as you've seen in the previous steps) and accepting multiple pull requests when this auto-generated file changes causes lots of headaches | ||
* When we accept your pull request, we will generate these files as a separate commit and merge the entire branch into master | ||
Note that we use Travis for Continuous Integration. We only accept green pull requests. | ||
MANIFEST.in | ||
README.md | ||
package.json | ||
@@ -3,0 +4,0 @@ setup.py |
/* | ||
Copyright (c) 2008-2017 Pivotal Labs | ||
Copyright (c) 2008-2018 Pivotal Labs | ||
@@ -4,0 +4,0 @@ Permission is hereby granted, free of charge, to any person obtaining |
/* | ||
Copyright (c) 2008-2017 Pivotal Labs | ||
Copyright (c) 2008-2018 Pivotal Labs | ||
@@ -4,0 +4,0 @@ Permission is hereby granted, free of charge, to any person obtaining |
/* | ||
Copyright (c) 2008-2017 Pivotal Labs | ||
Copyright (c) 2008-2018 Pivotal Labs | ||
@@ -37,2 +37,42 @@ Permission is hereby granted, free of charge, to any person obtaining | ||
function ResultsStateBuilder() { | ||
this.topResults = new j$.ResultsNode({}, '', null); | ||
this.currentParent = this.topResults; | ||
this.specsExecuted = 0; | ||
this.failureCount = 0; | ||
this.pendingSpecCount = 0; | ||
} | ||
ResultsStateBuilder.prototype.suiteStarted = function(result) { | ||
this.currentParent.addChild(result, 'suite'); | ||
this.currentParent = this.currentParent.last(); | ||
}; | ||
ResultsStateBuilder.prototype.suiteDone = function(result) { | ||
if (this.currentParent !== this.topResults) { | ||
this.currentParent = this.currentParent.parent; | ||
} | ||
}; | ||
ResultsStateBuilder.prototype.specStarted = function(result) { | ||
}; | ||
ResultsStateBuilder.prototype.specDone = function(result) { | ||
this.currentParent.addChild(result, 'spec'); | ||
if (result.status !== 'disabled') { | ||
this.specsExecuted++; | ||
} | ||
if (result.status === 'failed') { | ||
this.failureCount++; | ||
} | ||
if (result.status == 'pending') { | ||
this.pendingSpecCount++; | ||
} | ||
}; | ||
function HtmlReporter(options) { | ||
@@ -50,5 +90,2 @@ var env = options.env || {}, | ||
results = [], | ||
specsExecuted = 0, | ||
failureCount = 0, | ||
pendingSpecCount = 0, | ||
htmlReporterMain, | ||
@@ -82,8 +119,6 @@ symbols, | ||
var topResults = new j$.ResultsNode({}, '', null), | ||
currentParent = topResults; | ||
var stateBuilder = new ResultsStateBuilder(); | ||
this.suiteStarted = function(result) { | ||
currentParent.addChild(result, 'suite'); | ||
currentParent = currentParent.last(); | ||
stateBuilder.suiteStarted(result); | ||
}; | ||
@@ -96,11 +131,7 @@ | ||
if (currentParent == topResults) { | ||
return; | ||
} | ||
currentParent = currentParent.parent; | ||
stateBuilder.suiteDone(result); | ||
}; | ||
this.specStarted = function(result) { | ||
currentParent.addChild(result, 'spec'); | ||
stateBuilder.specStarted(result); | ||
}; | ||
@@ -110,2 +141,4 @@ | ||
this.specDone = function(result) { | ||
stateBuilder.specDone(result); | ||
if(noExpectations(result) && typeof console !== 'undefined' && typeof console.error !== 'undefined') { | ||
@@ -115,6 +148,2 @@ console.error('Spec \'' + result.fullName + '\' has no expectations.'); | ||
if (result.status != 'disabled') { | ||
specsExecuted++; | ||
} | ||
if (!symbols){ | ||
@@ -132,4 +161,2 @@ symbols = find('.jasmine-symbol-summary'); | ||
if (result.status == 'failed') { | ||
failureCount++; | ||
var failure = | ||
@@ -152,6 +179,2 @@ createDom('div', {className: 'jasmine-spec-detail jasmine-failed'}, | ||
} | ||
if (result.status == 'pending') { | ||
pendingSpecCount++; | ||
} | ||
}; | ||
@@ -219,4 +242,4 @@ | ||
if (specsExecuted < totalSpecsDefined) { | ||
var skippedMessage = 'Ran ' + specsExecuted + ' of ' + totalSpecsDefined + ' specs - run all'; | ||
if (stateBuilder.specsExecuted < totalSpecsDefined) { | ||
var skippedMessage = 'Ran ' + stateBuilder.specsExecuted + ' of ' + totalSpecsDefined + ' specs - run all'; | ||
var skippedLink = addToExistingQueryString('spec', ''); | ||
@@ -233,5 +256,5 @@ alert.appendChild( | ||
if (totalSpecsDefined > 0) { | ||
statusBarMessage += pluralize('spec', specsExecuted) + ', ' + pluralize('failure', failureCount); | ||
if (pendingSpecCount) { statusBarMessage += ', ' + pluralize('pending spec', pendingSpecCount); } | ||
statusBarClassName += (failureCount > 0) ? 'jasmine-failed' : 'jasmine-passed'; | ||
statusBarMessage += pluralize('spec', stateBuilder.specsExecuted) + ', ' + pluralize('failure', stateBuilder.failureCount); | ||
if (stateBuilder.pendingSpecCount) { statusBarMessage += ', ' + pluralize('pending spec', stateBuilder.pendingSpecCount); } | ||
statusBarClassName += (stateBuilder.failureCount > 0) ? 'jasmine-failed' : 'jasmine-passed'; | ||
} else { | ||
@@ -271,3 +294,3 @@ statusBarClassName += 'jasmine-skipped'; | ||
summaryList(topResults, summary); | ||
summaryList(stateBuilder.topResults, summary); | ||
@@ -274,0 +297,0 @@ function summaryList(resultsTree, domParent) { |
/* | ||
Copyright (c) 2008-2017 Pivotal Labs | ||
Copyright (c) 2008-2018 Pivotal Labs | ||
@@ -4,0 +4,0 @@ Permission is hereby granted, free of charge, to any person obtaining |
{ | ||
"name": "jasmine-core", | ||
"license": "MIT", | ||
"version": "2.8.0", | ||
"version": "2.9.0", | ||
"repository": { | ||
@@ -6,0 +6,0 @@ "type": "git", |
<a name="README">[<img src="https://rawgithub.com/jasmine/jasmine/master/images/jasmine-horizontal.svg" width="400px" />](http://jasmine.github.io)</a> | ||
[![Build Status](https://travis-ci.org/jasmine/jasmine.svg?branch=master)](https://travis-ci.org/jasmine/jasmine) | ||
[![Code Climate](https://codeclimate.com/github/pivotal/jasmine.svg)](https://codeclimate.com/github/pivotal/jasmine) | ||
@@ -6,0 +5,0 @@ ======= |
@@ -10,6 +10,4 @@ # How to work on a Jasmine Release | ||
Please work on feature branches. | ||
Please attempt to keep commits to `master` small, but cohesive. If a feature is contained in a bunch of small commits (e.g., it has several wip commits or small work), please squash them when pushing to `master`. | ||
Please attempt to keep commits to `master` small, but cohesive. If a feature is contained in a bunch of small commits (e.g., it has several wip commits or small work), please squash them when merging back to `master`. | ||
### Version | ||
@@ -16,0 +14,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
275199
40
6154
79