Add documentation for more public functions on Env

- Fixes #1565
This commit is contained in:
Gregg Van Hove
2018-06-05 17:12:43 -07:00
parent 9472df0db4
commit 03998c1b20
2 changed files with 100 additions and 18 deletions

View File

@@ -797,7 +797,7 @@ getJasmineRequireObj().Env = function(j$) {
var throwOnExpectationFailure = false;
var stopOnSpecFailure = false;
var random = true;
var hidingDisabled = false;
var hidingDisabled = false;
var seed = null;
var handlingLoadErrors = true;
var hasFailures = false;
@@ -959,6 +959,13 @@ getJasmineRequireObj().Env = function(j$) {
var maximumSpecCallbackDepth = 20;
var currentSpecCallbackDepth = 0;
/**
* Sets whether Jasmine should throw an Error when an expectation fails.
* This causes a spec to only have one expectation failure.
* @name throwOnExpectationFailure
* @function
* @param {Boolean} value Whether to throw when a expectation fails
*/
this.throwOnExpectationFailure = function(value) {
throwOnExpectationFailure = !!value;
};
@@ -967,6 +974,12 @@ getJasmineRequireObj().Env = function(j$) {
return throwOnExpectationFailure;
};
/**
* Set whether to stop suite execution when a spec fails
* @name stopOnSpecFailure
* @function
* @param {Boolean} value Whether to stop suite execution when a spec fails
*/
this.stopOnSpecFailure = function(value) {
stopOnSpecFailure = !!value;
};
@@ -975,22 +988,26 @@ getJasmineRequireObj().Env = function(j$) {
return stopOnSpecFailure;
};
/**
* Set whether to randomize test execution order
* @name randomizeTests
* @function
* @param {Boolean} value Whether to randomize execution order
*/
this.randomizeTests = function(value) {
random = !!value;
};
this.hidingDisabled = function(value) {
return hidingDisabled;
};
this.hideDisabled = function(value) {
hidingDisabled = !!value;
};
this.randomTests = function() {
return random;
};
/**
* Set the random number seed for spec randomization
* @name seed
* @function
* @param {Number} value The seed value
*/
this.seed = function(value) {
if (value) {
seed = value;
@@ -998,6 +1015,18 @@ getJasmineRequireObj().Env = function(j$) {
return seed;
};
this.hidingDisabled = function(value) {
return hidingDisabled;
};
/**
* @name hideDisabled
* @function
*/
this.hideDisabled = function(value) {
hidingDisabled = !!value;
};
this.deprecated = function(deprecation) {
var runnable = currentRunnable() || topSuite;
runnable.addDeprecationWarning(deprecation);
@@ -1225,10 +1254,22 @@ getJasmineRequireObj().Env = function(j$) {
reporter.addReporter(reporterToAdd);
};
/**
* Provide a fallback reporter if no other reporters have been specified.
* @name provideFallbackReporter
* @function
* @param {Reporter} reporterToAdd The reporter
* @see custom_reporter
*/
this.provideFallbackReporter = function(reporterToAdd) {
reporter.provideFallbackReporter(reporterToAdd);
};
/**
* Clear all registered reporters
* @name clearReporters
* @function
*/
this.clearReporters = function() {
reporter.clearReporters();
};

View File

@@ -26,7 +26,7 @@ getJasmineRequireObj().Env = function(j$) {
var throwOnExpectationFailure = false;
var stopOnSpecFailure = false;
var random = true;
var hidingDisabled = false;
var hidingDisabled = false;
var seed = null;
var handlingLoadErrors = true;
var hasFailures = false;
@@ -188,6 +188,13 @@ getJasmineRequireObj().Env = function(j$) {
var maximumSpecCallbackDepth = 20;
var currentSpecCallbackDepth = 0;
/**
* Sets whether Jasmine should throw an Error when an expectation fails.
* This causes a spec to only have one expectation failure.
* @name throwOnExpectationFailure
* @function
* @param {Boolean} value Whether to throw when a expectation fails
*/
this.throwOnExpectationFailure = function(value) {
throwOnExpectationFailure = !!value;
};
@@ -196,6 +203,12 @@ getJasmineRequireObj().Env = function(j$) {
return throwOnExpectationFailure;
};
/**
* Set whether to stop suite execution when a spec fails
* @name stopOnSpecFailure
* @function
* @param {Boolean} value Whether to stop suite execution when a spec fails
*/
this.stopOnSpecFailure = function(value) {
stopOnSpecFailure = !!value;
};
@@ -204,22 +217,26 @@ getJasmineRequireObj().Env = function(j$) {
return stopOnSpecFailure;
};
/**
* Set whether to randomize test execution order
* @name randomizeTests
* @function
* @param {Boolean} value Whether to randomize execution order
*/
this.randomizeTests = function(value) {
random = !!value;
};
this.hidingDisabled = function(value) {
return hidingDisabled;
};
this.hideDisabled = function(value) {
hidingDisabled = !!value;
};
this.randomTests = function() {
return random;
};
/**
* Set the random number seed for spec randomization
* @name seed
* @function
* @param {Number} value The seed value
*/
this.seed = function(value) {
if (value) {
seed = value;
@@ -227,6 +244,18 @@ getJasmineRequireObj().Env = function(j$) {
return seed;
};
this.hidingDisabled = function(value) {
return hidingDisabled;
};
/**
* @name hideDisabled
* @function
*/
this.hideDisabled = function(value) {
hidingDisabled = !!value;
};
this.deprecated = function(deprecation) {
var runnable = currentRunnable() || topSuite;
runnable.addDeprecationWarning(deprecation);
@@ -454,10 +483,22 @@ getJasmineRequireObj().Env = function(j$) {
reporter.addReporter(reporterToAdd);
};
/**
* Provide a fallback reporter if no other reporters have been specified.
* @name provideFallbackReporter
* @function
* @param {Reporter} reporterToAdd The reporter
* @see custom_reporter
*/
this.provideFallbackReporter = function(reporterToAdd) {
reporter.provideFallbackReporter(reporterToAdd);
};
/**
* Clear all registered reporters
* @name clearReporters
* @function
*/
this.clearReporters = function() {
reporter.clearReporters();
};