191 lines
8.5 KiB
Markdown
191 lines
8.5 KiB
Markdown
# 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](https://jasmine.github.io/upgrade-guides/6.0)
|
|
for more information. If you use Jasmine via the `jasmine` package, please see
|
|
[its release notes](https://github.com/jasmine/jasmine-npm/blob/main/release_notes/6.0.0.md)
|
|
as well.
|
|
|
|
|
|
## Changes to supported environments
|
|
|
|
* Node 18 is no longer supported.
|
|
|
|
|
|
## Breaking changes
|
|
|
|
### General
|
|
|
|
* Private APIs have been removed from the `jasmine` namespace.
|
|
|
|
The purpose of this change is to reduce the risk of users inadvertently
|
|
depending on private APIs. Anything not covered by
|
|
[the documentation](https://jasmine.github.io/pages/docs_home.html) 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's
|
|
`this` argument will be `null`. Previously it was `globalThis`.
|
|
* 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 `setTimeout` and
|
|
`setInterval`.
|
|
* Keys passed to `setSpecProperty`/`setSuiteProperty` must 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](https://jasmine.github.io/api/6.0/Spec.html)
|
|
instance, not the internal spec object.
|
|
* The default value of the `forbidDuplicateNames` config 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 `status` and `failedExpectations` are omitted
|
|
from the events passed to [suiteStarted](https://jasmine.github.io/api/6.0/global.html#SuiteStartedEvent)
|
|
and [specStarted](https://jasmine.github.io/api/6.0/global.html#SpecStartedEvent).
|
|
* Reporter events are deep-cloned before being passed to each reporter. This
|
|
protects reporters against later mutation by jasmine-core or other reporters.
|
|
* The `expected` and `actual` properties of
|
|
[passed and failed expectations](https://jasmine.github.io/api/6.0/global.html#ExpectationResult)
|
|
have been removed.
|
|
* The [order](https://jasmine.github.io/api/6.0/global.html#Order)
|
|
property of the`jasmineStarted` and `jasmineDone` reporter events no longer
|
|
includes undocumented properties.
|
|
* boot1.js no longer adds `jsApiReporter` to the env.
|
|
|
|
### Changes that affect browser boot files
|
|
|
|
* The `createElement` and `createTextNode` options of the legacy `HtmlReporter`
|
|
are ignored. `HtmlReporter` now unconditionally uses `document.createElement`
|
|
and `document.createTextNode`.
|
|
|
|
### Changes to Node boot functions
|
|
|
|
* [boot](https://jasmine.github.io/api/6.0/module-jasmine-core.html#.boot)
|
|
defaults to creating a new core instance each time it's called. This restores
|
|
the pre-5.0 default behavior.
|
|
* [noGlobals](https://jasmine.github.io/api/6.0/module-jasmine-core.html#.noGlobals)
|
|
no longer takes a parameter. It always returns the same object when called
|
|
repeatedly.
|
|
|
|
|
|
## New features
|
|
|
|
* A new `HtmlReporterV2` with several improvements over the old `HtmlReporter`:
|
|
* 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 `spec` query string parameters that are different
|
|
from those created by the old reporter. If you use other software that
|
|
interprets the `spec` parameter, such as karma-jasmine, you won't be able to
|
|
adopt `HtmlReporterV2` unlesss that other software is updated.
|
|
|
|
* Larger body font size in HTML reporters
|
|
* `globalThis` is used to determine the global object during initialization
|
|
This makes jasmine-core more tolerant of buggy bundlers or loaders that
|
|
cause `this` to be undefined in the global context.
|
|
* Experimental [`safariYieldStrategy: "time"`](https://jasmine.github.io/api/6.0/Configuration.html#safariYieldStrategy)
|
|
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 like
|
|
`jasmine.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.
|
|
* `HtmlReporter` and `HtmlSpecFilter` are deprecated in favor of `HtmlReporterV2`.
|
|
* `jsApiReporter` is 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 `HtmlReporter` into 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 `isArray` helper with native `Array.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.<br>
|
|
\** 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](http://github.com/infews/anchorman)_
|