jasmine-core
Advanced tools
@@ -45,19 +45,2 @@ /* | ||
| /** | ||
| * ## 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). | ||
| */ | ||
| const htmlReporter = new jasmine.HtmlReporterV2({ | ||
| env, | ||
| urls, | ||
| getContainer() { | ||
| return document.body; | ||
| } | ||
| }); | ||
| /** | ||
| * The `jsApiReporter` also receives spec results, and is used by any environment that needs to extract the results from JavaScript. | ||
| */ | ||
| env.addReporter(jsApiReporter); | ||
| env.addReporter(htmlReporter); | ||
| /** | ||
| * Configures Jasmine based on the current set of query parameters. This | ||
@@ -70,16 +53,9 @@ * supports all parameters set by the HTML reporter as well as | ||
| /** | ||
| * ## Execution | ||
| * | ||
| * 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. | ||
| */ | ||
| const currentWindowOnload = window.onload; | ||
| window.onload = function() { | ||
| if (currentWindowOnload) { | ||
| currentWindowOnload(); | ||
| } | ||
| htmlReporter.initialize(); | ||
| window.addEventListener('load', function() { | ||
| // The HTML reporter needs to be set up here so it can access the DOM. Other | ||
| // reporters can be added at any time before env.execute() is called. | ||
| const htmlReporter = new jasmine.HtmlReporterV2({ env, urls }); | ||
| env.addReporter(htmlReporter); | ||
| env.execute(); | ||
| }; | ||
| }); | ||
| })(); |
@@ -312,3 +312,4 @@ /* | ||
| function HtmlSpecFilter(options) { | ||
| j$.getEnv().deprecated( | ||
| const env = options?.env ?? j$.getEnv(); | ||
| env.deprecated( | ||
| 'HtmlReporter and HtmlSpecFilter are deprecated. Use HtmlReporterV2 instead.' | ||
@@ -319,2 +320,3 @@ ); | ||
| options && | ||
| options.filterString && | ||
| options.filterString() && | ||
@@ -477,41 +479,2 @@ options.filterString().replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); | ||
| // TODO: remove this once HtmlReporterV2 doesn't use it | ||
| addFailureToggle(onClickFailures, onClickSpecList) { | ||
| const failuresLink = createDom( | ||
| 'a', | ||
| { className: 'jasmine-failures-menu', href: '#' }, | ||
| 'Failures' | ||
| ); | ||
| let specListLink = createDom( | ||
| 'a', | ||
| { className: 'jasmine-spec-list-menu', href: '#' }, | ||
| 'Spec List' | ||
| ); | ||
| failuresLink.onclick = function() { | ||
| onClickFailures(); | ||
| return false; | ||
| }; | ||
| specListLink.onclick = function() { | ||
| onClickSpecList(); | ||
| return false; | ||
| }; | ||
| this.rootEl.appendChild( | ||
| createDom( | ||
| 'span', | ||
| { className: 'jasmine-menu jasmine-bar jasmine-spec-list' }, | ||
| [createDom('span', {}, 'Spec List | '), failuresLink] | ||
| ) | ||
| ); | ||
| this.rootEl.appendChild( | ||
| createDom( | ||
| 'span', | ||
| { className: 'jasmine-menu jasmine-bar jasmine-failure-list' }, | ||
| [specListLink, createDom('span', {}, ' | Failures ')] | ||
| ) | ||
| ); | ||
| } | ||
| addGlobalFailure(failure) { | ||
@@ -946,3 +909,3 @@ this.#createAndAdd( | ||
| if (j$.private.isArray(childrenArrayOrVarArgs)) { | ||
| if (Array.isArray(childrenArrayOrVarArgs)) { | ||
| children = childrenArrayOrVarArgs; | ||
@@ -1014,8 +977,8 @@ } else { | ||
| * urls, | ||
| * getContainer: () => document.body | ||
| * // container is optional and defaults to document.body. | ||
| * container: someElement | ||
| * }); | ||
| */ | ||
| class HtmlReporterV2 { | ||
| #env; | ||
| #getContainer; | ||
| #container; | ||
| #queryString; | ||
@@ -1037,5 +1000,3 @@ #urlBuilder; | ||
| constructor(options) { | ||
| this.#env = options.env; | ||
| this.#getContainer = options.getContainer; | ||
| this.#container = options.container || document.body; | ||
| this.#queryString = | ||
@@ -1053,12 +1014,4 @@ options.queryString || | ||
| this.#filterSpecs = options.urls.filteringSpecs(); | ||
| } | ||
| /** | ||
| * Initializes the reporter. Should be called before {@link Env#execute}. | ||
| * @function | ||
| * @name HtmlReporter#initialize | ||
| */ | ||
| initialize() { | ||
| this.#clearPrior(); | ||
| this.#config = this.#env ? this.#env.configuration() : {}; | ||
| this.#config = options.env ? options.env.configuration() : {}; | ||
@@ -1104,3 +1057,3 @@ this.#stateBuilder = new j$.private.ResultsStateBuilder(); | ||
| ); | ||
| this.#getContainer().appendChild(this.#htmlReporterMain); | ||
| this.#container.appendChild(this.#htmlReporterMain); | ||
| this.#failures.show(); | ||
@@ -1111,3 +1064,5 @@ } | ||
| this.#stateBuilder.jasmineStarted(options); | ||
| this.#progress.start(options.totalSpecsDefined); | ||
| this.#progress.start( | ||
| options.totalSpecsDefined - options.numExcludedSpecs | ||
| ); | ||
| } | ||
@@ -1197,3 +1152,3 @@ | ||
| #find(selector) { | ||
| return this.#getContainer().querySelector( | ||
| return this.#container.querySelector( | ||
| '.jasmine_html-reporter ' + selector | ||
@@ -1203,10 +1158,2 @@ ); | ||
| #clearPrior() { | ||
| const oldReporter = this.#find(''); | ||
| if (oldReporter) { | ||
| this.#getContainer().removeChild(oldReporter); | ||
| } | ||
| } | ||
| #setMenuModeTo(mode) { | ||
@@ -1230,3 +1177,5 @@ this.#htmlReporterMain.setAttribute( | ||
| specDone(result) { | ||
| this.rootEl.value = this.rootEl.value + 1; | ||
| if (result.status !== 'excluded') { | ||
| this.rootEl.value = this.rootEl.value + 1; | ||
| } | ||
@@ -1233,0 +1182,0 @@ if (result.status === 'failed') { |
+1
-1
| { | ||
| "name": "jasmine-core", | ||
| "license": "MIT", | ||
| "version": "6.0.0-alpha.2", | ||
| "version": "6.0.0-beta.0", | ||
| "repository": { | ||
@@ -6,0 +6,0 @@ "type": "git", |
Sorry, the diff of this file is too big to display
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
457613
0.19%13096
0.09%