jasmine-core
Advanced tools
Comparing version 4.2.0 to 4.3.0
@@ -40,12 +40,12 @@ /** | ||
var path = require('path'), | ||
fs = require('fs'); | ||
const path = require('path'), | ||
fs = require('fs'); | ||
var rootPath = path.join(__dirname, "jasmine-core"), | ||
bootFiles = ['boot0.js', 'boot1.js'], | ||
legacyBootFiles = ['boot.js'], | ||
nodeBootFiles = ['node_boot.js'], | ||
cssFiles = [], | ||
jsFiles = [], | ||
jsFilesToSkip = ['jasmine.js'].concat(bootFiles, legacyBootFiles, nodeBootFiles); | ||
const rootPath = path.join(__dirname, 'jasmine-core'), | ||
bootFiles = ['boot0.js', 'boot1.js'], | ||
legacyBootFiles = ['boot.js'], | ||
nodeBootFiles = ['node_boot.js'], | ||
cssFiles = [], | ||
jsFiles = [], | ||
jsFilesToSkip = ['jasmine.js'].concat(bootFiles, legacyBootFiles, nodeBootFiles); | ||
@@ -52,0 +52,0 @@ fs.readdirSync(rootPath).forEach(function(file) { |
@@ -30,3 +30,3 @@ /* | ||
(function() { | ||
var jasmineRequire = window.jasmineRequire || require('./jasmine.js'); | ||
const jasmineRequire = window.jasmineRequire || require('./jasmine.js'); | ||
@@ -38,3 +38,3 @@ /** | ||
*/ | ||
var jasmine = jasmineRequire.core(jasmineRequire), | ||
const jasmine = jasmineRequire.core(jasmineRequire), | ||
global = jasmine.getGlobal(); | ||
@@ -51,3 +51,3 @@ global.jasmine = jasmine; | ||
*/ | ||
var env = jasmine.getEnv(); | ||
const env = jasmine.getEnv(); | ||
@@ -59,3 +59,3 @@ /** | ||
*/ | ||
var jasmineInterface = jasmineRequire.interface(jasmine, env); | ||
const jasmineInterface = jasmineRequire.interface(jasmine, env); | ||
@@ -65,5 +65,5 @@ /** | ||
*/ | ||
for (var property in jasmineInterface) { | ||
for (const property in jasmineInterface) { | ||
global[property] = jasmineInterface[property]; | ||
} | ||
})(); |
@@ -37,3 +37,3 @@ /* | ||
(function() { | ||
var env = jasmine.getEnv(); | ||
const env = jasmine.getEnv(); | ||
@@ -46,3 +46,3 @@ /** | ||
var queryString = new jasmine.QueryString({ | ||
const queryString = new jasmine.QueryString({ | ||
getWindowLocation: function() { | ||
@@ -53,5 +53,5 @@ return window.location; | ||
var filterSpecs = !!queryString.getParam('spec'); | ||
const filterSpecs = !!queryString.getParam('spec'); | ||
var config = { | ||
const config = { | ||
stopOnSpecFailure: queryString.getParam('stopOnSpecFailure'), | ||
@@ -64,3 +64,3 @@ stopSpecOnExpectationFailure: queryString.getParam( | ||
var random = queryString.getParam('random'); | ||
const random = queryString.getParam('random'); | ||
@@ -71,3 +71,3 @@ if (random !== undefined && random !== '') { | ||
var seed = queryString.getParam('seed'); | ||
const seed = queryString.getParam('seed'); | ||
if (seed) { | ||
@@ -81,3 +81,3 @@ config.seed = seed; | ||
*/ | ||
var htmlReporter = new jasmine.HtmlReporter({ | ||
const htmlReporter = new jasmine.HtmlReporter({ | ||
env: env, | ||
@@ -112,3 +112,3 @@ navigateWithNewParam: function(key, value) { | ||
*/ | ||
var specFilter = new jasmine.HtmlSpecFilter({ | ||
const specFilter = new jasmine.HtmlSpecFilter({ | ||
filterString: function() { | ||
@@ -130,3 +130,3 @@ return queryString.getParam('spec'); | ||
*/ | ||
var currentWindowOnload = window.onload; | ||
const currentWindowOnload = window.onload; | ||
@@ -133,0 +133,0 @@ window.onload = function() { |
@@ -23,2 +23,3 @@ /* | ||
*/ | ||
// eslint-disable-next-line no-var | ||
var jasmineRequire = window.jasmineRequire || require('./jasmine.js'); | ||
@@ -83,16 +84,18 @@ | ||
function HtmlReporter(options) { | ||
var config = function() { | ||
return (options.env && options.env.configuration()) || {}; | ||
}, | ||
getContainer = options.getContainer, | ||
createElement = options.createElement, | ||
createTextNode = options.createTextNode, | ||
navigateWithNewParam = options.navigateWithNewParam || function() {}, | ||
addToExistingQueryString = | ||
options.addToExistingQueryString || defaultQueryString, | ||
filterSpecs = options.filterSpecs, | ||
htmlReporterMain, | ||
symbols, | ||
deprecationWarnings = []; | ||
function config() { | ||
return (options.env && options.env.configuration()) || {}; | ||
} | ||
const getContainer = options.getContainer; | ||
const createElement = options.createElement; | ||
const createTextNode = options.createTextNode; | ||
const navigateWithNewParam = options.navigateWithNewParam || function() {}; | ||
const addToExistingQueryString = | ||
options.addToExistingQueryString || defaultQueryString; | ||
const filterSpecs = options.filterSpecs; | ||
let htmlReporterMain; | ||
let symbols; | ||
const deprecationWarnings = []; | ||
const failures = []; | ||
this.initialize = function() { | ||
@@ -124,3 +127,3 @@ clearPrior(); | ||
var totalSpecsDefined; | ||
let totalSpecsDefined; | ||
this.jasmineStarted = function(options) { | ||
@@ -130,5 +133,5 @@ totalSpecsDefined = options.totalSpecsDefined || 0; | ||
var summary = createDom('div', { className: 'jasmine-summary' }); | ||
const summary = createDom('div', { className: 'jasmine-summary' }); | ||
var stateBuilder = new ResultsStateBuilder(); | ||
const stateBuilder = new ResultsStateBuilder(); | ||
@@ -152,3 +155,2 @@ this.suiteStarted = function(result) { | ||
var failures = []; | ||
this.specDone = function(result) { | ||
@@ -158,3 +160,3 @@ stateBuilder.specDone(result); | ||
if (noExpectations(result)) { | ||
var noSpecMsg = "Spec '" + result.fullName + "' has no expectations."; | ||
const noSpecMsg = "Spec '" + result.fullName + "' has no expectations."; | ||
if (result.status === 'failed') { | ||
@@ -203,6 +205,6 @@ console.error(noSpecMsg); | ||
stateBuilder.jasmineDone(doneResult); | ||
var banner = find('.jasmine-banner'); | ||
var alert = find('.jasmine-alert'); | ||
var order = doneResult && doneResult.order; | ||
var i; | ||
const banner = find('.jasmine-banner'); | ||
const alert = find('.jasmine-alert'); | ||
const order = doneResult && doneResult.order; | ||
alert.appendChild( | ||
@@ -219,3 +221,3 @@ createDom( | ||
if (stateBuilder.specsExecuted < totalSpecsDefined) { | ||
var skippedMessage = | ||
const skippedMessage = | ||
'Ran ' + | ||
@@ -227,3 +229,3 @@ stateBuilder.specsExecuted + | ||
// include window.location.pathname to fix issue with karma-jasmine-html-reporter in angular: see https://github.com/jasmine/jasmine/issues/1906 | ||
var skippedLink = | ||
const skippedLink = | ||
(window.location.pathname || '') + | ||
@@ -243,6 +245,7 @@ addToExistingQueryString('spec', ''); | ||
} | ||
var statusBarMessage = ''; | ||
var statusBarClassName = 'jasmine-overall-result jasmine-bar '; | ||
var globalFailures = (doneResult && doneResult.failedExpectations) || []; | ||
var failed = stateBuilder.failureCount + globalFailures.length > 0; | ||
let statusBarMessage = ''; | ||
let statusBarClassName = 'jasmine-overall-result jasmine-bar '; | ||
const globalFailures = | ||
(doneResult && doneResult.failedExpectations) || []; | ||
const failed = stateBuilder.failureCount + globalFailures.length > 0; | ||
@@ -273,3 +276,3 @@ if (totalSpecsDefined > 0 || failed) { | ||
var seedBar; | ||
let seedBar; | ||
if (order && order.random) { | ||
@@ -300,6 +303,6 @@ seedBar = createDom( | ||
var errorBarClassName = 'jasmine-bar jasmine-errored'; | ||
var afterAllMessagePrefix = 'AfterAll '; | ||
const errorBarClassName = 'jasmine-bar jasmine-errored'; | ||
const afterAllMessagePrefix = 'AfterAll '; | ||
for (i = 0; i < globalFailures.length; i++) { | ||
for (let i = 0; i < globalFailures.length; i++) { | ||
alert.appendChild( | ||
@@ -316,3 +319,3 @@ createDom( | ||
if (failure.globalErrorType === 'load') { | ||
var prefix = 'Error during loading: ' + failure.message; | ||
const prefix = 'Error during loading: ' + failure.message; | ||
@@ -335,5 +338,5 @@ if (failure.filename) { | ||
for (i = 0; i < deprecationWarnings.length; i++) { | ||
var children = [], | ||
context; | ||
for (let i = 0; i < deprecationWarnings.length; i++) { | ||
const children = []; | ||
let context; | ||
@@ -372,3 +375,3 @@ switch (deprecationWarnings[i].runnableType) { | ||
var results = find('.jasmine-results'); | ||
const results = find('.jasmine-results'); | ||
results.appendChild(summary); | ||
@@ -415,4 +418,4 @@ | ||
var failureNode = find('.jasmine-failures'); | ||
for (i = 0; i < failures.length; i++) { | ||
const failureNode = find('.jasmine-failures'); | ||
for (let i = 0; i < failures.length; i++) { | ||
failureNode.appendChild(failures[i]); | ||
@@ -426,3 +429,3 @@ } | ||
function failureDom(result) { | ||
var failure = createDom( | ||
const failure = createDom( | ||
'div', | ||
@@ -433,6 +436,6 @@ { className: 'jasmine-spec-detail jasmine-failed' }, | ||
); | ||
var messages = failure.childNodes[1]; | ||
const messages = failure.childNodes[1]; | ||
for (var i = 0; i < result.failedExpectations.length; i++) { | ||
var expectation = result.failedExpectations[i]; | ||
for (let i = 0; i < result.failedExpectations.length; i++) { | ||
const expectation = result.failedExpectations[i]; | ||
messages.appendChild( | ||
@@ -472,3 +475,3 @@ createDom( | ||
function debugLogTable(debugLogs) { | ||
var tbody = createDom('tbody'); | ||
const tbody = createDom('tbody'); | ||
@@ -513,5 +516,5 @@ debugLogs.forEach(function(entry) { | ||
function summaryList(resultsTree, domParent) { | ||
var specListNode; | ||
for (var i = 0; i < resultsTree.children.length; i++) { | ||
var resultNode = resultsTree.children[i]; | ||
let specListNode; | ||
for (let i = 0; i < resultsTree.children.length; i++) { | ||
const resultNode = resultsTree.children[i]; | ||
if (filterSpecs && !hasActiveSpec(resultNode)) { | ||
@@ -521,3 +524,3 @@ continue; | ||
if (resultNode.type === 'suite') { | ||
var suiteListNode = createDom( | ||
const suiteListNode = createDom( | ||
'ul', | ||
@@ -547,3 +550,3 @@ { className: 'jasmine-suite', id: 'suite-' + resultNode.result.id }, | ||
} | ||
var specDescription = resultNode.result.description; | ||
let specDescription = resultNode.result.description; | ||
if (noExpectations(resultNode.result)) { | ||
@@ -580,3 +583,3 @@ specDescription = 'SPEC HAS NO EXPECTATIONS ' + specDescription; | ||
function optionsMenu(config) { | ||
var optionsMenuDom = createDom( | ||
const optionsMenuDom = createDom( | ||
'div', | ||
@@ -647,3 +650,5 @@ { className: 'jasmine-run-options' }, | ||
var failFastCheckbox = optionsMenuDom.querySelector('#jasmine-fail-fast'); | ||
const failFastCheckbox = optionsMenuDom.querySelector( | ||
'#jasmine-fail-fast' | ||
); | ||
failFastCheckbox.checked = config.stopOnSpecFailure; | ||
@@ -654,3 +659,3 @@ failFastCheckbox.onclick = function() { | ||
var throwCheckbox = optionsMenuDom.querySelector( | ||
const throwCheckbox = optionsMenuDom.querySelector( | ||
'#jasmine-throw-failures' | ||
@@ -666,3 +671,3 @@ ); | ||
var randomCheckbox = optionsMenuDom.querySelector( | ||
const randomCheckbox = optionsMenuDom.querySelector( | ||
'#jasmine-random-order' | ||
@@ -675,3 +680,5 @@ ); | ||
var hideDisabled = optionsMenuDom.querySelector('#jasmine-hide-disabled'); | ||
const hideDisabled = optionsMenuDom.querySelector( | ||
'#jasmine-hide-disabled' | ||
); | ||
hideDisabled.checked = config.hideDisabled; | ||
@@ -682,3 +689,3 @@ hideDisabled.onclick = function() { | ||
var optionsTrigger = optionsMenuDom.querySelector('.jasmine-trigger'), | ||
const optionsTrigger = optionsMenuDom.querySelector('.jasmine-trigger'), | ||
optionsPayload = optionsMenuDom.querySelector('.jasmine-payload'), | ||
@@ -702,3 +709,3 @@ isOpen = /\bjasmine-open\b/; | ||
function failureDescription(result, suite) { | ||
var wrapper = createDom( | ||
const wrapper = createDom( | ||
'div', | ||
@@ -712,3 +719,3 @@ { className: 'jasmine-description' }, | ||
); | ||
var suiteLink; | ||
let suiteLink; | ||
@@ -731,3 +738,3 @@ while (suite && suite.parent) { | ||
function suiteHref(suite) { | ||
var els = []; | ||
const els = []; | ||
@@ -748,4 +755,4 @@ while (suite && suite.parent) { | ||
if (result && result.deprecationWarnings) { | ||
for (var i = 0; i < result.deprecationWarnings.length; i++) { | ||
var warning = result.deprecationWarnings[i].message; | ||
for (let i = 0; i < result.deprecationWarnings.length; i++) { | ||
const warning = result.deprecationWarnings[i].message; | ||
deprecationWarnings.push({ | ||
@@ -762,4 +769,4 @@ message: warning, | ||
function createExpander(stackTrace) { | ||
var expandLink = createDom('a', { href: '#' }, 'Show stack trace'); | ||
var root = createDom( | ||
const expandLink = createDom('a', { href: '#' }, 'Show stack trace'); | ||
const root = createDom( | ||
'div', | ||
@@ -795,4 +802,3 @@ { className: 'jasmine-expander' }, | ||
function clearPrior() { | ||
// return the reporter | ||
var oldReporter = find(''); | ||
const oldReporter = find(''); | ||
@@ -805,5 +811,4 @@ if (oldReporter) { | ||
function createDom(type, attrs, childrenArrayOrVarArgs) { | ||
var el = createElement(type), | ||
children, | ||
i; | ||
const el = createElement(type); | ||
let children; | ||
@@ -815,3 +820,3 @@ if (j$.isArray_(childrenArrayOrVarArgs)) { | ||
for (i = 2; i < arguments.length; i++) { | ||
for (let i = 2; i < arguments.length; i++) { | ||
children.push(arguments[i]); | ||
@@ -821,4 +826,4 @@ } | ||
for (i = 0; i < children.length; i++) { | ||
var child = children[i]; | ||
for (let i = 0; i < children.length; i++) { | ||
const child = children[i]; | ||
@@ -834,3 +839,3 @@ if (typeof child === 'string') { | ||
for (var attr in attrs) { | ||
for (const attr in attrs) { | ||
if (attr == 'className') { | ||
@@ -847,3 +852,3 @@ el[attr] = attrs[attr]; | ||
function pluralize(singular, count) { | ||
var word = count == 1 ? singular : singular + 's'; | ||
const word = count == 1 ? singular : singular + 's'; | ||
@@ -878,3 +883,3 @@ return '' + count + ' ' + word; | ||
function noExpectations(result) { | ||
var allExpectations = | ||
const allExpectations = | ||
result.failedExpectations.length + result.passedExpectations.length; | ||
@@ -894,3 +899,3 @@ | ||
if (resultNode.type == 'suite') { | ||
for (var i = 0, j = resultNode.children.length; i < j; i++) { | ||
for (let i = 0, j = resultNode.children.length; i < j; i++) { | ||
if (hasActiveSpec(resultNode.children[i])) { | ||
@@ -909,7 +914,7 @@ return true; | ||
function HtmlSpecFilter(options) { | ||
var filterString = | ||
const filterString = | ||
options && | ||
options.filterString() && | ||
options.filterString().replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); | ||
var filterPattern = new RegExp(filterString); | ||
const filterPattern = new RegExp(filterString); | ||
@@ -958,3 +963,3 @@ this.matches = function(specName) { | ||
this.fullStringWithNewParam = function(key, value) { | ||
var paramMap = queryStringToParamMap(); | ||
const paramMap = queryStringToParamMap(); | ||
paramMap[key] = value; | ||
@@ -971,4 +976,4 @@ return toQueryString(paramMap); | ||
function toQueryString(paramMap) { | ||
var qStrPairs = []; | ||
for (var prop in paramMap) { | ||
const qStrPairs = []; | ||
for (const prop in paramMap) { | ||
qStrPairs.push( | ||
@@ -982,11 +987,11 @@ encodeURIComponent(prop) + '=' + encodeURIComponent(paramMap[prop]) | ||
function queryStringToParamMap() { | ||
var paramStr = options.getWindowLocation().search.substring(1), | ||
params = [], | ||
paramMap = {}; | ||
const paramStr = options.getWindowLocation().search.substring(1); | ||
let params = []; | ||
const paramMap = {}; | ||
if (paramStr.length > 0) { | ||
params = paramStr.split('&'); | ||
for (var i = 0; i < params.length; i++) { | ||
var p = params[i].split('='); | ||
var value = decodeURIComponent(p[1]); | ||
for (let i = 0; i < params.length; i++) { | ||
const p = params[i].split('='); | ||
let value = decodeURIComponent(p[1]); | ||
if (value === 'true' || value === 'false') { | ||
@@ -993,0 +998,0 @@ value = JSON.parse(value); |
@@ -24,7 +24,7 @@ /* | ||
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); | ||
@@ -34,3 +34,3 @@ 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; | ||
@@ -37,0 +37,0 @@ } |
{ | ||
"name": "jasmine-core", | ||
"license": "MIT", | ||
"version": "4.2.0", | ||
"version": "4.3.0", | ||
"repository": { | ||
@@ -99,3 +99,4 @@ "type": "git", | ||
"space-before-blocks": "error", | ||
"no-eval": "error" | ||
"no-eval": "error", | ||
"no-var": "error" | ||
} | ||
@@ -102,0 +103,0 @@ }, |
@@ -5,3 +5,2 @@ <a name="README">[<img src="https://rawgithub.com/jasmine/jasmine/main/images/jasmine-horizontal.svg" width="400px" />](http://jasmine.github.io)</a> | ||
[![Open Source Helpers](https://www.codetriage.com/jasmine/jasmine/badges/users.svg)](https://www.codetriage.com/jasmine/jasmine) | ||
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fjasmine%2Fjasmine.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fjasmine%2Fjasmine?ref=badge_shield) | ||
@@ -12,8 +11,4 @@ # A JavaScript Testing Framework | ||
Documentation & guides live here: [http://jasmine.github.io](http://jasmine.github.io/) | ||
For a quick start guide of Jasmine, see the beginning of [http://jasmine.github.io/edge/introduction.html](http://jasmine.github.io/edge/introduction.html). | ||
Upgrading from Jasmine 3.x? Check out the [upgrade guide](https://jasmine.github.io/tutorials/upgrading_to_Jasmine_4.0). | ||
Upgrading from Jasmine 3.x? Check out the 4.0 release notes for a list of | ||
what's new (including breaking changes). You can also read the [upgrade guide](https://jasmine.github.io/tutorials/upgrading_to_Jasmine_4.0). | ||
## Contributing | ||
@@ -33,3 +28,3 @@ | ||
particularly the [Your First Suite tutorial](https://jasmine.github.io/tutorials/your_first_suite) | ||
for information on writing specs. | ||
for information on writing specs, and [the FAQ](https://jasmine.github.io/pages/faq.html). | ||
@@ -53,12 +48,4 @@ ## Supported environments | ||
See the [release notes](https://github.com/jasmine/jasmine/tree/main/release_notes) | ||
for the supported environments for each Jasmine release. | ||
To find out what environments work with a particular Jasmine release, see the [release notes](https://github.com/jasmine/jasmine/tree/main/release_notes). | ||
## Support | ||
* Search past discussions: [http://groups.google.com/group/jasmine-js](http://groups.google.com/group/jasmine-js). | ||
* Send an email to the list: [jasmine-js@googlegroups.com](mailto:jasmine-js@googlegroups.com). | ||
* View the project backlog at Pivotal Tracker: [http://www.pivotaltracker.com/projects/10606](http://www.pivotaltracker.com/projects/10606). | ||
* Follow us on Twitter: [@JasmineBDD](http://twitter.com/JasmineBDD). | ||
## Maintainers | ||
@@ -78,6 +65,2 @@ | ||
Copyright (c) 2008-2022 Jasmine Maintainers. This software is licensed under the MIT License. | ||
## License | ||
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fjasmine%2Fjasmine.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fjasmine%2Fjasmine?ref=badge_large) | ||
Copyright (c) 2008-2022 Jasmine Maintainers. This software is licensed under the [MIT License](https://github.com/jasmine/jasmine/blob/main/MIT.LICENSE). |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
379230
10719
62