Adopt strict mode throughout the codebase

This commit is contained in:
Steve Gravrock
2025-10-05 06:53:54 -07:00
parent 73a30ffc3e
commit 68a7cbb991
116 changed files with 442 additions and 0 deletions

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().CallTracker = function(j$) {
'use strict';
/**
* @namespace Spy#calls
* @since 2.0.0

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().clearStack = function(j$) {
'use strict';
const maxInlineCallCount = 10;
function browserQueueMicrotaskImpl(global) {

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().Clock = function() {
'use strict';
/* global process */
const NODE_JS =
typeof process !== 'undefined' &&

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().CompleteOnFirstErrorSkipPolicy = function(j$) {
'use strict';
function CompleteOnFirstErrorSkipPolicy(queueableFns) {
this.queueableFns_ = queueableFns;
this.erroredFnIx_ = null;

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().Configuration = function(j$) {
'use strict';
/**
* This represents the available options to configure Jasmine.
* Options that are not provided will use their default values.

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().CurrentRunableTracker = function() {
'use strict';
class CurrentRunableTracker {
#currentSpec;
#currentlyExecutingSuites;

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().Deprecator = function(j$) {
'use strict';
function Deprecator(topSuite) {
this.topSuite_ = topSuite;
this.verbose_ = false;

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().Env = function(j$) {
'use strict';
/**
* @class Env
* @since 2.0.0

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().ExceptionFormatter = function(j$) {
'use strict';
const ignoredProperties = [
'name',
'message',

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().Expectation = function(j$) {
'use strict';
/**
* Matchers that come with Jasmine out of the box.
* @namespace matchers

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().ExpectationFilterChain = function() {
'use strict';
function ExpectationFilterChain(maybeFilter, prev) {
this.filter_ = maybeFilter;
this.prev_ = prev;

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().Expector = function(j$) {
'use strict';
function Expector(options) {
this.matchersUtil = options.matchersUtil || {
buildFailureMessage: function() {}

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().GlobalErrors = function(j$) {
'use strict';
class GlobalErrors {
#getConfig;
#adapter;

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().JsApiReporter = function(j$) {
'use strict';
/**
* @name jsApiReporter
* @classdesc {@link Reporter} added by default in `boot.js` to record results for retrieval in javascript code. An instance is made available as `jsApiReporter` on the global object.

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().MockDate = function(j$) {
'use strict';
function MockDate(global) {
let currentTime = 0;

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().NeverSkipPolicy = function(j$) {
'use strict';
function NeverSkipPolicy(queueableFns) {}
NeverSkipPolicy.prototype.skipTo = function(lastRanFnIx) {

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().Order = function() {
'use strict';
function Order(options) {
this.random = 'random' in options ? options.random : true;
const seed = (this.seed = options.seed || generateSeed());

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().makePrettyPrinter = function(j$) {
'use strict';
class SinglePrettyPrintRun {
constructor(customObjectFormatters, pp) {
this.customObjectFormatters_ = customObjectFormatters;

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().QueueRunner = function(j$) {
'use strict';
let nextid = 1;
function StopExecutionError() {}

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().RunableResources = function(j$) {
'use strict';
class RunableResources {
constructor(options) {
this.byRunableId_ = {};

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().Runner = function(j$) {
'use strict';
class Runner {
#topSuite;
#getTotalSpecsDefined;

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().SkipAfterBeforeAllErrorPolicy = function(j$) {
'use strict';
function SkipAfterBeforeAllErrorPolicy(queueableFns) {
this.queueableFns_ = queueableFns;
this.skipping_ = false;

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().Spec = function(j$) {
'use strict';
class Spec {
#autoCleanClosures;
#throwOnExpectationFailure;

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().Spy = function(j$) {
'use strict';
const nextOrder = (function() {
let order = 0;

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().SpyFactory = function(j$) {
'use strict';
function SpyFactory(
getCustomStrategies,
getDefaultStrategyFn,

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().SpyStrategy = function(j$) {
'use strict';
/**
* @interface SpyStrategy
*/

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().StackTrace = function(j$) {
'use strict';
function StackTrace(error) {
let lines = error.stack.split('\n');

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().Suite = function(j$) {
'use strict';
class Suite {
#reportedParentSuiteId;
#throwOnExpectationFailure;

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().SuiteBuilder = function(j$) {
'use strict';
class SuiteBuilder {
constructor(options) {
this.env_ = options.env;

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().Timer = function() {
'use strict';
const defaultNow = (function(Date) {
return function() {
return new Date().getTime();

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().TreeProcessor = function(j$) {
'use strict';
const defaultMin = Infinity;
const defaultMax = 1 - Infinity;

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().TreeRunner = function(j$) {
'use strict';
class TreeRunner {
#executionTree;
#setTimeout;

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().UserContext = function(j$) {
'use strict';
function UserContext() {}
UserContext.fromExisting = function(oldContext) {

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().Any = function(j$) {
'use strict';
function Any(expectedObject) {
if (typeof expectedObject === 'undefined') {
throw new TypeError(

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().Anything = function(j$) {
'use strict';
function Anything() {}
Anything.prototype.asymmetricMatch = function(other) {

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().ArrayContaining = function(j$) {
'use strict';
function ArrayContaining(sample) {
this.sample = sample;
}

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().ArrayWithExactContents = function(j$) {
'use strict';
function ArrayWithExactContents(sample) {
this.sample = sample;
}

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().Empty = function(j$) {
'use strict';
function Empty() {}
Empty.prototype.asymmetricMatch = function(other) {

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().Falsy = function(j$) {
'use strict';
function Falsy() {}
Falsy.prototype.asymmetricMatch = function(other) {

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().Is = function(j$) {
'use strict';
class Is {
constructor(expected) {
this.expected_ = expected;

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().MapContaining = function(j$) {
'use strict';
function MapContaining(sample) {
if (!j$.private.isMap(sample)) {
throw new Error(

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().NotEmpty = function(j$) {
'use strict';
function NotEmpty() {}
NotEmpty.prototype.asymmetricMatch = function(other) {

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().ObjectContaining = function(j$) {
'use strict';
function ObjectContaining(sample) {
this.sample = sample;
}

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().SetContaining = function(j$) {
'use strict';
function SetContaining(sample) {
if (!j$.private.isSet(sample)) {
throw new Error(

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().StringContaining = function(j$) {
'use strict';
function StringContaining(expected) {
if (!j$.private.isString(expected)) {
throw new Error('Expected is not a String');

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().StringMatching = function(j$) {
'use strict';
function StringMatching(expected) {
if (!j$.private.isString(expected) && !j$.private.isA('RegExp', expected)) {
throw new Error('Expected is not a String or a RegExp');

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().Truthy = function(j$) {
'use strict';
function Truthy() {}
Truthy.prototype.asymmetricMatch = function(other) {

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().base = function(j$, jasmineGlobal) {
'use strict';
/**
* Maximum object depth the pretty printer will print to.
* Set this to a lower value to speed up pretty printing if you have large objects.

View File

@@ -1,5 +1,7 @@
//TODO: expectation result may make more sense as a presentation of an expectation.
getJasmineRequireObj().buildExpectationResult = function(j$) {
'use strict';
function buildExpectationResult(options) {
const exceptionFormatter = new j$.private.ExceptionFormatter();

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().errors = function() {
'use strict';
function ExpectationFailed() {}
ExpectationFailed.prototype = new Error();

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().formatErrorMsg = function() {
'use strict';
function generateErrorMsg(domain, usage) {
const usageDefinition = usage ? '\nUsage: ' + usage : '';

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().DiffBuilder = function(j$) {
'use strict';
class DiffBuilder {
constructor(config) {
this.prettyPrinter_ =

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().MismatchTree = function(j$) {
'use strict';
/*
To be able to apply custom object formatters at all possible levels of an
object graph, DiffBuilder needs to be able to know not just where the

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().NullDiffBuilder = function(j$) {
'use strict';
return function() {
return {
withPath: function(_, block) {

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().ObjectPath = function(j$) {
'use strict';
class ObjectPath {
constructor(components) {
this.components = components || [];

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toBePending = function(j$) {
'use strict';
/**
* Expect a promise to be pending, i.e. the promise is neither resolved nor rejected.
* @function

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toBeRejected = function(j$) {
'use strict';
/**
* Expect a promise to be rejected.
* @function

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toBeRejectedWith = function(j$) {
'use strict';
/**
* Expect a promise to be rejected with a value equal to the expected, using deep equality comparison.
* @function

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toBeRejectedWithError = function(j$) {
'use strict';
/**
* Expect a promise to be rejected with a value matched to the expected
* @function

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toBeResolved = function(j$) {
'use strict';
/**
* Expect a promise to be resolved.
* @function

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toBeResolvedTo = function(j$) {
'use strict';
/**
* Expect a promise to be resolved to a value equal to the expected, using deep equality comparison.
* @function

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().MatchersUtil = function(j$) {
'use strict';
/**
* @class MatchersUtil
* @classdesc Utilities for use in implementing matchers.<br>

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().nothing = function() {
'use strict';
/**
* {@link expect} nothing explicitly.
* @function

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().requireAsyncMatchers = function(jRequire, j$) {
'use strict';
const availableMatchers = [
'toBePending',
'toBeResolved',

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().requireMatchers = function(jRequire, j$) {
'use strict';
const availableMatchers = [
'nothing',
'toBe',

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toBe = function(j$) {
'use strict';
/**
* {@link expect} the actual value to be `===` to the expected value.
* @function

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toBeCloseTo = function() {
'use strict';
/**
* {@link expect} the actual value to be within a specified precision of the expected value.
* @function

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toBeDefined = function() {
'use strict';
/**
* {@link expect} the actual value to be defined. (Not `undefined`)
* @function

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toBeFalse = function() {
'use strict';
/**
* {@link expect} the actual value to be `false`.
* @function

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toBeFalsy = function() {
'use strict';
/**
* {@link expect} the actual value to be falsy
* @function

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toBeGreaterThan = function() {
'use strict';
/**
* {@link expect} the actual value to be greater than the expected value.
* @function

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toBeGreaterThanOrEqual = function() {
'use strict';
/**
* {@link expect} the actual value to be greater than or equal to the expected value.
* @function

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toBeInstanceOf = function(j$) {
'use strict';
const usageError = j$.private.formatErrorMsg(
'<toBeInstanceOf>',
'expect(value).toBeInstanceOf(<ConstructorFunction>)'

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toBeLessThan = function() {
'use strict';
/**
* {@link expect} the actual value to be less than the expected value.
* @function

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toBeLessThanOrEqual = function() {
'use strict';
/**
* {@link expect} the actual value to be less than or equal to the expected value.
* @function

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toBeNaN = function(j$) {
'use strict';
/**
* {@link expect} the actual value to be `NaN` (Not a Number).
* @function

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toBeNegativeInfinity = function(j$) {
'use strict';
/**
* {@link expect} the actual value to be `-Infinity` (-infinity).
* @function

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toBeNull = function() {
'use strict';
/**
* {@link expect} the actual value to be `null`.
* @function

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toBeNullish = function() {
'use strict';
/**
* {@link expect} the actual value to be `null` or `undefined`.
* @function

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toBePositiveInfinity = function(j$) {
'use strict';
/**
* {@link expect} the actual value to be `Infinity` (infinity).
* @function

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toBeTrue = function() {
'use strict';
/**
* {@link expect} the actual value to be `true`.
* @function

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toBeTruthy = function() {
'use strict';
/**
* {@link expect} the actual value to be truthy.
* @function

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toBeUndefined = function() {
'use strict';
/**
* {@link expect} the actual value to be `undefined`.
* @function

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toContain = function() {
'use strict';
/**
* {@link expect} the actual value to contain a specific value.
* @function

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toEqual = function(j$) {
'use strict';
/**
* {@link expect} the actual value to be equal to the expected, using deep equality comparison.
* @function

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toHaveBeenCalled = function(j$) {
'use strict';
const getErrorMsg = j$.private.formatErrorMsg(
'<toHaveBeenCalled>',
'expect(<spyObj>).toHaveBeenCalled()'

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toHaveBeenCalledBefore = function(j$) {
'use strict';
const getErrorMsg = j$.private.formatErrorMsg(
'<toHaveBeenCalledBefore>',
'expect(<spyObj>).toHaveBeenCalledBefore(<spyObj>)'

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toHaveBeenCalledOnceWith = function(j$) {
'use strict';
const getErrorMsg = j$.private.formatErrorMsg(
'<toHaveBeenCalledOnceWith>',
'expect(<spyObj>).toHaveBeenCalledOnceWith(...arguments)'

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toHaveBeenCalledTimes = function(j$) {
'use strict';
const getErrorMsg = j$.private.formatErrorMsg(
'<toHaveBeenCalledTimes>',
'expect(<spyObj>).toHaveBeenCalledTimes(<Number>)'

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toHaveBeenCalledWith = function(j$) {
'use strict';
const getErrorMsg = j$.private.formatErrorMsg(
'<toHaveBeenCalledWith>',
'expect(<spyObj>).toHaveBeenCalledWith(...arguments)'

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toHaveClass = function(j$) {
'use strict';
/**
* {@link expect} the actual value to be a DOM element that has the expected class
* @function

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toHaveClasses = function(j$) {
'use strict';
/**
* {@link expect} the actual value to be a DOM element that has the expected classes
* @function

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toHaveNoOtherSpyInteractions = function(j$) {
'use strict';
const getErrorMsg = j$.private.formatErrorMsg(
'<toHaveNoOtherSpyInteractions>',
'expect(<spyObj>).toHaveNoOtherSpyInteractions()'

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toHaveSize = function(j$) {
'use strict';
/**
* {@link expect} the actual size to be equal to the expected, using array-like length or object keys size.
* @function

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toHaveSpyInteractions = function(j$) {
'use strict';
const getErrorMsg = j$.private.formatErrorMsg(
'<toHaveSpyInteractions>',
'expect(<spyObj>).toHaveSpyInteractions()'

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toMatch = function(j$) {
'use strict';
const getErrorMsg = j$.private.formatErrorMsg(
'<toMatch>',
'expect(<expectation>).toMatch(<string> || <regexp>)'

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toThrow = function(j$) {
'use strict';
const getErrorMsg = j$.private.formatErrorMsg(
'<toThrow>',
'expect(function() {<expectation>}).toThrow()'

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toThrowError = function(j$) {
'use strict';
const getErrorMsg = j$.private.formatErrorMsg(
'<toThrowError>',
'expect(function() {<expectation>}).toThrowError(<ErrorConstructor>, <message>)'

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().toThrowMatching = function(j$) {
'use strict';
const usageError = j$.private.formatErrorMsg(
'<toThrowMatching>',
'expect(function() {<expectation>}).toThrowMatching(<Predicate>)'

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().reporterEvents = function(j$) {
'use strict';
/**
* Used to tell Jasmine what optional or uncommonly implemented features
* the reporter supports. If not specified, the defaults described in

Some files were not shown because too many files have changed in this diff Show More