Jasmine Core 6.0.0 Release Notes
Summary
This is a major release that includes breaking changes as well as significant new features. Many of the breaking changes and deprecations in this release are intended to improve the stability of the Jasmine ecosystem by making the distinction between public and private APIs more obvious, reducing exposure of jasmine-core’s internal state, removing ambiguities from the reporter API, and warning about monkey patching.
6.x is intended to ba a relatively short-lived, transitional series. It is compatible with the current versions of karma-jasmine and other legacy Angular tools but emits deprecation warnings when used with them. 7.0 will drop compatibility with those tools. If you use Karma in a non-Angular context, consider migrating to a maintained alternative such as jasmine-browser-runner or web-test-runner. If you use Angular, please direct any questions about support for future versions of Jasmine to the Angular team.
Please see the migration guide
for more information. If you use Jasmine via the jasmine package, please see
its release notes
as well.
Changes to supported environments
- Node 18 is no longer supported.
Breaking changes
General
-
Private APIs have been removed from the
jasminenamespace.The purpose of this change is to reduce the risk of users inadvertently depending on private APIs. Anything not covered by the documentation remains private regardless of namespacing. Private APIs may be changed or removed in any release. This change is being made in a major release as a courtesy to users of libraries that depend on private APIs.
Changes that affect spec writing
- Global error spies always receive a single argument. Previously, the browser error event was passed as the second argument.
- If a spy is invoked via
.call(null, ...)or.apply(null, ...), the spy’sthisargument will benull. Previously it wasglobalThis. - Mock clock timing functions cannot be spied on. Previously this “worked” but prevented the mock clock from uninstalling itself.
- The mock clock no longer supports the eval forms of
setTimeoutandsetInterval. - Keys passed to
setSpecProperty/setSuitePropertymust be strings. Values must be both structured-cloneable and JSON-serializable.
Changes that affect configuration
- HTML reporters cache configuration throughout each run. Configuration changes made while specs are running will not affect reporter behavior.
- If an execution order is passed to
Env#execute, it must not enter any suite more than once. - The argument passed to spec filters is a spec metadata instance, not the internal spec object.
- The default value of the
forbidDuplicateNamesconfig option has been changed to true.
Changes that affect reporters
This release includes changes that are intended to streamline and clarify the reporter interface, prevent sharing of mutable state, and prevent bugs involving non-serializable objects. These changes should be compatible with most existing reporters but could break reporters that manage their internal state in unusual ways.
- Meaningless properties such as
statusandfailedExpectationsare omitted from the events passed to suiteStarted and specStarted. - Reporter events are deep-cloned before being passed to each reporter. This protects reporters against later mutation by jasmine-core or other reporters.
- The
expectedandactualproperties of passed and failed expectations have been removed. - The order
property of the
jasmineStartedandjasmineDonereporter events no longer includes undocumented properties. - boot1.js no longer adds
jsApiReporterto the env.
Changes that affect browser boot files
- The
createElementandcreateTextNodeoptions of the legacyHtmlReporterare ignored.HtmlReporternow unconditionally usesdocument.createElementanddocument.createTextNode.
Changes to Node boot functions
- boot defaults to creating a new core instance each time it’s called. This restores the pre-5.0 default behavior.
- noGlobals no longer takes a parameter. It always returns the same object when called repeatedly.
New features
-
A new
HtmlReporterV2with several improvements over the oldHtmlReporter:- Clicking a spec/suite link does exact filtering rather than a substring match.
- The old dots are replaced with a progress bar. This improves usability with large suites and fixes an accessibility problem.
- Details of failed specs are displayed as soon as each spec finishes.
- A Performance tab shows metrics and a list of the slowest specs.
- Initialization and wire-up in boot files are much simpler.
If you’re using jasmine-browser-runner or copying boot1.js from the standalone distribution, you’ll automatically get the new reporter. If you maintain your own boot files, you’ll get the old reporter unless you update your boot files to match the one that’s in this package.
The new reporter produces
specquery string parameters that are different from those created by the old reporter. If you use other software that interprets thespecparameter, such as karma-jasmine, you won’t be able to adoptHtmlReporterV2unlesss that other software is updated. -
Larger body font size in HTML reporters
-
globalThisis used to determine the global object during initialization This makes jasmine-core more tolerant of buggy bundlers or loaders that causethisto be undefined in the global context. -
Experimental
safariYieldStrategy: "time"config option, which may make Jasmine run significantly faster in Safari and similar browsers. So far, this option has not been tested on a wide variety of workloads. Feedback is appreciated. -
Statically exposed pretty printer as
jasmine.pp().
Deprecations
- Common monkey patching patterns are detected and result in a deprecation
warning. Code that overwrites anything provided by jasmine-core (other than
globals like
it/expect/etc or configuration properties likejasmine.DEFAULT_TIMEOUT_INTERVAL) may be broken by any jasmine-core release. - Warn if jasmine-core is loaded as an ES module in a browser. This is an untested and unsupported configuration that has been known to cause problems.
HtmlReporterandHtmlSpecFilterare deprecated in favor ofHtmlReporterV2.jsApiReporteris deprecated.
Documentation improvements
- Improved API reference documentation for APIs that are used from browser boot files.
- Documented the set of possible spec statuses.
- Documented that globals are overwriteable.
Internal improvements
- Encapsulated suite and spec result and status management.
- Adopted strict mode throughout the codebase.
- Decomposed
HtmlReporterinto components and converted to ES6 classes. - Made global error handling more uniform between browsers and Node.
- Removed code to support browsers that don’t have
MessageChannel. Jasmine hasn’t run in any such browsers since 2.x. - Replaced
isArrayhelper with nativeArray.isArray.
Supported environments
This version has been tested in the following environments.
| Environment | Supported versions |
|---|---|
| Node | 20, 22, 24 |
| Safari** | 16, 17, 26.2 |
| Chrome | 143* |
| Firefox | 102**, 115**, 128**, 140, 147* |
| Edge | 143* |
* Evergreen browser. Each version of Jasmine is tested against the latest
version available at release time.
** Supported on a best-effort basis. Support for these versions may be dropped
if it becomes impractical, and bugs affecting only these versions may not be
treated as release blockers.
_Release Notes generated with Anchorman