jasmine-core
Advanced tools
Comparing version 3.99.0 to 4.0.0
@@ -1,4 +0,40 @@ | ||
module.exports = require("./jasmine-core/jasmine.js"); | ||
/** | ||
* Note: Only available on Node. | ||
* @module jasmine-core | ||
*/ | ||
const jasmineRequire = require('./jasmine-core/jasmine.js'); | ||
module.exports = jasmineRequire; | ||
/** | ||
* Boots a copy of Jasmine and returns an object as described in {@link jasmine}. | ||
* @type {function} | ||
* @return {jasmine} | ||
*/ | ||
module.exports.boot = require('./jasmine-core/node_boot.js'); | ||
/** | ||
* Boots a copy of Jasmine and returns an object containing the properties | ||
* that would normally be added to the global object. If noGlobals is called | ||
* multiple times, the same object is returned every time. | ||
* | ||
* Do not call boot() if you also call noGlobals(). | ||
* | ||
* @example | ||
* const {describe, beforeEach, it, expect, jasmine} = require('jasmine-core').noGlobals(); | ||
*/ | ||
module.exports.noGlobals = (function() { | ||
let jasmineInterface; | ||
return function bootWithoutGlobals() { | ||
if (!jasmineInterface) { | ||
const jasmine = jasmineRequire.core(jasmineRequire); | ||
const env = jasmine.getEnv({ suppressLoadErrors: true }); | ||
jasmineInterface = jasmineRequire.interface(jasmine, env); | ||
} | ||
return jasmineInterface; | ||
}; | ||
}()); | ||
var path = require('path'), | ||
@@ -5,0 +41,0 @@ fs = require('fs'); |
@@ -64,2 +64,2 @@ /* | ||
} | ||
}()); | ||
})(); |
@@ -24,3 +24,3 @@ /* | ||
/** | ||
This file finishes "booting" Jasmine, performing all of the necessary | ||
This file finishes 'booting' Jasmine, performing all of the necessary | ||
initialization before executing the loaded environment and all of a project's | ||
@@ -47,20 +47,24 @@ specs. This file should be loaded after `boot0.js` but before any project | ||
var queryString = new jasmine.QueryString({ | ||
getWindowLocation: function() { return window.location; } | ||
getWindowLocation: function() { | ||
return window.location; | ||
} | ||
}); | ||
var filterSpecs = !!queryString.getParam("spec"); | ||
var filterSpecs = !!queryString.getParam('spec'); | ||
var config = { | ||
stopOnSpecFailure: queryString.getParam("failFast"), | ||
stopSpecOnExpectationFailure: queryString.getParam("oneFailurePerSpec"), | ||
hideDisabled: queryString.getParam("hideDisabled") | ||
stopOnSpecFailure: queryString.getParam('stopOnSpecFailure'), | ||
stopSpecOnExpectationFailure: queryString.getParam( | ||
'stopSpecOnExpectationFailure' | ||
), | ||
hideDisabled: queryString.getParam('hideDisabled') | ||
}; | ||
var random = queryString.getParam("random"); | ||
var random = queryString.getParam('random'); | ||
if (random !== undefined && random !== "") { | ||
if (random !== undefined && random !== '') { | ||
config.random = random; | ||
} | ||
var seed = queryString.getParam("seed"); | ||
var seed = queryString.getParam('seed'); | ||
if (seed) { | ||
@@ -76,7 +80,17 @@ config.seed = seed; | ||
env: env, | ||
navigateWithNewParam: function(key, value) { return queryString.navigateWithNewParam(key, value); }, | ||
addToExistingQueryString: function(key, value) { return queryString.fullStringWithNewParam(key, value); }, | ||
getContainer: function() { return document.body; }, | ||
createElement: function() { return document.createElement.apply(document, arguments); }, | ||
createTextNode: function() { return document.createTextNode.apply(document, arguments); }, | ||
navigateWithNewParam: function(key, value) { | ||
return queryString.navigateWithNewParam(key, value); | ||
}, | ||
addToExistingQueryString: function(key, value) { | ||
return queryString.fullStringWithNewParam(key, value); | ||
}, | ||
getContainer: function() { | ||
return document.body; | ||
}, | ||
createElement: function() { | ||
return document.createElement.apply(document, arguments); | ||
}, | ||
createTextNode: function() { | ||
return document.createTextNode.apply(document, arguments); | ||
}, | ||
timer: new jasmine.Timer(), | ||
@@ -96,3 +110,5 @@ filterSpecs: filterSpecs | ||
var specFilter = new jasmine.HtmlSpecFilter({ | ||
filterString: function() { return queryString.getParam("spec"); } | ||
filterString: function() { | ||
return queryString.getParam('spec'); | ||
} | ||
}); | ||
@@ -107,10 +123,2 @@ | ||
/** | ||
* Setting up timing functions to be able to be overridden. Certain browsers (Safari, IE 8, phantomjs) require this hack. | ||
*/ | ||
window.setTimeout = window.setTimeout; | ||
window.setInterval = window.setInterval; | ||
window.clearTimeout = window.clearTimeout; | ||
window.clearInterval = window.clearInterval; | ||
/** | ||
* ## Execution | ||
@@ -129,11 +137,2 @@ * | ||
}; | ||
/** | ||
* Helper function for readability above. | ||
*/ | ||
function extend(destination, source) { | ||
for (var property in source) destination[property] = source[property]; | ||
return destination; | ||
} | ||
}()); | ||
})(); |
@@ -75,2 +75,8 @@ /* | ||
ResultsStateBuilder.prototype.jasmineDone = function(result) { | ||
if (result.failedExpectations) { | ||
this.failureCount += result.failedExpectations.length; | ||
} | ||
}; | ||
function HtmlReporter(options) { | ||
@@ -191,2 +197,3 @@ var config = function() { | ||
this.jasmineDone = function(doneResult) { | ||
stateBuilder.jasmineDone(doneResult); | ||
var banner = find('.jasmine-banner'); | ||
@@ -308,4 +315,6 @@ var alert = find('.jasmine-alert'); | ||
} | ||
} else if (failure.globalErrorType === 'afterAll') { | ||
return afterAllMessagePrefix + failure.message; | ||
} else { | ||
return afterAllMessagePrefix + failure.message; | ||
return failure.message; | ||
} | ||
@@ -440,5 +449,49 @@ } | ||
if (result.debugLogs) { | ||
messages.appendChild(debugLogTable(result.debugLogs)); | ||
} | ||
return failure; | ||
} | ||
function debugLogTable(debugLogs) { | ||
var tbody = createDom('tbody'); | ||
debugLogs.forEach(function(entry) { | ||
tbody.appendChild( | ||
createDom( | ||
'tr', | ||
{}, | ||
createDom('td', {}, entry.timestamp.toString()), | ||
createDom('td', {}, entry.message) | ||
) | ||
); | ||
}); | ||
return createDom( | ||
'div', | ||
{ className: 'jasmine-debug-log' }, | ||
createDom( | ||
'div', | ||
{ className: 'jasmine-debug-log-header' }, | ||
'Debug logs' | ||
), | ||
createDom( | ||
'table', | ||
{}, | ||
createDom( | ||
'thead', | ||
{}, | ||
createDom( | ||
'tr', | ||
{}, | ||
createDom('th', {}, 'Time (ms)'), | ||
createDom('th', {}, 'Message') | ||
) | ||
), | ||
tbody | ||
) | ||
); | ||
} | ||
function summaryList(resultsTree, domParent) { | ||
@@ -578,3 +631,3 @@ var specListNode; | ||
failFastCheckbox.onclick = function() { | ||
navigateWithNewParam('failFast', !config.stopOnSpecFailure); | ||
navigateWithNewParam('stopOnSpecFailure', !config.stopOnSpecFailure); | ||
}; | ||
@@ -588,3 +641,3 @@ | ||
navigateWithNewParam( | ||
'oneFailurePerSpec', | ||
'stopSpecOnExpectationFailure', | ||
!config.stopSpecOnExpectationFailure | ||
@@ -591,0 +644,0 @@ ); |
@@ -26,3 +26,3 @@ /* | ||
var env = jasmine.getEnv({suppressLoadErrors: true}); | ||
var env = jasmine.getEnv({ suppressLoadErrors: true }); | ||
@@ -29,0 +29,0 @@ var jasmineInterface = jasmineRequire.interface(jasmine, env); |
{ | ||
"name": "jasmine-core", | ||
"license": "MIT", | ||
"version": "3.99.0", | ||
"version": "4.0.0", | ||
"repository": { | ||
@@ -37,18 +37,17 @@ "type": "git", | ||
"devDependencies": { | ||
"ejs": "^2.5.5", | ||
"eslint": "^6.8.0", | ||
"eslint-plugin-compat": "^3.8.0", | ||
"fast-glob": "^2.2.6", | ||
"eslint": "^7.32.0", | ||
"eslint-plugin-compat": "^4.0.0", | ||
"glob": "^7.2.0", | ||
"grunt": "^1.0.4", | ||
"grunt-cli": "^1.3.2", | ||
"grunt-contrib-compress": "^1.3.0", | ||
"grunt-contrib-concat": "^1.0.1", | ||
"grunt-contrib-compress": "^2.0.0", | ||
"grunt-contrib-concat": "^2.0.0", | ||
"grunt-css-url-embed": "^1.11.1", | ||
"grunt-sass": "^3.0.2", | ||
"jasmine": "^3.10.0", | ||
"jasmine": "github:jasmine/jasmine-npm#main", | ||
"jasmine-browser-runner": "github:jasmine/jasmine-browser#main", | ||
"jsdom": "^15.0.0", | ||
"load-grunt-tasks": "^4.0.0", | ||
"jsdom": "^19.0.0", | ||
"load-grunt-tasks": "^5.1.0", | ||
"prettier": "1.17.1", | ||
"sass": "^1.32.12", | ||
"sass": "^1.45.1", | ||
"shelljs": "^0.8.3", | ||
@@ -64,4 +63,9 @@ "temp": "^0.9.0" | ||
], | ||
"env": { | ||
"browser": true, | ||
"node": true, | ||
"es2017": true | ||
}, | ||
"parserOptions": { | ||
"ecmaVersion": 5 | ||
"ecmaVersion": 2018 | ||
}, | ||
@@ -82,2 +86,3 @@ "rules": { | ||
], | ||
"no-implicit-globals": "error", | ||
"block-spacing": "error", | ||
@@ -100,9 +105,8 @@ "func-call-spacing": [ | ||
"browserslist": [ | ||
"Safari >= 8", | ||
"Safari >= 13", | ||
"last 2 Chrome versions", | ||
"last 2 Firefox versions", | ||
"Firefox 68", | ||
"last 2 Edge versions", | ||
"IE >= 10" | ||
"Firefox >= 68", | ||
"last 2 Edge versions" | ||
] | ||
} |
@@ -14,2 +14,5 @@ <a name="README">[<img src="https://rawgithub.com/jasmine/jasmine/main/images/jasmine-horizontal.svg" width="400px" />](http://jasmine.github.io)</a> | ||
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 | ||
@@ -27,5 +30,2 @@ | ||
For the Jasmine Ruby Gem:<br> | ||
[https://github.com/jasmine/jasmine-gem](https://github.com/jasmine/jasmine-gem). | ||
To install Jasmine standalone on your local box (where **_{#.#.#}_** below is substituted by the release number downloaded): | ||
@@ -52,12 +52,12 @@ | ||
Jasmine tests itself across many browsers (Safari, Chrome, Firefox, Microsoft Edge, and Internet Explorer) as well as nodejs. | ||
Jasmine tests itself across popular browsers (Safari, Chrome, Firefox, and | ||
Microsoft Edge) as well as nodejs. | ||
| Environment | Supported versions | | ||
|-------------------|--------------------| | ||
| Node | 10, 12, 14, 16 | | ||
| Safari | 8-14 | | ||
| Node | 12.17+, 14, 16 | | ||
| Safari | 14-15 | | ||
| Chrome | Evergreen | | ||
| Firefox | Evergreen, 68, 78, 91 | | ||
| Firefox | Evergreen, 91 | | ||
| Edge | Evergreen | | ||
| Internet Explorer | 10, 11 | | ||
@@ -68,2 +68,5 @@ For evergreen browsers, each version of Jasmine is tested against the version of the browser that is available to us | ||
See the [release notes](https://github.com/jasmine/jasmine/tree/main/release_notes) | ||
for the supported environments for each Jasmine release. | ||
## Support | ||
@@ -70,0 +73,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
17
93
373109
21
10525