From 57be10c9d224ad88bd1c7675d9619d63beaa1eb6 Mon Sep 17 00:00:00 2001 From: Steve Gravrock Date: Mon, 28 Jun 2021 20:32:41 -0700 Subject: [PATCH] Updated jsdocs --- lib/jasmine.js | 8 +++----- lib/reporters/console_reporter.js | 32 +++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/lib/jasmine.js b/lib/jasmine.js index 6a05409e..35a9e342 100644 --- a/lib/jasmine.js +++ b/lib/jasmine.js @@ -26,6 +26,9 @@ module.exports.ConsoleReporter = require('./reporters/console_reporter'); * @param {(JasmineOptions | undefined)} options * @constructor * @name Jasmine + * @example + * const Jasmine = require('jasmine'); + * const jasmine = new Jasmine(); */ function Jasmine(options) { options = options || {}; @@ -313,7 +316,6 @@ function addFiles(kind) { * after the suite has completed and the results have been finalized, but not * necessarily before all of Jasmine's cleanup has finished. * - * @deprecated Use the promise returned from {@link Jasmine#execute} instead. * @param {function} onCompleteCallback */ Jasmine.prototype.onComplete = function(onCompleteCallback) { @@ -324,8 +326,6 @@ Jasmine.prototype.onComplete = function(onCompleteCallback) { * Sets whether to cause specs to only have one expectation failure. * @function * @name Jasmine#stopSpecOnExpectationFailure - * @deprecated Use the oneFailurePerSped option with - * {@link Jasmine#loadConfig} or a config file instead. * @param {boolean} value Whether to cause specs to only have one expectation * failure */ @@ -337,8 +337,6 @@ Jasmine.prototype.stopSpecOnExpectationFailure = function(value) { * Sets whether to stop execution of the suite after the first spec failure. * @function * @name Jasmine#stopOnSpecFailure - * @deprecated Use the failFast option with {@link Jasmine#loadConfig} or a - * config file instead. * @param {boolean} value Whether to stop execution of the suite after the * first spec failure */ diff --git a/lib/reporters/console_reporter.js b/lib/reporters/console_reporter.js index 19020e84..defcfeec 100644 --- a/lib/reporters/console_reporter.js +++ b/lib/reporters/console_reporter.js @@ -1,5 +1,14 @@ module.exports = exports = ConsoleReporter; +/** + * @classdesc A reporter that prints spec and suite results to the console. + * A ConsoleReporter is installed by default. + * + * @constructor + * @example + * const {ConsoleReporter} = require('jasmine'); + * const reporter = new ConsoleReporter(); + */ function ConsoleReporter() { var print = function() {}, showColors = false, @@ -18,10 +27,26 @@ function ConsoleReporter() { failedSuites = [], stackFilter = defaultStackFilter; + /** + * Configures the reporter. + * @function + * @name ConsoleReporter#setOptions + * @param {ConsoleReporterOptions} options + */ this.setOptions = function(options) { if (options.print) { print = options.print; } + + /** + * @interface ConsoleReporterOptions + */ + /** + * Whether to colorize the output + * @name ConsoleReporterOptions#showColors + * @type Boolean|undefined + * @default false + */ showColors = options.showColors || false; if (options.jasmineCorePath) { jasmineCorePath = options.jasmineCorePath; @@ -29,6 +54,13 @@ function ConsoleReporter() { if (options.stackFilter) { stackFilter = options.stackFilter; } + /** + * A function that takes a random seed and returns the command to reproduce + * that seed. Use this to customize the output when using ConsoleReporter + * in a different command line tool. + * @name ConsoleReporterOptions#showColors + * @type Function|undefined + */ if (options.randomSeedReproductionCmd) { this.randomSeedReproductionCmd = options.randomSeedReproductionCmd; }