rm deprecated jsApiReporter

This commit is contained in:
Steve Gravrock
2025-11-27 11:22:27 -08:00
parent 876de65803
commit 03006080d4
7 changed files with 0 additions and 458 deletions

View File

@@ -71,7 +71,6 @@ var getJasmineRequireObj = (function() {
j$.private.Expector = jRequire.Expector(j$);
j$.private.Expectation = jRequire.Expectation(j$);
j$.private.buildExpectationResult = jRequire.buildExpectationResult(j$);
j$.private.JsApiReporter = jRequire.JsApiReporter(j$);
j$.private.makePrettyPrinter = jRequire.makePrettyPrinter(j$);
j$.private.basicPrettyPrinter = j$.private.makePrettyPrinter();
j$.private.MatchersUtil = jRequire.MatchersUtil(j$);
@@ -2075,140 +2074,6 @@ getJasmineRequireObj().Env = function(j$) {
return Env;
};
getJasmineRequireObj().JsApiReporter = function(j$) {
'use strict';
// TODO: remove in 7.0.
/**
* @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.
* @class
* @hideconstructor
* @deprecated In most cases jsApiReporter can simply be removed. If necessary, it can be replaced with a {@link Reporter|custom reporter}.
*/
function JsApiReporter(options) {
const timer = options.timer || new j$.Timer();
let status = 'loaded';
this.started = false;
this.finished = false;
this.runDetails = {};
this.jasmineStarted = function() {
this.started = true;
status = 'started';
timer.start();
};
let executionTime;
this.jasmineDone = function(runDetails) {
this.finished = true;
this.runDetails = runDetails;
executionTime = timer.elapsed();
status = 'done';
};
/**
* Get the current status for the Jasmine environment.
* @name jsApiReporter#status
* @since 2.0.0
* @function
* @return {String} - One of `loaded`, `started`, or `done`
*/
this.status = function() {
return status;
};
const suites = [],
suites_hash = {};
this.suiteStarted = function(result) {
suites_hash[result.id] = result;
};
this.suiteDone = function(result) {
storeSuite(result);
};
/**
* Get the results for a set of suites.
*
* Retrievable in slices for easier serialization.
* @name jsApiReporter#suiteResults
* @since 2.1.0
* @function
* @param {Number} index - The position in the suites list to start from.
* @param {Number} length - Maximum number of suite results to return.
* @return {SuiteResult[]}
*/
this.suiteResults = function(index, length) {
return suites.slice(index, index + length);
};
function storeSuite(result) {
suites.push(result);
suites_hash[result.id] = result;
}
/**
* Get all of the suites in a single object, with their `id` as the key.
* @name jsApiReporter#suites
* @since 2.0.0
* @function
* @return {Object} - Map of suite id to {@link SuiteResult}
*/
this.suites = function() {
return suites_hash;
};
const specs = [];
this.specDone = function(result) {
specs.push(result);
};
/**
* Get the results for a set of specs.
*
* Retrievable in slices for easier serialization.
* @name jsApiReporter#specResults
* @since 2.0.0
* @function
* @param {Number} index - The position in the specs list to start from.
* @param {Number} length - Maximum number of specs results to return.
* @return {SpecDoneEvent[]}
*/
this.specResults = function(index, length) {
return specs.slice(index, index + length);
};
/**
* Get all spec results.
* @name jsApiReporter#specs
* @since 2.0.0
* @function
* @return {SpecDoneEvent[]}
*/
this.specs = function() {
return specs;
};
/**
* Get the number of milliseconds it took for the full Jasmine suite to run.
* @name jsApiReporter#executionTime
* @since 2.0.0
* @function
* @return {Number}
*/
this.executionTime = function() {
return executionTime;
};
}
return JsApiReporter;
};
getJasmineRequireObj().AllOf = function(j$) {
'use strict';
@@ -9367,10 +9232,6 @@ getJasmineRequireObj().interface = function(jasmine, env) {
return env.spyOnAllFunctions(obj, includeNonEnumerable);
},
jsApiReporter: new jasmine.private.JsApiReporter({
timer: new jasmine.Timer()
}),
/**
* <p>Members of the jasmine global.</p>
* <p>Note: The members of the

View File

@@ -51,7 +51,6 @@ function concatFiles() {
'src/core/Spec.js',
'src/core/Order.js',
'src/core/Env.js',
'src/core/JsApiReporter.js',
'src/core/PrettyPrinter',
'src/core/Suite',
'src/core/**/*.js',

View File

@@ -1,179 +0,0 @@
describe('JsApiReporter', function() {
it('knows when a full environment is started', function() {
const reporter = new privateUnderTest.JsApiReporter({});
expect(reporter.started).toBe(false);
expect(reporter.finished).toBe(false);
reporter.jasmineStarted();
expect(reporter.started).toBe(true);
expect(reporter.finished).toBe(false);
});
it('knows when a full environment is done', function() {
const reporter = new privateUnderTest.JsApiReporter({});
expect(reporter.started).toBe(false);
expect(reporter.finished).toBe(false);
reporter.jasmineStarted();
reporter.jasmineDone({});
expect(reporter.finished).toBe(true);
});
it("defaults to 'loaded' status", function() {
const reporter = new privateUnderTest.JsApiReporter({});
expect(reporter.status()).toEqual('loaded');
});
it("reports 'started' when Jasmine has started", function() {
const reporter = new privateUnderTest.JsApiReporter({});
reporter.jasmineStarted();
expect(reporter.status()).toEqual('started');
});
it("reports 'done' when Jasmine is done", function() {
const reporter = new privateUnderTest.JsApiReporter({});
reporter.jasmineDone({});
expect(reporter.status()).toEqual('done');
});
it('tracks a suite', function() {
const reporter = new privateUnderTest.JsApiReporter({});
reporter.suiteStarted({
id: 123,
description: 'A suite'
});
const suites = reporter.suites();
expect(suites).toEqual({ 123: { id: 123, description: 'A suite' } });
reporter.suiteDone({
id: 123,
description: 'A suite',
status: 'passed'
});
expect(suites).toEqual({
123: { id: 123, description: 'A suite', status: 'passed' }
});
});
describe('#specResults', function() {
let reporter, specResult1, specResult2;
beforeEach(function() {
reporter = new privateUnderTest.JsApiReporter({});
specResult1 = {
id: 1,
description: 'A spec'
};
specResult2 = {
id: 2,
description: 'Another spec'
};
reporter.specDone(specResult1);
reporter.specDone(specResult2);
});
it('should return a slice of results', function() {
expect(reporter.specResults(0, 1)).toEqual([specResult1]);
expect(reporter.specResults(1, 1)).toEqual([specResult2]);
});
describe('when the results do not exist', function() {
it('should return a slice of shorter length', function() {
expect(reporter.specResults(0, 3)).toEqual([specResult1, specResult2]);
expect(reporter.specResults(2, 3)).toEqual([]);
});
});
});
describe('#suiteResults', function() {
let reporter, suiteStarted1, suiteResult1, suiteResult2;
beforeEach(function() {
reporter = new privateUnderTest.JsApiReporter({});
suiteStarted1 = {
id: 1
};
suiteResult1 = {
id: 1,
status: 'failed',
failedExpectations: [{ message: 'My After All Exception' }]
};
suiteResult2 = {
id: 2,
status: 'passed'
};
reporter.suiteStarted(suiteStarted1);
reporter.suiteDone(suiteResult1);
reporter.suiteDone(suiteResult2);
});
it('should not include suite starts', function() {
expect(reporter.suiteResults(0, 3).length).toEqual(2);
});
it('should return a slice of results', function() {
expect(reporter.suiteResults(0, 1)).toEqual([suiteResult1]);
expect(reporter.suiteResults(1, 1)).toEqual([suiteResult2]);
});
it('returns nothing for out of bounds indices', function() {
expect(reporter.suiteResults(0, 3)).toEqual([suiteResult1, suiteResult2]);
expect(reporter.suiteResults(2, 3)).toEqual([]);
});
});
describe('#executionTime', function() {
it('should start the timer when jasmine starts', function() {
const timerSpy = jasmine.createSpyObj('timer', ['start', 'elapsed']),
reporter = new privateUnderTest.JsApiReporter({
timer: timerSpy
});
reporter.jasmineStarted();
expect(timerSpy.start).toHaveBeenCalled();
});
it('should return the time it took the specs to run, in ms', function() {
const timerSpy = jasmine.createSpyObj('timer', ['start', 'elapsed']),
reporter = new privateUnderTest.JsApiReporter({
timer: timerSpy
});
timerSpy.elapsed.and.returnValue(1000);
reporter.jasmineDone();
expect(reporter.executionTime()).toEqual(1000);
});
describe("when the specs haven't finished being run", function() {
it('should return undefined', function() {
const timerSpy = jasmine.createSpyObj('timer', ['start', 'elapsed']),
reporter = new privateUnderTest.JsApiReporter({
timer: timerSpy
});
expect(reporter.executionTime()).toBeUndefined();
});
});
});
describe('#runDetails', function() {
it('should have details about the run', function() {
const reporter = new privateUnderTest.JsApiReporter({});
reporter.jasmineDone({ some: { run: 'details' } });
expect(reporter.runDetails).toEqual({ some: { run: 'details' } });
});
});
});

View File

@@ -7,7 +7,6 @@ module.exports = {
'core/util.js',
'core/Spec.js',
'core/Env.js',
'core/JsApiReporter.js',
'core/PrettyPrinter.js',
'core/Suite.js',
'core/**/*.js',

View File

@@ -1,133 +0,0 @@
getJasmineRequireObj().JsApiReporter = function(j$) {
'use strict';
// TODO: remove in 7.0.
/**
* @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.
* @class
* @hideconstructor
* @deprecated In most cases jsApiReporter can simply be removed. If necessary, it can be replaced with a {@link Reporter|custom reporter}.
*/
function JsApiReporter(options) {
const timer = options.timer || new j$.Timer();
let status = 'loaded';
this.started = false;
this.finished = false;
this.runDetails = {};
this.jasmineStarted = function() {
this.started = true;
status = 'started';
timer.start();
};
let executionTime;
this.jasmineDone = function(runDetails) {
this.finished = true;
this.runDetails = runDetails;
executionTime = timer.elapsed();
status = 'done';
};
/**
* Get the current status for the Jasmine environment.
* @name jsApiReporter#status
* @since 2.0.0
* @function
* @return {String} - One of `loaded`, `started`, or `done`
*/
this.status = function() {
return status;
};
const suites = [],
suites_hash = {};
this.suiteStarted = function(result) {
suites_hash[result.id] = result;
};
this.suiteDone = function(result) {
storeSuite(result);
};
/**
* Get the results for a set of suites.
*
* Retrievable in slices for easier serialization.
* @name jsApiReporter#suiteResults
* @since 2.1.0
* @function
* @param {Number} index - The position in the suites list to start from.
* @param {Number} length - Maximum number of suite results to return.
* @return {SuiteResult[]}
*/
this.suiteResults = function(index, length) {
return suites.slice(index, index + length);
};
function storeSuite(result) {
suites.push(result);
suites_hash[result.id] = result;
}
/**
* Get all of the suites in a single object, with their `id` as the key.
* @name jsApiReporter#suites
* @since 2.0.0
* @function
* @return {Object} - Map of suite id to {@link SuiteResult}
*/
this.suites = function() {
return suites_hash;
};
const specs = [];
this.specDone = function(result) {
specs.push(result);
};
/**
* Get the results for a set of specs.
*
* Retrievable in slices for easier serialization.
* @name jsApiReporter#specResults
* @since 2.0.0
* @function
* @param {Number} index - The position in the specs list to start from.
* @param {Number} length - Maximum number of specs results to return.
* @return {SpecDoneEvent[]}
*/
this.specResults = function(index, length) {
return specs.slice(index, index + length);
};
/**
* Get all spec results.
* @name jsApiReporter#specs
* @since 2.0.0
* @function
* @return {SpecDoneEvent[]}
*/
this.specs = function() {
return specs;
};
/**
* Get the number of milliseconds it took for the full Jasmine suite to run.
* @name jsApiReporter#executionTime
* @since 2.0.0
* @function
* @return {Number}
*/
this.executionTime = function() {
return executionTime;
};
}
return JsApiReporter;
};

View File

@@ -47,7 +47,6 @@ var getJasmineRequireObj = (function() {
j$.private.Expector = jRequire.Expector(j$);
j$.private.Expectation = jRequire.Expectation(j$);
j$.private.buildExpectationResult = jRequire.buildExpectationResult(j$);
j$.private.JsApiReporter = jRequire.JsApiReporter(j$);
j$.private.makePrettyPrinter = jRequire.makePrettyPrinter(j$);
j$.private.basicPrettyPrinter = j$.private.makePrettyPrinter();
j$.private.MatchersUtil = jRequire.MatchersUtil(j$);

View File

@@ -354,10 +354,6 @@ getJasmineRequireObj().interface = function(jasmine, env) {
return env.spyOnAllFunctions(obj, includeNonEnumerable);
},
jsApiReporter: new jasmine.private.JsApiReporter({
timer: new jasmine.Timer()
}),
/**
* <p>Members of the jasmine global.</p>
* <p>Note: The members of the