Jasmine Core 4.0.0 Release Notes
This is a major release. In addition to new features and bug fixes it contains
a number of breaking changes that are intended to diagnose common errors,
improve awkward or outdated APIs, and make Jasmine easier to maintain
and contribute to. If you're upgrading from Jasmine 3.x, we recommend installing
3.99 and fixing any deprecation warnings that it emits before updating to 4.0.
Please see the migration guide
for more information. If you use the
packages, please read the release notes for those packages as well.
Obsolete environments, most notably Internet Explorer, are no longer supported. Jasmine now expects to run in an environment that provides most of ES2017 and, in the case of Node, good interoperability between CommonJS modules and ES modules.
The Jasmine packages for Ruby and Python have been discontinued.
beforeEachfunctions are handled better.
Jasmine can optionally be used without creating globals in Node.
Certain common async testing bugs are now reported as errors.
A new debug logging feature makes it easier to debug failing specs, particularly intermittent failures.
See details below.
Changes to supported environments
The following previously supported environments are no longer supported:
- Internet Explorer
- Safari 8-13
- Firefox 68 and 78
- Node 10 and 12.0-12.16
Although Jasmine 4.0 may still work in some of those environments, we no longer test against them and won't try to maintain compatibility with them in future 4.x releases.
NPM package is the direct replacement for the
jasmine Ruby and Python
Changes that affect how specs are written
beforeAllfunction fails in any way other than a failed expectation, Jasmine will not run the contents of the suite or any child suites except for any
afterAllfunctions defined in the same suite as the failed
beforeAllfunction. All affected specs will still be reported as failed. See #1533.
beforeEachfunction fails in any way other than a failed expectation, Jasmine will skip any subsequent
beforeEachfunctions, the corresponding spec, and any
afterEachfunctions defined in child suites.
afterEachfunctions defined at the same or higher levels will still run. The spec will still be reported as failed. See #1533.
toContainmatcher use deep equality rather than
===to compare set members. This matches how arrays are handled but may cause some previously passing
.not.toContain()expectations to fail.
jasmine.clock().mockDate()throws if its argument is not a
Date. Previous versions ignored non-
Multiple calls to an asynchronous function's
donecallback are treated as errors.
Any argument passed to a
donecallback (other than
undefined) is treated as an error. Previous versions ignored any argument that wasn't an
Jasmine will report an error rather than a warning when a function tries to combine two different forms of async (e.g. taking a callback and also returning a promise).
describefunctions is no longer a
Empty suites are treated as errors.
- Merges #1742 from @johnjbarton
The current time value does not decrease when
jasmine.clock().tick()is called from a
Changes to how Jasmine is configured
Individual configuration property getters and setters such as
Env#randomizeTestshave been removed. Use
oneFailurePerSpecconfiguration properties have been removed. Use
Promiseconfiguration property has been removed. Jasmine can still consume non-native promises but will always use the global
Promiseto create promises.
Changes that affect custom matchers
The old style of using custom equality testers, where matchers received them from Jasmine and had to pass them back to
matchersUtilmethods, is no longer supported.
ppare no longer available globally. Instead, use the instances that are passed to custom matcher factories and to
See the migration guide for more information about these changes and how to update custom matchers that use the old APIs.
Changes that affect custom reporters
Specobjects returned from
Env#topSuiteno longer expose private APIs.
Other breaking changes
boot.jsis no longer included. Use
- Boot files in
lib/jasmine-core/bootare no longer included in the NPM package. Use the boot files in
json2.jsis no longer included, since all supported environments provide a JSON parser.
Other new features and bug fixes
Jasmine can optionally be used without creating globals in Node.js.
- See https://jasmine.github.io/api/4.0/module-jasmine-core.html#.noGlobals
- If you're using the
jasminepackage, see its documentation.
- Fixes #1235
Custom spy strategies are inherited from parent suites like other runnable resources.
pending()can now be called from
- Fixes #1579
Removed duplicate message from errors (including. matcher failures) in V8-based environments.
Spy#withArgssupports custom equality testers.
- Fixes #1836
The promise returned by
Env#executeis resolved to the jasmineDoneInfo.
Fixed stack trace filtering on Safari 15.
The HTML reporter includes top suite failures in the reported failure count.
afterAllfunctions are run after a failure even if the
stopOnSpecFailureconfig property is set.
Added a debug logging feature to make it easier to debug failing specs.
jasmine#debugLogduring spec execution to add a log entry.
- If the spec fails, log entries are reported as part of the specDone reporter event.
The HTML reporter no longer says that expectations occurring after the spec finishes are AfterAll errors.
Added a 4.0 migration guide
Updated the README and contributing guide for 4.0
jasmine-core 4.0.0 has been tested in the following environments.
|Node||12.17+, 14, 16|
_Release Notes generated with Anchorman