Skip to content

Commit

Permalink
jsdoc updates
Browse files Browse the repository at this point in the history
  • Loading branch information
sgravrock committed Jul 1, 2021
1 parent e6f585d commit 339c9f9
Showing 1 changed file with 65 additions and 8 deletions.
73 changes: 65 additions & 8 deletions lib/jasmine.js
Expand Up @@ -71,8 +71,6 @@ function Jasmine(options) {
* Sets whether to randomize the order of specs.
* @function
* @name Jasmine#randomizeTests
* @deprecated Use the random option with {@link Jasmine#loadConfig} or a
* config file instead.
* @param {boolean} value Whether to randomize
*/
Jasmine.prototype.randomizeTests = function(value) {
Expand All @@ -83,8 +81,6 @@ Jasmine.prototype.randomizeTests = function(value) {
* Sets the random seed.
* @function
* @name Jasmine#seed
* @deprecated Use the seed option with {@link Jasmine#loadConfig} or a
* config file instead.
* @param {number} seed The random seed
*/
Jasmine.prototype.seed = function(value) {
Expand Down Expand Up @@ -196,7 +192,7 @@ Jasmine.prototype.loadRequires = function() {
* Loads configuration from the specified file. The file can be a JSON file or
* any JS file that's loadable via require and provides a Jasmine config
* as its default export.
* @param configFilePath
* @param {string} [configFilePath=spec/support/jasmine.json]
*/
Jasmine.prototype.loadConfigFile = function(configFilePath) {
try {
Expand All @@ -210,29 +206,71 @@ Jasmine.prototype.loadConfigFile = function(configFilePath) {

/**
* Loads configuration from the specified object.
* @param config
* @param {Configuration} config
*/
Jasmine.prototype.loadConfig = function(config) {
this.specDir = config.spec_dir || this.specDir;

/**
* @interface Configuration
*/
var configuration = {};

/**
* The directory that spec files are contained in, relative to the project
* base directory.
* @name Configuration#spec_dir
* @type string | undefined
*/
this.specDir = config.spec_dir || this.specDir;

/**
* Whether to fail specs that contain no expectations.
* @name Configuration#failSpecWithNoExpectations
* @type boolean | undefined
* @default false
*/
if (config.failSpecWithNoExpectations !== undefined) {
configuration.failSpecWithNoExpectations = config.failSpecWithNoExpectations;
}

/**
* Whether to stop each spec on the first expectation failure.
* @name Configuration#stopSpecOnExpectationFailure
* @type boolean | undefined
* @default false
*/
if (config.stopSpecOnExpectationFailure !== undefined) {
configuration.oneFailurePerSpec = config.stopSpecOnExpectationFailure;
}

/**
* Whether to stop suite execution on the first spec failure.
* @name Configuration#stopOnSpecFailure
* @type boolean | undefined
* @default false
*/
if (config.stopOnSpecFailure !== undefined) {
configuration.failFast = config.stopOnSpecFailure;
}

/**
* Whether to run specs in a random order.
* @name Configuration#random
* @type boolean | undefined
* @default true
*/
if (config.random !== undefined) {
configuration.random = config.random;
}


/**
* Specifies how to load files with names ending in .js. Valid values are
* "require" and "import". "import" should be safe in all cases, and is
* required if your project contains ES modules with filenames ending in .js.
* @name Configuration#jsLoader
* @type string | undefined
* @default "require"
*/
if (config.jsLoader === 'import') {
checkForJsFileImportSupport();
this._alwaysImport = true;
Expand All @@ -248,14 +286,33 @@ Jasmine.prototype.loadConfig = function(config) {
this.env.configure(configuration);
}

/**
* An array of helper file paths or {@link https://github.com/isaacs/node-glob#glob-primer|globs}
* that match helper files. Each path or glob will be evaluated relative to
* the spec directory. Helpers are loaded before specs.
* @name Configuration#helpers
* @type string[] | undefined
*/
if(config.helpers) {
this.addHelperFiles(config.helpers);
}

/**
* An array of module names to load via require() at the start of execution.
* @name Configuration#requires
* @type string[] | undefined
*/
if(config.requires) {
this.addRequires(config.requires);
}

/**
* An array of spec file paths or {@link https://github.com/isaacs/node-glob#glob-primer|globs}
* that match helper files. Each path or glob will be evaluated relative to
* the spec directory.
* @name Configuration#spec_files
* @type string[] | undefined
*/
if(config.spec_files) {
this.addSpecFiles(config.spec_files);
}
Expand Down

0 comments on commit 339c9f9

Please sign in to comment.