Replaced uses of var with const/let

This commit is contained in:
Steve Gravrock
2022-06-08 19:07:43 -07:00
parent 4af86f5398
commit 135ff20123
73 changed files with 1384 additions and 1391 deletions

View File

@@ -5,14 +5,14 @@
source files or spec files are loaded.
*/
(function() {
var jasmineRequire = window.jasmineRequire || require('./jasmine.js');
const jasmineRequire = window.jasmineRequire || require('./jasmine.js');
/**
* ## Require & Instantiate
*
* Require Jasmine's core files. Specifically, this requires and attaches all of Jasmine's code to the `jasmine` reference.
*/
var jasmine = jasmineRequire.core(jasmineRequire),
const jasmine = jasmineRequire.core(jasmineRequire),
global = jasmine.getGlobal();
global.jasmine = jasmine;
@@ -24,19 +24,19 @@
/**
* Create the Jasmine environment. This is used to run all specs in a project.
*/
var env = jasmine.getEnv();
const env = jasmine.getEnv();
/**
* ## The Global Interface
*
* Build up the functions that will be exposed as the Jasmine public interface. A project can customize, rename or alias any of these functions as desired, provided the implementation remains unchanged.
*/
var jasmineInterface = jasmineRequire.interface(jasmine, env);
const jasmineInterface = jasmineRequire.interface(jasmine, env);
/**
* Add all of the Jasmine global/public interface to the global scope, so a project can use the public interface directly. For example, calling `describe` in specs instead of `jasmine.getEnv().describe`.
*/
for (var property in jasmineInterface) {
for (const property in jasmineInterface) {
global[property] = jasmineInterface[property];
}
})();

View File

@@ -12,7 +12,7 @@
*/
(function() {
var env = jasmine.getEnv();
const env = jasmine.getEnv();
/**
* ## Runner Parameters
@@ -20,15 +20,15 @@
* More browser specific code - wrap the query string in an object and to allow for getting/setting parameters from the runner user interface.
*/
var queryString = new jasmine.QueryString({
const queryString = new jasmine.QueryString({
getWindowLocation: function() {
return window.location;
}
});
var filterSpecs = !!queryString.getParam('spec');
const filterSpecs = !!queryString.getParam('spec');
var config = {
const config = {
stopOnSpecFailure: queryString.getParam('stopOnSpecFailure'),
stopSpecOnExpectationFailure: queryString.getParam(
'stopSpecOnExpectationFailure'
@@ -36,13 +36,13 @@
hideDisabled: queryString.getParam('hideDisabled')
};
var random = queryString.getParam('random');
const random = queryString.getParam('random');
if (random !== undefined && random !== '') {
config.random = random;
}
var seed = queryString.getParam('seed');
const seed = queryString.getParam('seed');
if (seed) {
config.seed = seed;
}
@@ -51,7 +51,7 @@
* ## 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).
*/
var htmlReporter = new jasmine.HtmlReporter({
const htmlReporter = new jasmine.HtmlReporter({
env: env,
navigateWithNewParam: function(key, value) {
return queryString.navigateWithNewParam(key, value);
@@ -81,7 +81,7 @@
/**
* Filter which specs will be run by matching the start of the full name against the `spec` query param.
*/
var specFilter = new jasmine.HtmlSpecFilter({
const specFilter = new jasmine.HtmlSpecFilter({
filterString: function() {
return queryString.getParam('spec');
}
@@ -98,7 +98,7 @@
*
* Replace the browser window's `onload`, ensure it's called, and then run all of the loaded specs. This includes initializing the `HtmlReporter` instance and then executing the loaded Jasmine environment. All of this will happen after all of the specs are loaded.
*/
var currentWindowOnload = window.onload;
const currentWindowOnload = window.onload;
window.onload = function() {
if (currentWindowOnload) {

View File

@@ -1,14 +1,14 @@
module.exports = function(jasmineRequire) {
var jasmine = jasmineRequire.core(jasmineRequire);
const jasmine = jasmineRequire.core(jasmineRequire);
var env = jasmine.getEnv({ suppressLoadErrors: true });
const env = jasmine.getEnv({ suppressLoadErrors: true });
var jasmineInterface = jasmineRequire.interface(jasmine, env);
const jasmineInterface = jasmineRequire.interface(jasmine, env);
extend(global, jasmineInterface);
function extend(destination, source) {
for (var property in source) destination[property] = source[property];
for (const property in source) destination[property] = source[property];
return destination;
}