MCPcopy Create free account
hub / github.com/easydiffusion/easydiffusion / JsApiReporter

Function JsApiReporter

ui/plugins/ui/jasmine/jasmine.js:1936–2054  ·  view source on GitHub ↗

* @name jsApiReporter * @classdesc 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

(options)

Source from the content-addressed store, hash-verified

1934 * @hideconstructor
1935 */
1936 function JsApiReporter(options) {
1937 const timer = options.timer || new j$.Timer()
1938 let status = "loaded"
1939
1940 this.started = false
1941 this.finished = false
1942 this.runDetails = {}
1943
1944 this.jasmineStarted = function() {
1945 this.started = true
1946 status = "started"
1947 timer.start()
1948 }
1949
1950 let executionTime
1951
1952 this.jasmineDone = function(runDetails) {
1953 this.finished = true
1954 this.runDetails = runDetails
1955 executionTime = timer.elapsed()
1956 status = "done"
1957 }
1958
1959 /**
1960 * Get the current status for the Jasmine environment.
1961 * @name jsApiReporter#status
1962 * @since 2.0.0
1963 * @function
1964 * @return {String} - One of `loaded`, `started`, or `done`
1965 */
1966 this.status = function() {
1967 return status
1968 }
1969
1970 const suites = [],
1971 suites_hash = {}
1972
1973 this.suiteStarted = function(result) {
1974 suites_hash[result.id] = result
1975 }
1976
1977 this.suiteDone = function(result) {
1978 storeSuite(result)
1979 }
1980
1981 /**
1982 * Get the results for a set of suites.
1983 *
1984 * Retrievable in slices for easier serialization.
1985 * @name jsApiReporter#suiteResults
1986 * @since 2.1.0
1987 * @function
1988 * @param {Number} index - The position in the suites list to start from.
1989 * @param {Number} length - Maximum number of suite results to return.
1990 * @return {SuiteResult[]}
1991 */
1992 this.suiteResults = function(index, length) {
1993 return suites.slice(index, index + length)

Callers

nothing calls this directly

Calls 3

storeSuiteFunction · 0.85
pushMethod · 0.80
startMethod · 0.45

Tested by

no test coverage detected