Compare commits
30 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e86a7f00a6 | ||
|
|
504ef27899 | ||
|
|
572452a15a | ||
|
|
896412367a | ||
|
|
503a7409f0 | ||
|
|
bb9175cb66 | ||
|
|
469b557828 | ||
|
|
503715c275 | ||
|
|
4482355885 | ||
|
|
6542364381 | ||
|
|
1fc911e0fa | ||
|
|
fdad8849df | ||
|
|
7a289f1de7 | ||
|
|
ef981bb794 | ||
|
|
c3fb3e985a | ||
|
|
7fc3408051 | ||
|
|
af1b43eeff | ||
|
|
4c043717a9 | ||
|
|
40be00310d | ||
|
|
1f318c3c93 | ||
|
|
be29aa95eb | ||
|
|
e3c9a59c6c | ||
|
|
b312ed4940 | ||
|
|
00f6708e1f | ||
|
|
3a47a3bd04 | ||
|
|
1c9382c990 | ||
|
|
394be99832 | ||
|
|
62a667a8e3 | ||
|
|
d277827d5e | ||
|
|
644c175338 |
@@ -192,7 +192,7 @@ workflows:
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- main
|
||||
- browser-flakes
|
||||
jobs:
|
||||
- build:
|
||||
executor: node14
|
||||
|
||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -1,3 +0,0 @@
|
||||
[submodule "pages"]
|
||||
path = pages
|
||||
url = https://github.com/pivotal/jasmine.git
|
||||
@@ -8,7 +8,18 @@ Gem::Specification.new do |s|
|
||||
s.platform = Gem::Platform::RUBY
|
||||
s.authors = ["Gregg Van Hove"]
|
||||
s.summary = %q{JavaScript BDD framework}
|
||||
s.description = %q{Test your JavaScript without any framework dependencies, in any environment, and with a nice descriptive syntax.}
|
||||
s.description = <<~DESC
|
||||
Test your JavaScript without any framework dependencies, in any environment,
|
||||
and with a nice descriptive syntax.
|
||||
|
||||
Jasmine for Ruby is deprecated. The direct replacment for the jasmine-core
|
||||
gem is the jasmine-core NPM package. If you are also using the jasmine gem,
|
||||
we recommend using the jasmine-browser-runner NPM package instead. It
|
||||
supports all the same scenarios as the jasmine gem gem plus Webpacker. See
|
||||
https://jasmine.github.io/setup/browser.html for setup instructions, and
|
||||
https://github.com/jasmine/jasmine-gem/blob/main/release_notes/3.9.0.md
|
||||
for other options.
|
||||
DESC
|
||||
s.email = %q{jasmine-js@googlegroups.com}
|
||||
s.homepage = "http://jasmine.github.io"
|
||||
s.license = "MIT"
|
||||
|
||||
@@ -1,3 +1,28 @@
|
||||
if ENV["SUPPRESS_JASMINE_DEPRECATION"].nil?
|
||||
puts <<~END_DEPRECATION_MSG
|
||||
The Jasmine Ruby gems are deprecated. There will be no further releases after
|
||||
the end of the Jasmine 3.x series. We recommend that most users migrate to the
|
||||
jasmine-browser-runner npm package, which is the direct replacement for the
|
||||
jasmine gem. See <https://jasmine.github.io/setup/browser.html> for setup
|
||||
instructions, including for Rails applications that use either Sprockets or
|
||||
Webpacker.
|
||||
|
||||
If jasmine-browser-runner doesn't meet your needs, one of these might:
|
||||
|
||||
* The jasmine npm package to run specs in Node.js:
|
||||
<https://github.com/jasmine/jasmine-npm>
|
||||
* The standalone distribution to run specs in browsers with no additional
|
||||
tools: <https://github.com/jasmine/jasmine#installation>
|
||||
* The jasmine-core npm package if all you need is the Jasmine assets:
|
||||
<https://github.com/jasmine/jasmine>. This is the direct equivalent of the
|
||||
jasmine-core Ruby gem.
|
||||
|
||||
To prevent this message from appearing, set the SUPPRESS_JASMINE_DEPRECATION
|
||||
environment variable.
|
||||
|
||||
END_DEPRECATION_MSG
|
||||
end
|
||||
|
||||
module Jasmine
|
||||
module Core
|
||||
class << self
|
||||
|
||||
@@ -96,6 +96,7 @@ var getJasmineRequireObj = (function(jasmineGlobal) {
|
||||
j$.SpyRegistry = jRequire.SpyRegistry(j$);
|
||||
j$.SpyStrategy = jRequire.SpyStrategy(j$);
|
||||
j$.StringMatching = jRequire.StringMatching(j$);
|
||||
j$.StringContaining = jRequire.StringContaining(j$);
|
||||
j$.UserContext = jRequire.UserContext(j$);
|
||||
j$.Suite = jRequire.Suite(j$);
|
||||
j$.Timer = jRequire.Timer();
|
||||
@@ -175,6 +176,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
* Maximum object depth the pretty printer will print to.
|
||||
* Set this to a lower value to speed up pretty printing if you have large objects.
|
||||
* @name jasmine.MAX_PRETTY_PRINT_DEPTH
|
||||
* @default 8
|
||||
* @since 1.3.0
|
||||
*/
|
||||
j$.MAX_PRETTY_PRINT_DEPTH = 8;
|
||||
@@ -183,6 +185,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
* This will also limit the number of keys and values displayed for an object.
|
||||
* Elements past this number will be ellipised.
|
||||
* @name jasmine.MAX_PRETTY_PRINT_ARRAY_LENGTH
|
||||
* @default 50
|
||||
* @since 2.7.0
|
||||
*/
|
||||
j$.MAX_PRETTY_PRINT_ARRAY_LENGTH = 50;
|
||||
@@ -190,15 +193,35 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
* Maximum number of characters to display when pretty printing objects.
|
||||
* Characters past this number will be ellipised.
|
||||
* @name jasmine.MAX_PRETTY_PRINT_CHARS
|
||||
* @default 100
|
||||
* @since 2.9.0
|
||||
*/
|
||||
j$.MAX_PRETTY_PRINT_CHARS = 1000;
|
||||
/**
|
||||
* Default number of milliseconds Jasmine will wait for an asynchronous spec to complete.
|
||||
* Default number of milliseconds Jasmine will wait for an asynchronous spec,
|
||||
* before, or after function to complete. This can be overridden on a case by
|
||||
* case basis by passing a time limit as the third argument to {@link it},
|
||||
* {@link beforeEach}, {@link afterEach}, {@link beforeAll}, or
|
||||
* {@link afterAll}. The value must be no greater than the largest number of
|
||||
* milliseconds supported by setTimeout, which is usually 2147483647.
|
||||
*
|
||||
* While debugging tests, you may want to set this to a large number (or pass
|
||||
* a large number to one of the functions mentioned above) so that Jasmine
|
||||
* does not move on to after functions or the next spec while you're debugging.
|
||||
* @name jasmine.DEFAULT_TIMEOUT_INTERVAL
|
||||
* @default 5000
|
||||
* @since 1.3.0
|
||||
*/
|
||||
j$.DEFAULT_TIMEOUT_INTERVAL = 5000;
|
||||
var DEFAULT_TIMEOUT_INTERVAL = 5000;
|
||||
Object.defineProperty(j$, 'DEFAULT_TIMEOUT_INTERVAL', {
|
||||
get: function() {
|
||||
return DEFAULT_TIMEOUT_INTERVAL;
|
||||
},
|
||||
set: function(newValue) {
|
||||
j$.util.validateTimeout(newValue, 'jasmine.DEFAULT_TIMEOUT_INTERVAL');
|
||||
DEFAULT_TIMEOUT_INTERVAL = newValue;
|
||||
}
|
||||
});
|
||||
|
||||
j$.getGlobal = function() {
|
||||
return jasmineGlobal;
|
||||
@@ -397,7 +420,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* that will succeed if the actual value being compared is an instance of the specified class/constructor.
|
||||
* @name jasmine.any
|
||||
* @since 1.3.0
|
||||
@@ -409,7 +432,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* that will succeed if the actual value being compared is not `null` and not `undefined`.
|
||||
* @name jasmine.anything
|
||||
* @since 2.2.0
|
||||
@@ -420,7 +443,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* that will succeed if the actual value being compared is `true` or anything truthy.
|
||||
* @name jasmine.truthy
|
||||
* @since 3.1.0
|
||||
@@ -431,7 +454,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* that will succeed if the actual value being compared is `null`, `undefined`, `0`, `false` or anything falsey.
|
||||
* @name jasmine.falsy
|
||||
* @since 3.1.0
|
||||
@@ -442,7 +465,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* that will succeed if the actual value being compared is empty.
|
||||
* @name jasmine.empty
|
||||
* @since 3.1.0
|
||||
@@ -453,7 +476,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* that will succeed if the actual value being compared is not empty.
|
||||
* @name jasmine.notEmpty
|
||||
* @since 3.1.0
|
||||
@@ -464,7 +487,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* that will succeed if the actual value being compared contains at least the keys and values.
|
||||
* @name jasmine.objectContaining
|
||||
* @since 1.3.0
|
||||
@@ -476,7 +499,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* that will succeed if the actual value is a `String` that matches the `RegExp` or `String`.
|
||||
* @name jasmine.stringMatching
|
||||
* @since 2.2.0
|
||||
@@ -488,7 +511,19 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* that will succeed if the actual value is a `String` that contains the specified `String`.
|
||||
* @name jasmine.stringContaining
|
||||
* @since 3.10.0
|
||||
* @function
|
||||
* @param {String} expected
|
||||
*/
|
||||
j$.stringContaining = function(expected) {
|
||||
return new j$.StringContaining(expected);
|
||||
};
|
||||
|
||||
/**
|
||||
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* that will succeed if the actual value is an `Array` that contains at least the elements in the sample.
|
||||
* @name jasmine.arrayContaining
|
||||
* @since 2.2.0
|
||||
@@ -500,7 +535,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* that will succeed if the actual value is an `Array` that contains all of the elements in the sample in any order.
|
||||
* @name jasmine.arrayWithExactContents
|
||||
* @since 2.8.0
|
||||
@@ -512,7 +547,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* that will succeed if every key/value pair in the sample passes the deep equality comparison
|
||||
* with at least one key/value pair in the actual value being compared
|
||||
* @name jasmine.mapContaining
|
||||
@@ -525,7 +560,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* that will succeed if every item in the sample passes the deep equality comparison
|
||||
* with at least one item in the actual value being compared
|
||||
* @name jasmine.setContaining
|
||||
@@ -700,6 +735,21 @@ getJasmineRequireObj().util = function(j$) {
|
||||
}
|
||||
};
|
||||
|
||||
util.validateTimeout = function(timeout, msgPrefix) {
|
||||
// Timeouts are implemented with setTimeout, which only supports a limited
|
||||
// range of values. The limit is unspecified, as is the behavior when it's
|
||||
// exceeded. But on all currently supported JS runtimes, setTimeout calls
|
||||
// the callback immediately when the timeout is greater than 2147483647
|
||||
// (the maximum value of a signed 32 bit integer).
|
||||
var max = 2147483647;
|
||||
|
||||
if (timeout > max) {
|
||||
throw new Error(
|
||||
(msgPrefix || 'Timeout value') + ' cannot be greater than ' + max
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
return util;
|
||||
};
|
||||
|
||||
@@ -707,6 +757,7 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
/**
|
||||
* @interface Spec
|
||||
* @see Configuration#specFilter
|
||||
* @since 2.0.0
|
||||
*/
|
||||
function Spec(attrs) {
|
||||
this.expectationFactory = attrs.expectationFactory;
|
||||
@@ -717,6 +768,7 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
* @name Spec#id
|
||||
* @readonly
|
||||
* @type {string}
|
||||
* @since 2.0.0
|
||||
*/
|
||||
this.id = attrs.id;
|
||||
/**
|
||||
@@ -724,6 +776,7 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
* @name Spec#description
|
||||
* @readonly
|
||||
* @type {string}
|
||||
* @since 2.0.0
|
||||
*/
|
||||
this.description = attrs.description || '';
|
||||
this.queueableFn = attrs.queueableFn;
|
||||
@@ -738,6 +791,8 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
return {};
|
||||
};
|
||||
this.onStart = attrs.onStart || function() {};
|
||||
this.autoCleanClosures =
|
||||
attrs.autoCleanClosures === undefined ? true : !!attrs.autoCleanClosures;
|
||||
this.getSpecName =
|
||||
attrs.getSpecName ||
|
||||
function() {
|
||||
@@ -755,7 +810,7 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
this.timer = attrs.timer || new j$.Timer();
|
||||
|
||||
if (!this.queueableFn.fn) {
|
||||
this.pend();
|
||||
this.exclude();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -770,7 +825,8 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
* @property {String} status - Once the spec has completed, this string represents the pass/fail status of this spec.
|
||||
* @property {number} duration - The time in ms used by the spec execution, including any before/afterEach.
|
||||
* @property {Object} properties - User-supplied properties, if any, that were set using {@link Env#setSpecProperty}
|
||||
*/
|
||||
* @since 2.0.0
|
||||
x */
|
||||
this.result = {
|
||||
id: this.id,
|
||||
description: this.description,
|
||||
@@ -822,7 +878,9 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
|
||||
var complete = {
|
||||
fn: function(done) {
|
||||
self.queueableFn.fn = null;
|
||||
if (self.autoCleanClosures) {
|
||||
self.queueableFn.fn = null;
|
||||
}
|
||||
self.result.status = self.status(excluded, failSpecWithNoExp);
|
||||
self.result.duration = self.timer.elapsed();
|
||||
self.resultCallback(self.result, done);
|
||||
@@ -859,6 +917,36 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
this.queueRunnerFactory(runnerConfig);
|
||||
};
|
||||
|
||||
Spec.prototype.reset = function() {
|
||||
/**
|
||||
* @typedef SpecResult
|
||||
* @property {Int} id - The unique id of this spec.
|
||||
* @property {String} description - The description passed to the {@link it} that created this spec.
|
||||
* @property {String} fullName - The full description including all ancestors of this spec.
|
||||
* @property {Expectation[]} failedExpectations - The list of expectations that failed during execution of this spec.
|
||||
* @property {Expectation[]} passedExpectations - The list of expectations that passed during execution of this spec.
|
||||
* @property {Expectation[]} deprecationWarnings - The list of deprecation warnings that occurred during execution this spec.
|
||||
* @property {String} pendingReason - If the spec is {@link pending}, this will be the reason.
|
||||
* @property {String} status - Once the spec has completed, this string represents the pass/fail status of this spec.
|
||||
* @property {number} duration - The time in ms used by the spec execution, including any before/afterEach.
|
||||
* @property {Object} properties - User-supplied properties, if any, that were set using {@link Env#setSpecProperty}
|
||||
* @since 2.0.0
|
||||
*/
|
||||
this.result = {
|
||||
id: this.id,
|
||||
description: this.description,
|
||||
fullName: this.getFullName(),
|
||||
failedExpectations: [],
|
||||
passedExpectations: [],
|
||||
deprecationWarnings: [],
|
||||
pendingReason: this.excludeMessage,
|
||||
duration: null,
|
||||
properties: null,
|
||||
trace: null
|
||||
};
|
||||
this.markedPending = this.markedExcluding;
|
||||
};
|
||||
|
||||
Spec.prototype.onException = function onException(e) {
|
||||
if (Spec.isPendingSpecException(e)) {
|
||||
this.pend(extractCustomPendingMessage(e));
|
||||
@@ -882,6 +970,10 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
);
|
||||
};
|
||||
|
||||
/*
|
||||
* Marks state as pending
|
||||
* @param {string} [message] An optional reason message
|
||||
*/
|
||||
Spec.prototype.pend = function(message) {
|
||||
this.markedPending = true;
|
||||
if (message) {
|
||||
@@ -889,6 +981,19 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* Like {@link Spec#pend}, but pending state will survive {@link Spec#reset}
|
||||
* Useful for fit, xit, where pending state remains.
|
||||
* @param {string} [message] An optional reason message
|
||||
*/
|
||||
Spec.prototype.exclude = function(message) {
|
||||
this.markedExcluding = true;
|
||||
if (this.message) {
|
||||
this.excludeMessage = message;
|
||||
}
|
||||
this.pend(message);
|
||||
};
|
||||
|
||||
Spec.prototype.getResult = function() {
|
||||
this.result.status = this.status();
|
||||
return this.result;
|
||||
@@ -921,6 +1026,7 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
* @name Spec#getFullName
|
||||
* @function
|
||||
* @returns {string}
|
||||
* @since 2.0.0
|
||||
*/
|
||||
Spec.prototype.getFullName = function() {
|
||||
return this.getSpecName(this);
|
||||
@@ -1148,7 +1254,16 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
* @type function
|
||||
* @default undefined
|
||||
*/
|
||||
Promise: undefined
|
||||
Promise: undefined,
|
||||
/**
|
||||
* Clean closures when a suite is done running (done by clearing the stored function reference).
|
||||
* This prevents memory leaks, but you won't be able to run jasmine multiple times.
|
||||
* @name Configuration#autoCleanClosures
|
||||
* @since 3.10.0
|
||||
* @type boolean
|
||||
* @default true
|
||||
*/
|
||||
autoCleanClosures: true
|
||||
};
|
||||
|
||||
var currentSuite = function() {
|
||||
@@ -1201,7 +1316,8 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
var booleanProps = [
|
||||
'random',
|
||||
'failSpecWithNoExpectations',
|
||||
'hideDisabled'
|
||||
'hideDisabled',
|
||||
'autoCleanClosures'
|
||||
];
|
||||
|
||||
booleanProps.forEach(function(prop) {
|
||||
@@ -1442,7 +1558,9 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
}
|
||||
|
||||
delayedExpectationResult.message +=
|
||||
'Did you forget to return or await the result of expectAsync?';
|
||||
'1. Did you forget to return or await the result of expectAsync?\n' +
|
||||
'2. Was done() invoked before an async operation completed?\n' +
|
||||
'3. Did an expectation follow a call to done()?';
|
||||
|
||||
topSuite.result.failedExpectations.push(delayedExpectationResult);
|
||||
}
|
||||
@@ -1507,10 +1625,11 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
delete runnableResources[id];
|
||||
};
|
||||
|
||||
var beforeAndAfterFns = function(suite) {
|
||||
var beforeAndAfterFns = function(targetSuite) {
|
||||
return function() {
|
||||
var befores = [],
|
||||
afters = [];
|
||||
afters = [],
|
||||
suite = targetSuite;
|
||||
|
||||
while (suite) {
|
||||
befores = befores.concat(suite.beforeFns);
|
||||
@@ -1711,9 +1830,9 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
description: 'Jasmine__TopLevel__Suite',
|
||||
expectationFactory: expectationFactory,
|
||||
asyncExpectationFactory: suiteAsyncExpectationFactory,
|
||||
expectationResultFactory: expectationResultFactory
|
||||
expectationResultFactory: expectationResultFactory,
|
||||
autoCleanClosures: config.autoCleanClosures
|
||||
});
|
||||
defaultResourcesForRunnable(topSuite.id);
|
||||
currentDeclarationSuite = topSuite;
|
||||
|
||||
/**
|
||||
@@ -1722,6 +1841,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
* @function
|
||||
* @name Env#topSuite
|
||||
* @return {Suite} the root suite
|
||||
* @since 2.0.0
|
||||
*/
|
||||
this.topSuite = function() {
|
||||
return topSuite;
|
||||
@@ -1830,6 +1950,11 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
* @return {Promise<undefined>}
|
||||
*/
|
||||
this.execute = function(runnablesToRun, onComplete) {
|
||||
if (this._executedBefore) {
|
||||
topSuite.reset();
|
||||
}
|
||||
this._executedBefore = true;
|
||||
defaultResourcesForRunnable(topSuite.id);
|
||||
installGlobalErrors();
|
||||
|
||||
if (!runnablesToRun) {
|
||||
@@ -1913,6 +2038,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
* @typedef JasmineStartedInfo
|
||||
* @property {Int} totalSpecsDefined - The total number of specs defined in this suite.
|
||||
* @property {Order} order - Information about the ordering (random or not) of this execution of the suite.
|
||||
* @since 2.0.0
|
||||
*/
|
||||
reporter.jasmineStarted(
|
||||
{
|
||||
@@ -1951,6 +2077,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
* @property {Order} order - Information about the ordering (random or not) of this execution of the suite.
|
||||
* @property {Expectation[]} failedExpectations - List of expectations that failed in an {@link afterAll} at the global level.
|
||||
* @property {Expectation[]} deprecationWarnings - List of deprecation warnings that occurred at the global level.
|
||||
* @since 2.4.0
|
||||
*/
|
||||
reporter.jasmineDone(
|
||||
{
|
||||
@@ -2114,7 +2241,8 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
expectationFactory: expectationFactory,
|
||||
asyncExpectationFactory: suiteAsyncExpectationFactory,
|
||||
expectationResultFactory: expectationResultFactory,
|
||||
throwOnExpectationFailure: config.oneFailurePerSpec
|
||||
throwOnExpectationFailure: config.oneFailurePerSpec,
|
||||
autoCleanClosures: config.autoCleanClosures
|
||||
});
|
||||
|
||||
return suite;
|
||||
@@ -2127,8 +2255,8 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
if (specDefinitions.length > 0) {
|
||||
throw new Error('describe does not expect any arguments');
|
||||
}
|
||||
if (currentDeclarationSuite.markedPending) {
|
||||
suite.pend();
|
||||
if (currentDeclarationSuite.markedExcluding) {
|
||||
suite.exclude();
|
||||
}
|
||||
addSpecsToSuite(suite, specDefinitions);
|
||||
return suite;
|
||||
@@ -2138,7 +2266,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
ensureIsNotNested('xdescribe');
|
||||
ensureIsFunction(specDefinitions, 'xdescribe');
|
||||
var suite = suiteFactory(description);
|
||||
suite.pend();
|
||||
suite.exclude();
|
||||
addSpecsToSuite(suite, specDefinitions);
|
||||
return suite;
|
||||
};
|
||||
@@ -2223,6 +2351,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
timeout: timeout || 0
|
||||
},
|
||||
throwOnExpectationFailure: config.oneFailurePerSpec,
|
||||
autoCleanClosures: config.autoCleanClosures,
|
||||
timer: new j$.Timer()
|
||||
});
|
||||
return spec;
|
||||
@@ -2252,9 +2381,14 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
if (arguments.length > 1 && typeof fn !== 'undefined') {
|
||||
ensureIsFunctionOrAsync(fn, 'it');
|
||||
}
|
||||
|
||||
if (timeout) {
|
||||
j$.util.validateTimeout(timeout);
|
||||
}
|
||||
|
||||
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
|
||||
if (currentDeclarationSuite.markedPending) {
|
||||
spec.pend();
|
||||
if (currentDeclarationSuite.markedExcluding) {
|
||||
spec.exclude();
|
||||
}
|
||||
currentDeclarationSuite.addChild(spec);
|
||||
return spec;
|
||||
@@ -2268,13 +2402,17 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
ensureIsFunctionOrAsync(fn, 'xit');
|
||||
}
|
||||
var spec = this.it.apply(this, arguments);
|
||||
spec.pend('Temporarily disabled with xit');
|
||||
spec.exclude('Temporarily disabled with xit');
|
||||
return spec;
|
||||
};
|
||||
|
||||
this.fit = function(description, fn, timeout) {
|
||||
ensureIsNotNested('fit');
|
||||
ensureIsFunctionOrAsync(fn, 'fit');
|
||||
|
||||
if (timeout) {
|
||||
j$.util.validateTimeout(timeout);
|
||||
}
|
||||
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
|
||||
currentDeclarationSuite.addChild(spec);
|
||||
focusedRunnables.push(spec.id);
|
||||
@@ -2339,6 +2477,11 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
this.beforeEach = function(beforeEachFunction, timeout) {
|
||||
ensureIsNotNested('beforeEach');
|
||||
ensureIsFunctionOrAsync(beforeEachFunction, 'beforeEach');
|
||||
|
||||
if (timeout) {
|
||||
j$.util.validateTimeout(timeout);
|
||||
}
|
||||
|
||||
currentDeclarationSuite.beforeEach({
|
||||
fn: beforeEachFunction,
|
||||
timeout: timeout || 0
|
||||
@@ -2348,6 +2491,11 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
this.beforeAll = function(beforeAllFunction, timeout) {
|
||||
ensureIsNotNested('beforeAll');
|
||||
ensureIsFunctionOrAsync(beforeAllFunction, 'beforeAll');
|
||||
|
||||
if (timeout) {
|
||||
j$.util.validateTimeout(timeout);
|
||||
}
|
||||
|
||||
currentDeclarationSuite.beforeAll({
|
||||
fn: beforeAllFunction,
|
||||
timeout: timeout || 0
|
||||
@@ -2357,6 +2505,11 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
this.afterEach = function(afterEachFunction, timeout) {
|
||||
ensureIsNotNested('afterEach');
|
||||
ensureIsFunctionOrAsync(afterEachFunction, 'afterEach');
|
||||
|
||||
if (timeout) {
|
||||
j$.util.validateTimeout(timeout);
|
||||
}
|
||||
|
||||
afterEachFunction.isCleanup = true;
|
||||
currentDeclarationSuite.afterEach({
|
||||
fn: afterEachFunction,
|
||||
@@ -2367,6 +2520,11 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
this.afterAll = function(afterAllFunction, timeout) {
|
||||
ensureIsNotNested('afterAll');
|
||||
ensureIsFunctionOrAsync(afterAllFunction, 'afterAll');
|
||||
|
||||
if (timeout) {
|
||||
j$.util.validateTimeout(timeout);
|
||||
}
|
||||
|
||||
currentDeclarationSuite.afterAll({
|
||||
fn: afterAllFunction,
|
||||
timeout: timeout || 0
|
||||
@@ -2926,6 +3084,31 @@ getJasmineRequireObj().SetContaining = function(j$) {
|
||||
return SetContaining;
|
||||
};
|
||||
|
||||
getJasmineRequireObj().StringContaining = function(j$) {
|
||||
function StringContaining(expected) {
|
||||
if (!j$.isString_(expected)) {
|
||||
throw new Error('Expected is not a String');
|
||||
}
|
||||
|
||||
this.expected = expected;
|
||||
}
|
||||
|
||||
StringContaining.prototype.asymmetricMatch = function(other) {
|
||||
if (!j$.isString_(other)) {
|
||||
// Arrays, etc. don't match no matter what their indexOf returns.
|
||||
return false;
|
||||
}
|
||||
|
||||
return other.indexOf(this.expected) !== -1;
|
||||
};
|
||||
|
||||
StringContaining.prototype.jasmineToString = function() {
|
||||
return '<jasmine.stringContaining("' + this.expected + '")>';
|
||||
};
|
||||
|
||||
return StringContaining;
|
||||
};
|
||||
|
||||
getJasmineRequireObj().StringMatching = function(j$) {
|
||||
function StringMatching(expected) {
|
||||
if (!j$.isString_(expected) && !j$.isA_('RegExp', expected)) {
|
||||
@@ -3122,6 +3305,7 @@ getJasmineRequireObj().CallTracker = function(j$) {
|
||||
/**
|
||||
* Get the "this" object that was passed to a specific invocation of this spy.
|
||||
* @name Spy#calls#thisFor
|
||||
* @since 3.8.0
|
||||
* @function
|
||||
* @param {Integer} index The 0-based invocation index.
|
||||
* @return {Object?}
|
||||
@@ -3283,6 +3467,7 @@ getJasmineRequireObj().Clock = function() {
|
||||
|
||||
/**
|
||||
* @class Clock
|
||||
* @since 1.3.0
|
||||
* @classdesc Jasmine's mock clock is used when testing time dependent code.<br>
|
||||
* _Note:_ Do not construct this directly. You can get the current clock with
|
||||
* {@link jasmine.clock}.
|
||||
@@ -3925,6 +4110,7 @@ getJasmineRequireObj().Expectation = function(j$) {
|
||||
* Otherwise evaluate the matcher.
|
||||
* @member
|
||||
* @name async-matchers#already
|
||||
* @since 3.8.0
|
||||
* @type {async-matchers}
|
||||
* @example
|
||||
* await expectAsync(myPromise).already.toBeResolved();
|
||||
@@ -5571,9 +5757,33 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
|
||||
/**
|
||||
* @interface AsymmetricEqualityTester
|
||||
* @classdesc An asymmetric equality tester is an object that can match multiple
|
||||
* objects. Examples include jasmine.any() and jasmine.stringMatching().
|
||||
* User-defined asymmetric equality testers can also be defined and used in
|
||||
* expectations.
|
||||
* objects. Examples include jasmine.any() and jasmine.stringMatching(). Jasmine
|
||||
* includes a number of built-in asymmetric equality testers, such as
|
||||
* {@link jasmine.objectContaining}. User-defined asymmetric equality testers are
|
||||
* also supported.
|
||||
*
|
||||
* Asymmetric equality testers work with any matcher, including user-defined
|
||||
* custom matchers, that uses {@link MatchersUtil#equals} or
|
||||
* {@link MatchersUtil#contains}.
|
||||
*
|
||||
* @example
|
||||
* function numberDivisibleBy(divisor) {
|
||||
* return {
|
||||
* asymmetricMatch: function(n) {
|
||||
* return typeof n === 'number' && n % divisor === 0;
|
||||
* },
|
||||
* jasmineToString: function() {
|
||||
* return `<a number divisible by ${divisor}>`;
|
||||
* }
|
||||
* };
|
||||
* }
|
||||
*
|
||||
* var actual = {
|
||||
* n: 2,
|
||||
* otherFields: "don't care"
|
||||
* };
|
||||
*
|
||||
* expect(actual).toEqual(jasmine.objectContaining({n: numberDivisibleBy(2)}));
|
||||
* @see custom_asymmetric_equality_testers
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@@ -7799,7 +8009,6 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
||||
completedSynchronously = true,
|
||||
handleError = function handleError(error) {
|
||||
onException(error);
|
||||
next(error);
|
||||
},
|
||||
cleanup = once(function cleanup() {
|
||||
if (timeoutId !== void 0) {
|
||||
@@ -9342,6 +9551,7 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
/**
|
||||
* @interface Suite
|
||||
* @see Env#topSuite
|
||||
* @since 2.0.0
|
||||
*/
|
||||
function Suite(attrs) {
|
||||
this.env = attrs.env;
|
||||
@@ -9350,6 +9560,7 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
* @name Suite#id
|
||||
* @readonly
|
||||
* @type {string}
|
||||
* @since 2.0.0
|
||||
*/
|
||||
this.id = attrs.id;
|
||||
/**
|
||||
@@ -9364,12 +9575,15 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
* @name Suite#description
|
||||
* @readonly
|
||||
* @type {string}
|
||||
* @since 2.0.0
|
||||
*/
|
||||
this.description = attrs.description;
|
||||
this.expectationFactory = attrs.expectationFactory;
|
||||
this.asyncExpectationFactory = attrs.asyncExpectationFactory;
|
||||
this.expectationResultFactory = attrs.expectationResultFactory;
|
||||
this.throwOnExpectationFailure = !!attrs.throwOnExpectationFailure;
|
||||
this.autoCleanClosures =
|
||||
attrs.autoCleanClosures === undefined ? true : !!attrs.autoCleanClosures;
|
||||
|
||||
this.beforeFns = [];
|
||||
this.afterFns = [];
|
||||
@@ -9382,29 +9596,11 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
* The suite's children.
|
||||
* @name Suite#children
|
||||
* @type {Array.<(Spec|Suite)>}
|
||||
* @since 2.0.0
|
||||
*/
|
||||
this.children = [];
|
||||
|
||||
/**
|
||||
* @typedef SuiteResult
|
||||
* @property {Int} id - The unique id of this suite.
|
||||
* @property {String} description - The description text passed to the {@link describe} that made this suite.
|
||||
* @property {String} fullName - The full description including all ancestors of this suite.
|
||||
* @property {Expectation[]} failedExpectations - The list of expectations that failed in an {@link afterAll} for this suite.
|
||||
* @property {Expectation[]} deprecationWarnings - The list of deprecation warnings that occurred on this suite.
|
||||
* @property {String} status - Once the suite has completed, this string represents the pass/fail status of this suite.
|
||||
* @property {number} duration - The time in ms for Suite execution, including any before/afterAll, before/afterEach.
|
||||
* @property {Object} properties - User-supplied properties, if any, that were set using {@link Env#setSuiteProperty}
|
||||
*/
|
||||
this.result = {
|
||||
id: this.id,
|
||||
description: this.description,
|
||||
fullName: this.getFullName(),
|
||||
failedExpectations: [],
|
||||
deprecationWarnings: [],
|
||||
duration: null,
|
||||
properties: null
|
||||
};
|
||||
this.reset();
|
||||
}
|
||||
|
||||
Suite.prototype.setSuiteProperty = function(key, value) {
|
||||
@@ -9425,6 +9621,7 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
* @name Suite#getFullName
|
||||
* @function
|
||||
* @returns {string}
|
||||
* @since 2.0.0
|
||||
*/
|
||||
Suite.prototype.getFullName = function() {
|
||||
var fullName = [];
|
||||
@@ -9440,10 +9637,22 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
return fullName.join(' ');
|
||||
};
|
||||
|
||||
/*
|
||||
* Mark the suite with "pending" status
|
||||
*/
|
||||
Suite.prototype.pend = function() {
|
||||
this.markedPending = true;
|
||||
};
|
||||
|
||||
/*
|
||||
* Like {@link Suite#pend}, but pending state will survive {@link Spec#reset}
|
||||
* Useful for fdescribe, xdescribe, where pending state should remain.
|
||||
*/
|
||||
Suite.prototype.exclude = function() {
|
||||
this.pend();
|
||||
this.markedExcluding = true;
|
||||
};
|
||||
|
||||
Suite.prototype.beforeEach = function(fn) {
|
||||
this.beforeFns.unshift(fn);
|
||||
};
|
||||
@@ -9475,10 +9684,40 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
}
|
||||
|
||||
Suite.prototype.cleanupBeforeAfter = function() {
|
||||
removeFns(this.beforeAllFns);
|
||||
removeFns(this.afterAllFns);
|
||||
removeFns(this.beforeFns);
|
||||
removeFns(this.afterFns);
|
||||
if (this.autoCleanClosures) {
|
||||
removeFns(this.beforeAllFns);
|
||||
removeFns(this.afterAllFns);
|
||||
removeFns(this.beforeFns);
|
||||
removeFns(this.afterFns);
|
||||
}
|
||||
};
|
||||
|
||||
Suite.prototype.reset = function() {
|
||||
/**
|
||||
* @typedef SuiteResult
|
||||
* @property {Int} id - The unique id of this suite.
|
||||
* @property {String} description - The description text passed to the {@link describe} that made this suite.
|
||||
* @property {String} fullName - The full description including all ancestors of this suite.
|
||||
* @property {Expectation[]} failedExpectations - The list of expectations that failed in an {@link afterAll} for this suite.
|
||||
* @property {Expectation[]} deprecationWarnings - The list of deprecation warnings that occurred on this suite.
|
||||
* @property {String} status - Once the suite has completed, this string represents the pass/fail status of this suite.
|
||||
* @property {number} duration - The time in ms for Suite execution, including any before/afterAll, before/afterEach.
|
||||
* @property {Object} properties - User-supplied properties, if any, that were set using {@link Env#setSuiteProperty}
|
||||
* @since 2.0.0
|
||||
*/
|
||||
this.result = {
|
||||
id: this.id,
|
||||
description: this.description,
|
||||
fullName: this.getFullName(),
|
||||
failedExpectations: [],
|
||||
deprecationWarnings: [],
|
||||
duration: null,
|
||||
properties: null
|
||||
};
|
||||
this.markedPending = this.markedExcluding;
|
||||
this.children.forEach(function(child) {
|
||||
child.reset();
|
||||
});
|
||||
};
|
||||
|
||||
Suite.prototype.addChild = function(child) {
|
||||
@@ -9872,5 +10111,5 @@ getJasmineRequireObj().UserContext = function(j$) {
|
||||
};
|
||||
|
||||
getJasmineRequireObj().version = function() {
|
||||
return '3.9.0';
|
||||
return '3.10.1';
|
||||
};
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
#
|
||||
module Jasmine
|
||||
module Core
|
||||
VERSION = "3.9.0"
|
||||
VERSION = "3.10.1"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jasmine-core",
|
||||
"license": "MIT",
|
||||
"version": "3.9.0",
|
||||
"version": "3.10.1",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jasmine/jasmine.git"
|
||||
|
||||
57
release_notes/3.10.0.md
Normal file
57
release_notes/3.10.0.md
Normal file
@@ -0,0 +1,57 @@
|
||||
# Jasmine Core 3.10 Release Notes
|
||||
|
||||
## New features and bug fixes
|
||||
|
||||
* Added support for running Jasmine multiple times
|
||||
* If the env is configured with `autoCleanClosures: false`, then it can be
|
||||
executed repeatedly.
|
||||
* Merges #1934 from @nicojs
|
||||
* Fixes #1925
|
||||
|
||||
* Improved error message when an async expectation occurs after the spec
|
||||
finishes
|
||||
* Merges #1937 from @AndreWillomitzer
|
||||
* Fixes #1854
|
||||
|
||||
* Reject timeout values that are too large for setTimeout
|
||||
* See #1930
|
||||
|
||||
* Don't immediately move to the next queueable fn on async error
|
||||
|
||||
This allows assertion failures and other errors that occur after the async
|
||||
error to be routed to the correct spec/suite.
|
||||
|
||||
* Added a stringContaining asymmetric equality tester
|
||||
* Fixes #1923.
|
||||
|
||||
* The jasmine-core Ruby gem now prints a deprecation message when loaded unless
|
||||
the SUPPRESS_JASMINE_DEPRECATION environment variable is set.
|
||||
|
||||
|
||||
## Documentation updates
|
||||
|
||||
* Added discussion of max timeout value to jsdocs
|
||||
* Merges #1931 from @trusktr
|
||||
|
||||
* Added missing @since annotations
|
||||
|
||||
* Improved jsdocs for asymmetric equality testers
|
||||
|
||||
* Added a deprecation notice to the jasmine-core Ruby gem's description
|
||||
|
||||
## Supported environments
|
||||
|
||||
jasmine-core 3.10.0 has been tested in the following environments.
|
||||
|
||||
| Environment | Supported versions |
|
||||
|-------------------|--------------------|
|
||||
| Node | 10, 12, 14, 16 |
|
||||
| Safari | 8-14 |
|
||||
| Chrome | 94 |
|
||||
| Firefox | 93, 78, 68 |
|
||||
| Edge | 94 |
|
||||
| Internet Explorer | 10, 11 |
|
||||
|
||||
------
|
||||
|
||||
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
||||
12
release_notes/3.10.1.md
Normal file
12
release_notes/3.10.1.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# Jasmine Core 3.10.1 Release Notes
|
||||
|
||||
## Bugfixes
|
||||
|
||||
* Fixed missing pendingReason in pending spec results
|
||||
* Fixes [#1939](https://github.com/jasmine/jasmine/issues/1939)
|
||||
* Merges [#1940](https://github.com/jasmine/jasmine/pull/1940) from @jan-molak
|
||||
|
||||
|
||||
------
|
||||
|
||||
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
||||
@@ -50,7 +50,7 @@ If `jasmine-browser-runner` doesn't meet your needs, one of these might:
|
||||
|
||||
## Supported environments
|
||||
|
||||
jasmine-core 3.8.0 has been tested in the following environments.
|
||||
jasmine-core 3.9.0 has been tested in the following environments.
|
||||
|
||||
| Environment | Supported versions |
|
||||
|-------------------|--------------------|
|
||||
|
||||
@@ -256,12 +256,30 @@ describe('Env', function() {
|
||||
env.it('async', jasmine.getEnv().makeAsyncAwaitFunction());
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
it('throws an error when the timeout value is too large for setTimeout', function() {
|
||||
expect(function() {
|
||||
env.it('huge timeout', function() {}, 2147483648);
|
||||
}).toThrowError('Timeout value cannot be greater than 2147483647');
|
||||
});
|
||||
});
|
||||
|
||||
describe('#xit', function() {
|
||||
it('calls spec.exclude with "Temporarily disabled with xit"', function() {
|
||||
var excludeSpy = jasmine.createSpy();
|
||||
spyOn(env, 'it').and.returnValue({
|
||||
exclude: excludeSpy
|
||||
});
|
||||
env.xit('foo', function() {});
|
||||
expect(excludeSpy).toHaveBeenCalledWith('Temporarily disabled with xit');
|
||||
});
|
||||
|
||||
it('calls spec.pend with "Temporarily disabled with xit"', function() {
|
||||
var pendSpy = jasmine.createSpy();
|
||||
var realExclude = jasmineUnderTest.Spec.prototype.exclude;
|
||||
|
||||
spyOn(env, 'it').and.returnValue({
|
||||
exclude: realExclude,
|
||||
pend: pendSpy
|
||||
});
|
||||
env.xit('foo', function() {});
|
||||
@@ -298,6 +316,12 @@ describe('Env', function() {
|
||||
/fit expects a function argument; received \[object (Undefined|DOMWindow|Object)\]/
|
||||
);
|
||||
});
|
||||
|
||||
it('throws an error when the timeout value is too large for setTimeout', function() {
|
||||
expect(function() {
|
||||
env.fit('huge timeout', function() {}, 2147483648);
|
||||
}).toThrowError('Timeout value cannot be greater than 2147483647');
|
||||
});
|
||||
});
|
||||
|
||||
describe('#beforeEach', function() {
|
||||
@@ -315,6 +339,12 @@ describe('Env', function() {
|
||||
env.beforeEach(jasmine.getEnv().makeAsyncAwaitFunction());
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
it('throws an error when the timeout value is too large for setTimeout', function() {
|
||||
expect(function() {
|
||||
env.beforeEach(function() {}, 2147483648);
|
||||
}).toThrowError('Timeout value cannot be greater than 2147483647');
|
||||
});
|
||||
});
|
||||
|
||||
describe('#beforeAll', function() {
|
||||
@@ -332,6 +362,12 @@ describe('Env', function() {
|
||||
env.beforeAll(jasmine.getEnv().makeAsyncAwaitFunction());
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
it('throws an error when the timeout value is too large for setTimeout', function() {
|
||||
expect(function() {
|
||||
env.beforeAll(function() {}, 2147483648);
|
||||
}).toThrowError('Timeout value cannot be greater than 2147483647');
|
||||
});
|
||||
});
|
||||
|
||||
describe('#afterEach', function() {
|
||||
@@ -349,6 +385,12 @@ describe('Env', function() {
|
||||
env.afterEach(jasmine.getEnv().makeAsyncAwaitFunction());
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
it('throws an error when the timeout value is too large for setTimeout', function() {
|
||||
expect(function() {
|
||||
env.afterEach(function() {}, 2147483648);
|
||||
}).toThrowError('Timeout value cannot be greater than 2147483647');
|
||||
});
|
||||
});
|
||||
|
||||
describe('#afterAll', function() {
|
||||
@@ -366,6 +408,12 @@ describe('Env', function() {
|
||||
env.afterAll(jasmine.getEnv().makeAsyncAwaitFunction());
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
it('throws an error when the timeout value is too large for setTimeout', function() {
|
||||
expect(function() {
|
||||
env.afterAll(function() {}, 2147483648);
|
||||
}).toThrowError('Timeout value cannot be greater than 2147483647');
|
||||
});
|
||||
});
|
||||
|
||||
describe('when not constructed with suppressLoadErrors: true', function() {
|
||||
@@ -485,5 +533,18 @@ describe('Env', function() {
|
||||
jasmine.getEnv().requireNoPromises();
|
||||
expect(env.execute()).toBeUndefined();
|
||||
});
|
||||
|
||||
it('should reset the topSuite when run twice', function() {
|
||||
jasmine.getEnv().requirePromises();
|
||||
spyOn(env.topSuite(), 'reset');
|
||||
return env
|
||||
.execute() // 1
|
||||
.then(function() {
|
||||
return env.execute(); // 2
|
||||
})
|
||||
.then(function() {
|
||||
expect(env.topSuite().reset).toHaveBeenCalledOnceWith();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -669,9 +669,13 @@ describe('QueueRunner', function() {
|
||||
jasmine.clock().uninstall();
|
||||
});
|
||||
|
||||
it('skips to cleanup functions on the first exception', function() {
|
||||
it('skips to cleanup functions once the fn completes after an unhandled exception', function() {
|
||||
var errorListeners = [],
|
||||
queueableFn = { fn: function(done) {} },
|
||||
queueableFn = {
|
||||
fn: function(done) {
|
||||
queueableFnDone = done;
|
||||
}
|
||||
},
|
||||
nextQueueableFn = { fn: jasmine.createSpy('nextFunction') },
|
||||
cleanupFn = { fn: jasmine.createSpy('cleanup') },
|
||||
queueRunner = new jasmineUnderTest.QueueRunner({
|
||||
@@ -686,10 +690,13 @@ describe('QueueRunner', function() {
|
||||
queueableFns: [queueableFn, nextQueueableFn],
|
||||
cleanupFns: [cleanupFn],
|
||||
completeOnFirstError: true
|
||||
});
|
||||
}),
|
||||
queueableFnDone;
|
||||
|
||||
queueRunner.execute();
|
||||
errorListeners[errorListeners.length - 1](new Error('error'));
|
||||
expect(cleanupFn.fn).not.toHaveBeenCalled();
|
||||
queueableFnDone();
|
||||
expect(nextQueueableFn.fn).not.toHaveBeenCalled();
|
||||
expect(cleanupFn.fn).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
@@ -142,4 +142,86 @@ describe('Suite', function() {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('attr.autoCleanClosures', function() {
|
||||
function arrangeSuite(attrs) {
|
||||
var suite = new jasmineUnderTest.Suite(attrs);
|
||||
suite.beforeAll(function() {});
|
||||
suite.beforeEach(function() {});
|
||||
suite.afterEach(function() {});
|
||||
suite.afterAll(function() {});
|
||||
return suite;
|
||||
}
|
||||
|
||||
it('should clean closures when "attr.autoCleanClosures" is missing', function() {
|
||||
var suite = arrangeSuite({});
|
||||
suite.cleanupBeforeAfter();
|
||||
expect(suite.beforeAllFns[0].fn).toBe(null);
|
||||
expect(suite.beforeFns[0].fn).toBe(null);
|
||||
expect(suite.afterFns[0].fn).toBe(null);
|
||||
expect(suite.afterAllFns[0].fn).toBe(null);
|
||||
});
|
||||
|
||||
it('should clean closures when "attr.autoCleanClosures" is true', function() {
|
||||
var suite = arrangeSuite({ autoCleanClosures: true });
|
||||
suite.cleanupBeforeAfter();
|
||||
expect(suite.beforeAllFns[0].fn).toBe(null);
|
||||
expect(suite.beforeFns[0].fn).toBe(null);
|
||||
expect(suite.afterFns[0].fn).toBe(null);
|
||||
expect(suite.afterAllFns[0].fn).toBe(null);
|
||||
});
|
||||
|
||||
it('should NOT clean closures when "attr.autoCleanClosures" is false', function() {
|
||||
var suite = arrangeSuite({ autoCleanClosures: false });
|
||||
suite.cleanupBeforeAfter();
|
||||
expect(suite.beforeAllFns[0].fn).not.toBe(null);
|
||||
expect(suite.beforeFns[0].fn).not.toBe(null);
|
||||
expect(suite.afterFns[0].fn).not.toBe(null);
|
||||
expect(suite.afterAllFns[0].fn).not.toBe(null);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#reset', function() {
|
||||
it('should reset the "pending" status', function() {
|
||||
var suite = new jasmineUnderTest.Suite({});
|
||||
suite.pend();
|
||||
suite.reset();
|
||||
expect(suite.getResult().status).toBe('passed');
|
||||
});
|
||||
|
||||
it('should not reset the "pending" status when the suite was excluded', function() {
|
||||
var suite = new jasmineUnderTest.Suite({});
|
||||
suite.exclude();
|
||||
suite.reset();
|
||||
expect(suite.getResult().status).toBe('pending');
|
||||
});
|
||||
|
||||
it('should also reset the children', function() {
|
||||
var suite = new jasmineUnderTest.Suite({});
|
||||
var child1 = jasmine.createSpyObj(['reset']);
|
||||
var child2 = jasmine.createSpyObj(['reset']);
|
||||
suite.addChild(child1);
|
||||
suite.addChild(child2);
|
||||
|
||||
suite.reset();
|
||||
|
||||
expect(child1.reset).toHaveBeenCalled();
|
||||
expect(child2.reset).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should reset the failedExpectations', function() {
|
||||
var suite = new jasmineUnderTest.Suite({
|
||||
expectationResultFactory: function(error) {
|
||||
return error;
|
||||
}
|
||||
});
|
||||
suite.onException(new Error());
|
||||
|
||||
suite.reset();
|
||||
|
||||
var result = suite.getResult();
|
||||
expect(result.status).toBe('passed');
|
||||
expect(result.failedExpectations).toHaveSize(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
27
spec/core/asymmetric_equality/StringContainingSpec.js
Normal file
27
spec/core/asymmetric_equality/StringContainingSpec.js
Normal file
@@ -0,0 +1,27 @@
|
||||
describe('StringContaining', function() {
|
||||
it('searches for a provided substring when the expected is a String', function() {
|
||||
var matcher = new jasmineUnderTest.StringContaining('foo');
|
||||
|
||||
expect(matcher.asymmetricMatch('barfoobaz')).toBe(true);
|
||||
expect(matcher.asymmetricMatch('barbaz')).toBe(false);
|
||||
});
|
||||
|
||||
it('raises an Error when the expected is not a String', function() {
|
||||
expect(function() {
|
||||
new jasmineUnderTest.StringContaining(/foo/);
|
||||
}).toThrowError(/not a String/);
|
||||
});
|
||||
|
||||
it('fails when the actual is not a String', function() {
|
||||
var matcher = new jasmineUnderTest.StringContaining('x');
|
||||
expect(matcher.asymmetricMatch(['x'])).toBe(false);
|
||||
});
|
||||
|
||||
it("jasmineToString's itself", function() {
|
||||
var matching = new jasmineUnderTest.StringContaining('foo');
|
||||
|
||||
expect(matching.jasmineToString()).toEqual(
|
||||
'<jasmine.stringContaining("foo")>'
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -141,4 +141,49 @@ describe('base helpers', function() {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('DEFAULT_TIMEOUT_INTERVAL setter', function() {
|
||||
var max = 2147483647;
|
||||
|
||||
beforeEach(function() {
|
||||
this.initialValue = jasmineUnderTest.DEFAULT_TIMEOUT_INTERVAL;
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
jasmineUnderTest.DEFAULT_TIMEOUT_INTERVAL = this.initialValue;
|
||||
});
|
||||
|
||||
it('accepts only values <= ' + max, function() {
|
||||
expect(function() {
|
||||
jasmineUnderTest.DEFAULT_TIMEOUT_INTERVAL = max + 1;
|
||||
}).toThrowError(
|
||||
'jasmine.DEFAULT_TIMEOUT_INTERVAL cannot be greater than ' + max
|
||||
);
|
||||
|
||||
jasmineUnderTest.DEFAULT_TIMEOUT_INTERVAL = max;
|
||||
expect(jasmineUnderTest.DEFAULT_TIMEOUT_INTERVAL).toEqual(max);
|
||||
});
|
||||
|
||||
it('is consistent with setTimeout in this environment', function(done) {
|
||||
var f1 = jasmine.createSpy('setTimeout callback for ' + max),
|
||||
f2 = jasmine.createSpy('setTimeout callback for ' + (max + 1)),
|
||||
id;
|
||||
|
||||
// Suppress printing of TimeoutOverflowWarning in node
|
||||
spyOn(console, 'error');
|
||||
|
||||
id = setTimeout(f1, max);
|
||||
setTimeout(function() {
|
||||
clearTimeout(id);
|
||||
expect(f1).not.toHaveBeenCalled();
|
||||
|
||||
id = setTimeout(f2, max + 1);
|
||||
setTimeout(function() {
|
||||
clearTimeout(id);
|
||||
expect(f2).toHaveBeenCalled();
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -231,6 +231,16 @@ describe('Asymmetric equality testers (Integration)', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('stringContaining', function() {
|
||||
verifyPasses(function(env) {
|
||||
env.expect('foo').toEqual(jasmineUnderTest.stringContaining('o'));
|
||||
});
|
||||
|
||||
verifyFails(function(env) {
|
||||
env.expect('bar').toEqual(jasmineUnderTest.stringContaining('o'));
|
||||
});
|
||||
});
|
||||
|
||||
describe('truthy', function() {
|
||||
verifyPasses(function(env) {
|
||||
env.expect(true).toEqual(jasmineUnderTest.truthy());
|
||||
|
||||
@@ -465,7 +465,7 @@ describe('Env integration', function() {
|
||||
|
||||
var global = {
|
||||
setTimeout: function(fn, delay) {
|
||||
setTimeout(fn, delay);
|
||||
return setTimeout(fn, delay);
|
||||
},
|
||||
clearTimeout: function(fn, delay) {
|
||||
clearTimeout(fn, delay);
|
||||
@@ -1018,7 +1018,7 @@ describe('Env integration', function() {
|
||||
var globalSetTimeout = jasmine
|
||||
.createSpy('globalSetTimeout')
|
||||
.and.callFake(function(cb, t) {
|
||||
setTimeout(cb, t);
|
||||
return setTimeout(cb, t);
|
||||
}),
|
||||
delayedFunctionForGlobalClock = jasmine.createSpy(
|
||||
'delayedFunctionForGlobalClock'
|
||||
@@ -1033,7 +1033,7 @@ describe('Env integration', function() {
|
||||
setTimeout: globalSetTimeout,
|
||||
clearTimeout: clearTimeout,
|
||||
setImmediate: function(cb) {
|
||||
setTimeout(cb, 0);
|
||||
return setTimeout(cb, 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1108,7 +1108,7 @@ describe('Env integration', function() {
|
||||
setInterval: setInterval,
|
||||
clearInterval: clearInterval,
|
||||
setImmediate: function(cb) {
|
||||
realSetTimeout(cb, 0);
|
||||
return realSetTimeout(cb, 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -2255,7 +2255,7 @@ describe('Env integration', function() {
|
||||
it('reports errors that occur during loading', function(done) {
|
||||
var global = {
|
||||
setTimeout: function(fn, delay) {
|
||||
setTimeout(fn, delay);
|
||||
return setTimeout(fn, delay);
|
||||
},
|
||||
clearTimeout: function(fn, delay) {
|
||||
clearTimeout(fn, delay);
|
||||
@@ -2312,7 +2312,7 @@ describe('Env integration', function() {
|
||||
var originalOnerror = jasmine.createSpy('original onerror');
|
||||
var global = {
|
||||
setTimeout: function(fn, delay) {
|
||||
setTimeout(fn, delay);
|
||||
return setTimeout(fn, delay);
|
||||
},
|
||||
clearTimeout: function(fn, delay) {
|
||||
clearTimeout(fn, delay);
|
||||
@@ -2513,7 +2513,7 @@ describe('Env integration', function() {
|
||||
it('is "failed"', function(done) {
|
||||
var global = {
|
||||
setTimeout: function(fn, delay) {
|
||||
setTimeout(fn, delay);
|
||||
return setTimeout(fn, delay);
|
||||
},
|
||||
clearTimeout: function(fn, delay) {
|
||||
clearTimeout(fn, delay);
|
||||
@@ -2835,10 +2835,6 @@ describe('Env integration', function() {
|
||||
});
|
||||
|
||||
it('provides custom equality testers to async matchers', function(done) {
|
||||
if (jasmine.getEnv().skipBrowserFlake) {
|
||||
jasmine.getEnv().skipBrowserFlake();
|
||||
}
|
||||
|
||||
jasmine.getEnv().requirePromises();
|
||||
|
||||
var specDone = jasmine.createSpy('specDone');
|
||||
@@ -2936,7 +2932,9 @@ describe('Env integration', function() {
|
||||
message:
|
||||
'Spec "a suite does not wait" ran a "toBeResolved" expectation ' +
|
||||
'after it finished.\n' +
|
||||
'Did you forget to return or await the result of expectAsync?',
|
||||
'1. Did you forget to return or await the result of expectAsync?\n' +
|
||||
'2. Was done() invoked before an async operation completed?\n' +
|
||||
'3. Did an expectation follow a call to done()?',
|
||||
matcherName: 'toBeResolved'
|
||||
}),
|
||||
jasmine.objectContaining({
|
||||
@@ -2947,7 +2945,9 @@ describe('Env integration', function() {
|
||||
'after it finished.\n' +
|
||||
"Message: \"Expected a promise to be resolved to 'something else' " +
|
||||
'but it was resolved to undefined."\n' +
|
||||
'Did you forget to return or await the result of expectAsync?',
|
||||
'1. Did you forget to return or await the result of expectAsync?\n' +
|
||||
'2. Was done() invoked before an async operation completed?\n' +
|
||||
'3. Did an expectation follow a call to done()?',
|
||||
matcherName: 'toBeResolvedTo'
|
||||
})
|
||||
]);
|
||||
@@ -3000,7 +3000,9 @@ describe('Env integration', function() {
|
||||
message:
|
||||
'Suite "a suite" ran a "toBeResolved" expectation ' +
|
||||
'after it finished.\n' +
|
||||
'Did you forget to return or await the result of expectAsync?',
|
||||
'1. Did you forget to return or await the result of expectAsync?\n' +
|
||||
'2. Was done() invoked before an async operation completed?\n' +
|
||||
'3. Did an expectation follow a call to done()?',
|
||||
matcherName: 'toBeResolved'
|
||||
})
|
||||
]);
|
||||
|
||||
@@ -1026,4 +1026,211 @@ describe('spec running', function() {
|
||||
env.stopOnSpecFailure(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('run multiple times', function() {
|
||||
beforeEach(function() {
|
||||
env.configure({ autoCleanClosures: false, random: false });
|
||||
});
|
||||
|
||||
it('should be able to run multiple times', function(done) {
|
||||
var actions = [];
|
||||
|
||||
env.describe('Suite', function() {
|
||||
env.it('spec1', function() {
|
||||
actions.push('spec1');
|
||||
});
|
||||
env.describe('inner suite', function() {
|
||||
env.it('spec2', function() {
|
||||
actions.push('spec2');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
env.execute(null, function() {
|
||||
expect(actions).toEqual(['spec1', 'spec2']);
|
||||
env.execute(null, function() {
|
||||
expect(actions).toEqual(['spec1', 'spec2', 'spec1', 'spec2']);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should reset results between runs', function(done) {
|
||||
var specResults = {};
|
||||
var suiteResults = {};
|
||||
var firstExecution = true;
|
||||
|
||||
env.addReporter({
|
||||
specDone: function(spec) {
|
||||
specResults[spec.description] = spec.status;
|
||||
},
|
||||
suiteDone: function(suite) {
|
||||
suiteResults[suite.description] = suite.status;
|
||||
},
|
||||
jasmineDone: function() {
|
||||
firstExecution = false;
|
||||
}
|
||||
});
|
||||
|
||||
env.describe('suite0', function() {
|
||||
env.it('spec1', function() {
|
||||
if (firstExecution) {
|
||||
env.expect(1).toBe(2);
|
||||
}
|
||||
});
|
||||
env.describe('suite1', function() {
|
||||
env.it('spec2', function() {
|
||||
if (firstExecution) {
|
||||
env.pending();
|
||||
}
|
||||
});
|
||||
env.xit('spec3', function() {}); // Always pending
|
||||
});
|
||||
env.describe('suite2', function() {
|
||||
env.it('spec4', function() {
|
||||
if (firstExecution) {
|
||||
throw new Error('spec 3 fails');
|
||||
}
|
||||
});
|
||||
});
|
||||
env.describe('suite3', function() {
|
||||
env.beforeEach(function() {
|
||||
throw new Error('suite 3 fails');
|
||||
});
|
||||
env.it('spec5', function() {});
|
||||
});
|
||||
env.xdescribe('suite4', function() {
|
||||
// Always pending
|
||||
env.it('spec6', function() {});
|
||||
});
|
||||
env.describe('suite5', function() {
|
||||
env.it('spec7');
|
||||
});
|
||||
});
|
||||
|
||||
env.execute(null, function() {
|
||||
expect(specResults).toEqual({
|
||||
spec1: 'failed',
|
||||
spec2: 'pending',
|
||||
spec3: 'pending',
|
||||
spec4: 'failed',
|
||||
spec5: 'failed',
|
||||
spec6: 'pending',
|
||||
spec7: 'pending'
|
||||
});
|
||||
expect(suiteResults).toEqual({
|
||||
suite0: 'passed',
|
||||
suite1: 'passed',
|
||||
suite2: 'passed',
|
||||
suite3: 'passed',
|
||||
suite4: 'pending',
|
||||
suite5: 'passed'
|
||||
});
|
||||
env.execute(null, function() {
|
||||
expect(specResults).toEqual({
|
||||
spec1: 'passed',
|
||||
spec2: 'passed',
|
||||
spec3: 'pending',
|
||||
spec4: 'passed',
|
||||
spec5: 'failed',
|
||||
spec6: 'pending',
|
||||
spec7: 'pending'
|
||||
});
|
||||
expect(suiteResults).toEqual({
|
||||
suite0: 'passed',
|
||||
suite1: 'passed',
|
||||
suite2: 'passed',
|
||||
suite3: 'passed',
|
||||
suite4: 'pending',
|
||||
suite5: 'passed'
|
||||
});
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should execute before and after hooks per run', function(done) {
|
||||
var timeline = [];
|
||||
var timelineFn = function(hookName) {
|
||||
return function() {
|
||||
timeline.push(hookName);
|
||||
};
|
||||
};
|
||||
var expectedTimeLine = [
|
||||
'beforeAll',
|
||||
'beforeEach',
|
||||
'spec1',
|
||||
'afterEach',
|
||||
'beforeEach',
|
||||
'spec2',
|
||||
'afterEach',
|
||||
'afterAll'
|
||||
];
|
||||
|
||||
env.describe('suite0', function() {
|
||||
env.beforeAll(timelineFn('beforeAll'));
|
||||
env.beforeEach(timelineFn('beforeEach'));
|
||||
env.afterEach(timelineFn('afterEach'));
|
||||
env.afterAll(timelineFn('afterAll'));
|
||||
env.it('spec1', timelineFn('spec1'));
|
||||
env.it('spec2', timelineFn('spec2'));
|
||||
});
|
||||
env.execute(null, function() {
|
||||
expect(timeline).toEqual(expectedTimeLine);
|
||||
timeline = [];
|
||||
env.execute(null, function() {
|
||||
expect(timeline).toEqual(expectedTimeLine);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should be able to filter out different tests in subsequent runs', function(done) {
|
||||
var specResults = {};
|
||||
var focussedSpec = 'spec1';
|
||||
|
||||
env.configure({
|
||||
specFilter: function(spec) {
|
||||
return spec.description === focussedSpec;
|
||||
}
|
||||
});
|
||||
|
||||
env.addReporter({
|
||||
specDone: function(spec) {
|
||||
specResults[spec.description] = spec.status;
|
||||
}
|
||||
});
|
||||
|
||||
env.describe('suite0', function() {
|
||||
env.it('spec1', function() {});
|
||||
env.it('spec2', function() {});
|
||||
env.it('spec3', function() {});
|
||||
});
|
||||
|
||||
env.execute(null, function() {
|
||||
expect(specResults).toEqual({
|
||||
spec1: 'passed',
|
||||
spec2: 'excluded',
|
||||
spec3: 'excluded'
|
||||
});
|
||||
focussedSpec = 'spec2';
|
||||
env.execute(null, function() {
|
||||
expect(specResults).toEqual({
|
||||
spec1: 'excluded',
|
||||
spec2: 'passed',
|
||||
spec3: 'excluded'
|
||||
});
|
||||
focussedSpec = 'spec3';
|
||||
env.execute(null, function() {
|
||||
expect(specResults).toEqual({
|
||||
spec1: 'excluded',
|
||||
spec2: 'excluded',
|
||||
spec3: 'passed'
|
||||
});
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -52,6 +52,7 @@ getJasmineRequireObj().CallTracker = function(j$) {
|
||||
/**
|
||||
* Get the "this" object that was passed to a specific invocation of this spy.
|
||||
* @name Spy#calls#thisFor
|
||||
* @since 3.8.0
|
||||
* @function
|
||||
* @param {Integer} index The 0-based invocation index.
|
||||
* @return {Object?}
|
||||
|
||||
@@ -7,6 +7,7 @@ getJasmineRequireObj().Clock = function() {
|
||||
|
||||
/**
|
||||
* @class Clock
|
||||
* @since 1.3.0
|
||||
* @classdesc Jasmine's mock clock is used when testing time dependent code.<br>
|
||||
* _Note:_ Do not construct this directly. You can get the current clock with
|
||||
* {@link jasmine.clock}.
|
||||
|
||||
@@ -138,7 +138,16 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
* @type function
|
||||
* @default undefined
|
||||
*/
|
||||
Promise: undefined
|
||||
Promise: undefined,
|
||||
/**
|
||||
* Clean closures when a suite is done running (done by clearing the stored function reference).
|
||||
* This prevents memory leaks, but you won't be able to run jasmine multiple times.
|
||||
* @name Configuration#autoCleanClosures
|
||||
* @since 3.10.0
|
||||
* @type boolean
|
||||
* @default true
|
||||
*/
|
||||
autoCleanClosures: true
|
||||
};
|
||||
|
||||
var currentSuite = function() {
|
||||
@@ -191,7 +200,8 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
var booleanProps = [
|
||||
'random',
|
||||
'failSpecWithNoExpectations',
|
||||
'hideDisabled'
|
||||
'hideDisabled',
|
||||
'autoCleanClosures'
|
||||
];
|
||||
|
||||
booleanProps.forEach(function(prop) {
|
||||
@@ -432,7 +442,9 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
}
|
||||
|
||||
delayedExpectationResult.message +=
|
||||
'Did you forget to return or await the result of expectAsync?';
|
||||
'1. Did you forget to return or await the result of expectAsync?\n' +
|
||||
'2. Was done() invoked before an async operation completed?\n' +
|
||||
'3. Did an expectation follow a call to done()?';
|
||||
|
||||
topSuite.result.failedExpectations.push(delayedExpectationResult);
|
||||
}
|
||||
@@ -497,10 +509,11 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
delete runnableResources[id];
|
||||
};
|
||||
|
||||
var beforeAndAfterFns = function(suite) {
|
||||
var beforeAndAfterFns = function(targetSuite) {
|
||||
return function() {
|
||||
var befores = [],
|
||||
afters = [];
|
||||
afters = [],
|
||||
suite = targetSuite;
|
||||
|
||||
while (suite) {
|
||||
befores = befores.concat(suite.beforeFns);
|
||||
@@ -701,9 +714,9 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
description: 'Jasmine__TopLevel__Suite',
|
||||
expectationFactory: expectationFactory,
|
||||
asyncExpectationFactory: suiteAsyncExpectationFactory,
|
||||
expectationResultFactory: expectationResultFactory
|
||||
expectationResultFactory: expectationResultFactory,
|
||||
autoCleanClosures: config.autoCleanClosures
|
||||
});
|
||||
defaultResourcesForRunnable(topSuite.id);
|
||||
currentDeclarationSuite = topSuite;
|
||||
|
||||
/**
|
||||
@@ -712,6 +725,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
* @function
|
||||
* @name Env#topSuite
|
||||
* @return {Suite} the root suite
|
||||
* @since 2.0.0
|
||||
*/
|
||||
this.topSuite = function() {
|
||||
return topSuite;
|
||||
@@ -820,6 +834,11 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
* @return {Promise<undefined>}
|
||||
*/
|
||||
this.execute = function(runnablesToRun, onComplete) {
|
||||
if (this._executedBefore) {
|
||||
topSuite.reset();
|
||||
}
|
||||
this._executedBefore = true;
|
||||
defaultResourcesForRunnable(topSuite.id);
|
||||
installGlobalErrors();
|
||||
|
||||
if (!runnablesToRun) {
|
||||
@@ -903,6 +922,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
* @typedef JasmineStartedInfo
|
||||
* @property {Int} totalSpecsDefined - The total number of specs defined in this suite.
|
||||
* @property {Order} order - Information about the ordering (random or not) of this execution of the suite.
|
||||
* @since 2.0.0
|
||||
*/
|
||||
reporter.jasmineStarted(
|
||||
{
|
||||
@@ -941,6 +961,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
* @property {Order} order - Information about the ordering (random or not) of this execution of the suite.
|
||||
* @property {Expectation[]} failedExpectations - List of expectations that failed in an {@link afterAll} at the global level.
|
||||
* @property {Expectation[]} deprecationWarnings - List of deprecation warnings that occurred at the global level.
|
||||
* @since 2.4.0
|
||||
*/
|
||||
reporter.jasmineDone(
|
||||
{
|
||||
@@ -1104,7 +1125,8 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
expectationFactory: expectationFactory,
|
||||
asyncExpectationFactory: suiteAsyncExpectationFactory,
|
||||
expectationResultFactory: expectationResultFactory,
|
||||
throwOnExpectationFailure: config.oneFailurePerSpec
|
||||
throwOnExpectationFailure: config.oneFailurePerSpec,
|
||||
autoCleanClosures: config.autoCleanClosures
|
||||
});
|
||||
|
||||
return suite;
|
||||
@@ -1117,8 +1139,8 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
if (specDefinitions.length > 0) {
|
||||
throw new Error('describe does not expect any arguments');
|
||||
}
|
||||
if (currentDeclarationSuite.markedPending) {
|
||||
suite.pend();
|
||||
if (currentDeclarationSuite.markedExcluding) {
|
||||
suite.exclude();
|
||||
}
|
||||
addSpecsToSuite(suite, specDefinitions);
|
||||
return suite;
|
||||
@@ -1128,7 +1150,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
ensureIsNotNested('xdescribe');
|
||||
ensureIsFunction(specDefinitions, 'xdescribe');
|
||||
var suite = suiteFactory(description);
|
||||
suite.pend();
|
||||
suite.exclude();
|
||||
addSpecsToSuite(suite, specDefinitions);
|
||||
return suite;
|
||||
};
|
||||
@@ -1213,6 +1235,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
timeout: timeout || 0
|
||||
},
|
||||
throwOnExpectationFailure: config.oneFailurePerSpec,
|
||||
autoCleanClosures: config.autoCleanClosures,
|
||||
timer: new j$.Timer()
|
||||
});
|
||||
return spec;
|
||||
@@ -1242,9 +1265,14 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
if (arguments.length > 1 && typeof fn !== 'undefined') {
|
||||
ensureIsFunctionOrAsync(fn, 'it');
|
||||
}
|
||||
|
||||
if (timeout) {
|
||||
j$.util.validateTimeout(timeout);
|
||||
}
|
||||
|
||||
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
|
||||
if (currentDeclarationSuite.markedPending) {
|
||||
spec.pend();
|
||||
if (currentDeclarationSuite.markedExcluding) {
|
||||
spec.exclude();
|
||||
}
|
||||
currentDeclarationSuite.addChild(spec);
|
||||
return spec;
|
||||
@@ -1258,13 +1286,17 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
ensureIsFunctionOrAsync(fn, 'xit');
|
||||
}
|
||||
var spec = this.it.apply(this, arguments);
|
||||
spec.pend('Temporarily disabled with xit');
|
||||
spec.exclude('Temporarily disabled with xit');
|
||||
return spec;
|
||||
};
|
||||
|
||||
this.fit = function(description, fn, timeout) {
|
||||
ensureIsNotNested('fit');
|
||||
ensureIsFunctionOrAsync(fn, 'fit');
|
||||
|
||||
if (timeout) {
|
||||
j$.util.validateTimeout(timeout);
|
||||
}
|
||||
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
|
||||
currentDeclarationSuite.addChild(spec);
|
||||
focusedRunnables.push(spec.id);
|
||||
@@ -1329,6 +1361,11 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
this.beforeEach = function(beforeEachFunction, timeout) {
|
||||
ensureIsNotNested('beforeEach');
|
||||
ensureIsFunctionOrAsync(beforeEachFunction, 'beforeEach');
|
||||
|
||||
if (timeout) {
|
||||
j$.util.validateTimeout(timeout);
|
||||
}
|
||||
|
||||
currentDeclarationSuite.beforeEach({
|
||||
fn: beforeEachFunction,
|
||||
timeout: timeout || 0
|
||||
@@ -1338,6 +1375,11 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
this.beforeAll = function(beforeAllFunction, timeout) {
|
||||
ensureIsNotNested('beforeAll');
|
||||
ensureIsFunctionOrAsync(beforeAllFunction, 'beforeAll');
|
||||
|
||||
if (timeout) {
|
||||
j$.util.validateTimeout(timeout);
|
||||
}
|
||||
|
||||
currentDeclarationSuite.beforeAll({
|
||||
fn: beforeAllFunction,
|
||||
timeout: timeout || 0
|
||||
@@ -1347,6 +1389,11 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
this.afterEach = function(afterEachFunction, timeout) {
|
||||
ensureIsNotNested('afterEach');
|
||||
ensureIsFunctionOrAsync(afterEachFunction, 'afterEach');
|
||||
|
||||
if (timeout) {
|
||||
j$.util.validateTimeout(timeout);
|
||||
}
|
||||
|
||||
afterEachFunction.isCleanup = true;
|
||||
currentDeclarationSuite.afterEach({
|
||||
fn: afterEachFunction,
|
||||
@@ -1357,6 +1404,11 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
this.afterAll = function(afterAllFunction, timeout) {
|
||||
ensureIsNotNested('afterAll');
|
||||
ensureIsFunctionOrAsync(afterAllFunction, 'afterAll');
|
||||
|
||||
if (timeout) {
|
||||
j$.util.validateTimeout(timeout);
|
||||
}
|
||||
|
||||
currentDeclarationSuite.afterAll({
|
||||
fn: afterAllFunction,
|
||||
timeout: timeout || 0
|
||||
|
||||
@@ -126,6 +126,7 @@ getJasmineRequireObj().Expectation = function(j$) {
|
||||
* Otherwise evaluate the matcher.
|
||||
* @member
|
||||
* @name async-matchers#already
|
||||
* @since 3.8.0
|
||||
* @type {async-matchers}
|
||||
* @example
|
||||
* await expectAsync(myPromise).already.toBeResolved();
|
||||
|
||||
@@ -89,7 +89,6 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
||||
completedSynchronously = true,
|
||||
handleError = function handleError(error) {
|
||||
onException(error);
|
||||
next(error);
|
||||
},
|
||||
cleanup = once(function cleanup() {
|
||||
if (timeoutId !== void 0) {
|
||||
|
||||
@@ -2,6 +2,7 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
/**
|
||||
* @interface Spec
|
||||
* @see Configuration#specFilter
|
||||
* @since 2.0.0
|
||||
*/
|
||||
function Spec(attrs) {
|
||||
this.expectationFactory = attrs.expectationFactory;
|
||||
@@ -12,6 +13,7 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
* @name Spec#id
|
||||
* @readonly
|
||||
* @type {string}
|
||||
* @since 2.0.0
|
||||
*/
|
||||
this.id = attrs.id;
|
||||
/**
|
||||
@@ -19,6 +21,7 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
* @name Spec#description
|
||||
* @readonly
|
||||
* @type {string}
|
||||
* @since 2.0.0
|
||||
*/
|
||||
this.description = attrs.description || '';
|
||||
this.queueableFn = attrs.queueableFn;
|
||||
@@ -33,6 +36,8 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
return {};
|
||||
};
|
||||
this.onStart = attrs.onStart || function() {};
|
||||
this.autoCleanClosures =
|
||||
attrs.autoCleanClosures === undefined ? true : !!attrs.autoCleanClosures;
|
||||
this.getSpecName =
|
||||
attrs.getSpecName ||
|
||||
function() {
|
||||
@@ -50,7 +55,7 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
this.timer = attrs.timer || new j$.Timer();
|
||||
|
||||
if (!this.queueableFn.fn) {
|
||||
this.pend();
|
||||
this.exclude();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,7 +70,8 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
* @property {String} status - Once the spec has completed, this string represents the pass/fail status of this spec.
|
||||
* @property {number} duration - The time in ms used by the spec execution, including any before/afterEach.
|
||||
* @property {Object} properties - User-supplied properties, if any, that were set using {@link Env#setSpecProperty}
|
||||
*/
|
||||
* @since 2.0.0
|
||||
x */
|
||||
this.result = {
|
||||
id: this.id,
|
||||
description: this.description,
|
||||
@@ -117,7 +123,9 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
|
||||
var complete = {
|
||||
fn: function(done) {
|
||||
self.queueableFn.fn = null;
|
||||
if (self.autoCleanClosures) {
|
||||
self.queueableFn.fn = null;
|
||||
}
|
||||
self.result.status = self.status(excluded, failSpecWithNoExp);
|
||||
self.result.duration = self.timer.elapsed();
|
||||
self.resultCallback(self.result, done);
|
||||
@@ -154,6 +162,36 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
this.queueRunnerFactory(runnerConfig);
|
||||
};
|
||||
|
||||
Spec.prototype.reset = function() {
|
||||
/**
|
||||
* @typedef SpecResult
|
||||
* @property {Int} id - The unique id of this spec.
|
||||
* @property {String} description - The description passed to the {@link it} that created this spec.
|
||||
* @property {String} fullName - The full description including all ancestors of this spec.
|
||||
* @property {Expectation[]} failedExpectations - The list of expectations that failed during execution of this spec.
|
||||
* @property {Expectation[]} passedExpectations - The list of expectations that passed during execution of this spec.
|
||||
* @property {Expectation[]} deprecationWarnings - The list of deprecation warnings that occurred during execution this spec.
|
||||
* @property {String} pendingReason - If the spec is {@link pending}, this will be the reason.
|
||||
* @property {String} status - Once the spec has completed, this string represents the pass/fail status of this spec.
|
||||
* @property {number} duration - The time in ms used by the spec execution, including any before/afterEach.
|
||||
* @property {Object} properties - User-supplied properties, if any, that were set using {@link Env#setSpecProperty}
|
||||
* @since 2.0.0
|
||||
*/
|
||||
this.result = {
|
||||
id: this.id,
|
||||
description: this.description,
|
||||
fullName: this.getFullName(),
|
||||
failedExpectations: [],
|
||||
passedExpectations: [],
|
||||
deprecationWarnings: [],
|
||||
pendingReason: this.excludeMessage,
|
||||
duration: null,
|
||||
properties: null,
|
||||
trace: null
|
||||
};
|
||||
this.markedPending = this.markedExcluding;
|
||||
};
|
||||
|
||||
Spec.prototype.onException = function onException(e) {
|
||||
if (Spec.isPendingSpecException(e)) {
|
||||
this.pend(extractCustomPendingMessage(e));
|
||||
@@ -177,6 +215,10 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
);
|
||||
};
|
||||
|
||||
/*
|
||||
* Marks state as pending
|
||||
* @param {string} [message] An optional reason message
|
||||
*/
|
||||
Spec.prototype.pend = function(message) {
|
||||
this.markedPending = true;
|
||||
if (message) {
|
||||
@@ -184,6 +226,19 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* Like {@link Spec#pend}, but pending state will survive {@link Spec#reset}
|
||||
* Useful for fit, xit, where pending state remains.
|
||||
* @param {string} [message] An optional reason message
|
||||
*/
|
||||
Spec.prototype.exclude = function(message) {
|
||||
this.markedExcluding = true;
|
||||
if (this.message) {
|
||||
this.excludeMessage = message;
|
||||
}
|
||||
this.pend(message);
|
||||
};
|
||||
|
||||
Spec.prototype.getResult = function() {
|
||||
this.result.status = this.status();
|
||||
return this.result;
|
||||
@@ -216,6 +271,7 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
* @name Spec#getFullName
|
||||
* @function
|
||||
* @returns {string}
|
||||
* @since 2.0.0
|
||||
*/
|
||||
Spec.prototype.getFullName = function() {
|
||||
return this.getSpecName(this);
|
||||
|
||||
@@ -2,6 +2,7 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
/**
|
||||
* @interface Suite
|
||||
* @see Env#topSuite
|
||||
* @since 2.0.0
|
||||
*/
|
||||
function Suite(attrs) {
|
||||
this.env = attrs.env;
|
||||
@@ -10,6 +11,7 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
* @name Suite#id
|
||||
* @readonly
|
||||
* @type {string}
|
||||
* @since 2.0.0
|
||||
*/
|
||||
this.id = attrs.id;
|
||||
/**
|
||||
@@ -24,12 +26,15 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
* @name Suite#description
|
||||
* @readonly
|
||||
* @type {string}
|
||||
* @since 2.0.0
|
||||
*/
|
||||
this.description = attrs.description;
|
||||
this.expectationFactory = attrs.expectationFactory;
|
||||
this.asyncExpectationFactory = attrs.asyncExpectationFactory;
|
||||
this.expectationResultFactory = attrs.expectationResultFactory;
|
||||
this.throwOnExpectationFailure = !!attrs.throwOnExpectationFailure;
|
||||
this.autoCleanClosures =
|
||||
attrs.autoCleanClosures === undefined ? true : !!attrs.autoCleanClosures;
|
||||
|
||||
this.beforeFns = [];
|
||||
this.afterFns = [];
|
||||
@@ -42,29 +47,11 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
* The suite's children.
|
||||
* @name Suite#children
|
||||
* @type {Array.<(Spec|Suite)>}
|
||||
* @since 2.0.0
|
||||
*/
|
||||
this.children = [];
|
||||
|
||||
/**
|
||||
* @typedef SuiteResult
|
||||
* @property {Int} id - The unique id of this suite.
|
||||
* @property {String} description - The description text passed to the {@link describe} that made this suite.
|
||||
* @property {String} fullName - The full description including all ancestors of this suite.
|
||||
* @property {Expectation[]} failedExpectations - The list of expectations that failed in an {@link afterAll} for this suite.
|
||||
* @property {Expectation[]} deprecationWarnings - The list of deprecation warnings that occurred on this suite.
|
||||
* @property {String} status - Once the suite has completed, this string represents the pass/fail status of this suite.
|
||||
* @property {number} duration - The time in ms for Suite execution, including any before/afterAll, before/afterEach.
|
||||
* @property {Object} properties - User-supplied properties, if any, that were set using {@link Env#setSuiteProperty}
|
||||
*/
|
||||
this.result = {
|
||||
id: this.id,
|
||||
description: this.description,
|
||||
fullName: this.getFullName(),
|
||||
failedExpectations: [],
|
||||
deprecationWarnings: [],
|
||||
duration: null,
|
||||
properties: null
|
||||
};
|
||||
this.reset();
|
||||
}
|
||||
|
||||
Suite.prototype.setSuiteProperty = function(key, value) {
|
||||
@@ -85,6 +72,7 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
* @name Suite#getFullName
|
||||
* @function
|
||||
* @returns {string}
|
||||
* @since 2.0.0
|
||||
*/
|
||||
Suite.prototype.getFullName = function() {
|
||||
var fullName = [];
|
||||
@@ -100,10 +88,22 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
return fullName.join(' ');
|
||||
};
|
||||
|
||||
/*
|
||||
* Mark the suite with "pending" status
|
||||
*/
|
||||
Suite.prototype.pend = function() {
|
||||
this.markedPending = true;
|
||||
};
|
||||
|
||||
/*
|
||||
* Like {@link Suite#pend}, but pending state will survive {@link Spec#reset}
|
||||
* Useful for fdescribe, xdescribe, where pending state should remain.
|
||||
*/
|
||||
Suite.prototype.exclude = function() {
|
||||
this.pend();
|
||||
this.markedExcluding = true;
|
||||
};
|
||||
|
||||
Suite.prototype.beforeEach = function(fn) {
|
||||
this.beforeFns.unshift(fn);
|
||||
};
|
||||
@@ -135,10 +135,40 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
}
|
||||
|
||||
Suite.prototype.cleanupBeforeAfter = function() {
|
||||
removeFns(this.beforeAllFns);
|
||||
removeFns(this.afterAllFns);
|
||||
removeFns(this.beforeFns);
|
||||
removeFns(this.afterFns);
|
||||
if (this.autoCleanClosures) {
|
||||
removeFns(this.beforeAllFns);
|
||||
removeFns(this.afterAllFns);
|
||||
removeFns(this.beforeFns);
|
||||
removeFns(this.afterFns);
|
||||
}
|
||||
};
|
||||
|
||||
Suite.prototype.reset = function() {
|
||||
/**
|
||||
* @typedef SuiteResult
|
||||
* @property {Int} id - The unique id of this suite.
|
||||
* @property {String} description - The description text passed to the {@link describe} that made this suite.
|
||||
* @property {String} fullName - The full description including all ancestors of this suite.
|
||||
* @property {Expectation[]} failedExpectations - The list of expectations that failed in an {@link afterAll} for this suite.
|
||||
* @property {Expectation[]} deprecationWarnings - The list of deprecation warnings that occurred on this suite.
|
||||
* @property {String} status - Once the suite has completed, this string represents the pass/fail status of this suite.
|
||||
* @property {number} duration - The time in ms for Suite execution, including any before/afterAll, before/afterEach.
|
||||
* @property {Object} properties - User-supplied properties, if any, that were set using {@link Env#setSuiteProperty}
|
||||
* @since 2.0.0
|
||||
*/
|
||||
this.result = {
|
||||
id: this.id,
|
||||
description: this.description,
|
||||
fullName: this.getFullName(),
|
||||
failedExpectations: [],
|
||||
deprecationWarnings: [],
|
||||
duration: null,
|
||||
properties: null
|
||||
};
|
||||
this.markedPending = this.markedExcluding;
|
||||
this.children.forEach(function(child) {
|
||||
child.reset();
|
||||
});
|
||||
};
|
||||
|
||||
Suite.prototype.addChild = function(child) {
|
||||
|
||||
24
src/core/asymmetric_equality/StringContaining.js
Normal file
24
src/core/asymmetric_equality/StringContaining.js
Normal file
@@ -0,0 +1,24 @@
|
||||
getJasmineRequireObj().StringContaining = function(j$) {
|
||||
function StringContaining(expected) {
|
||||
if (!j$.isString_(expected)) {
|
||||
throw new Error('Expected is not a String');
|
||||
}
|
||||
|
||||
this.expected = expected;
|
||||
}
|
||||
|
||||
StringContaining.prototype.asymmetricMatch = function(other) {
|
||||
if (!j$.isString_(other)) {
|
||||
// Arrays, etc. don't match no matter what their indexOf returns.
|
||||
return false;
|
||||
}
|
||||
|
||||
return other.indexOf(this.expected) !== -1;
|
||||
};
|
||||
|
||||
StringContaining.prototype.jasmineToString = function() {
|
||||
return '<jasmine.stringContaining("' + this.expected + '")>';
|
||||
};
|
||||
|
||||
return StringContaining;
|
||||
};
|
||||
@@ -7,6 +7,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
* Maximum object depth the pretty printer will print to.
|
||||
* Set this to a lower value to speed up pretty printing if you have large objects.
|
||||
* @name jasmine.MAX_PRETTY_PRINT_DEPTH
|
||||
* @default 8
|
||||
* @since 1.3.0
|
||||
*/
|
||||
j$.MAX_PRETTY_PRINT_DEPTH = 8;
|
||||
@@ -15,6 +16,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
* This will also limit the number of keys and values displayed for an object.
|
||||
* Elements past this number will be ellipised.
|
||||
* @name jasmine.MAX_PRETTY_PRINT_ARRAY_LENGTH
|
||||
* @default 50
|
||||
* @since 2.7.0
|
||||
*/
|
||||
j$.MAX_PRETTY_PRINT_ARRAY_LENGTH = 50;
|
||||
@@ -22,15 +24,35 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
* Maximum number of characters to display when pretty printing objects.
|
||||
* Characters past this number will be ellipised.
|
||||
* @name jasmine.MAX_PRETTY_PRINT_CHARS
|
||||
* @default 100
|
||||
* @since 2.9.0
|
||||
*/
|
||||
j$.MAX_PRETTY_PRINT_CHARS = 1000;
|
||||
/**
|
||||
* Default number of milliseconds Jasmine will wait for an asynchronous spec to complete.
|
||||
* Default number of milliseconds Jasmine will wait for an asynchronous spec,
|
||||
* before, or after function to complete. This can be overridden on a case by
|
||||
* case basis by passing a time limit as the third argument to {@link it},
|
||||
* {@link beforeEach}, {@link afterEach}, {@link beforeAll}, or
|
||||
* {@link afterAll}. The value must be no greater than the largest number of
|
||||
* milliseconds supported by setTimeout, which is usually 2147483647.
|
||||
*
|
||||
* While debugging tests, you may want to set this to a large number (or pass
|
||||
* a large number to one of the functions mentioned above) so that Jasmine
|
||||
* does not move on to after functions or the next spec while you're debugging.
|
||||
* @name jasmine.DEFAULT_TIMEOUT_INTERVAL
|
||||
* @default 5000
|
||||
* @since 1.3.0
|
||||
*/
|
||||
j$.DEFAULT_TIMEOUT_INTERVAL = 5000;
|
||||
var DEFAULT_TIMEOUT_INTERVAL = 5000;
|
||||
Object.defineProperty(j$, 'DEFAULT_TIMEOUT_INTERVAL', {
|
||||
get: function() {
|
||||
return DEFAULT_TIMEOUT_INTERVAL;
|
||||
},
|
||||
set: function(newValue) {
|
||||
j$.util.validateTimeout(newValue, 'jasmine.DEFAULT_TIMEOUT_INTERVAL');
|
||||
DEFAULT_TIMEOUT_INTERVAL = newValue;
|
||||
}
|
||||
});
|
||||
|
||||
j$.getGlobal = function() {
|
||||
return jasmineGlobal;
|
||||
@@ -229,7 +251,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* that will succeed if the actual value being compared is an instance of the specified class/constructor.
|
||||
* @name jasmine.any
|
||||
* @since 1.3.0
|
||||
@@ -241,7 +263,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* that will succeed if the actual value being compared is not `null` and not `undefined`.
|
||||
* @name jasmine.anything
|
||||
* @since 2.2.0
|
||||
@@ -252,7 +274,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* that will succeed if the actual value being compared is `true` or anything truthy.
|
||||
* @name jasmine.truthy
|
||||
* @since 3.1.0
|
||||
@@ -263,7 +285,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* that will succeed if the actual value being compared is `null`, `undefined`, `0`, `false` or anything falsey.
|
||||
* @name jasmine.falsy
|
||||
* @since 3.1.0
|
||||
@@ -274,7 +296,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* that will succeed if the actual value being compared is empty.
|
||||
* @name jasmine.empty
|
||||
* @since 3.1.0
|
||||
@@ -285,7 +307,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* that will succeed if the actual value being compared is not empty.
|
||||
* @name jasmine.notEmpty
|
||||
* @since 3.1.0
|
||||
@@ -296,7 +318,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* that will succeed if the actual value being compared contains at least the keys and values.
|
||||
* @name jasmine.objectContaining
|
||||
* @since 1.3.0
|
||||
@@ -308,7 +330,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* that will succeed if the actual value is a `String` that matches the `RegExp` or `String`.
|
||||
* @name jasmine.stringMatching
|
||||
* @since 2.2.0
|
||||
@@ -320,7 +342,19 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* that will succeed if the actual value is a `String` that contains the specified `String`.
|
||||
* @name jasmine.stringContaining
|
||||
* @since 3.10.0
|
||||
* @function
|
||||
* @param {String} expected
|
||||
*/
|
||||
j$.stringContaining = function(expected) {
|
||||
return new j$.StringContaining(expected);
|
||||
};
|
||||
|
||||
/**
|
||||
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* that will succeed if the actual value is an `Array` that contains at least the elements in the sample.
|
||||
* @name jasmine.arrayContaining
|
||||
* @since 2.2.0
|
||||
@@ -332,7 +366,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* that will succeed if the actual value is an `Array` that contains all of the elements in the sample in any order.
|
||||
* @name jasmine.arrayWithExactContents
|
||||
* @since 2.8.0
|
||||
@@ -344,7 +378,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* that will succeed if every key/value pair in the sample passes the deep equality comparison
|
||||
* with at least one key/value pair in the actual value being compared
|
||||
* @name jasmine.mapContaining
|
||||
@@ -357,7 +391,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
* that will succeed if every item in the sample passes the deep equality comparison
|
||||
* with at least one item in the actual value being compared
|
||||
* @name jasmine.setContaining
|
||||
|
||||
@@ -659,9 +659,33 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
|
||||
/**
|
||||
* @interface AsymmetricEqualityTester
|
||||
* @classdesc An asymmetric equality tester is an object that can match multiple
|
||||
* objects. Examples include jasmine.any() and jasmine.stringMatching().
|
||||
* User-defined asymmetric equality testers can also be defined and used in
|
||||
* expectations.
|
||||
* objects. Examples include jasmine.any() and jasmine.stringMatching(). Jasmine
|
||||
* includes a number of built-in asymmetric equality testers, such as
|
||||
* {@link jasmine.objectContaining}. User-defined asymmetric equality testers are
|
||||
* also supported.
|
||||
*
|
||||
* Asymmetric equality testers work with any matcher, including user-defined
|
||||
* custom matchers, that uses {@link MatchersUtil#equals} or
|
||||
* {@link MatchersUtil#contains}.
|
||||
*
|
||||
* @example
|
||||
* function numberDivisibleBy(divisor) {
|
||||
* return {
|
||||
* asymmetricMatch: function(n) {
|
||||
* return typeof n === 'number' && n % divisor === 0;
|
||||
* },
|
||||
* jasmineToString: function() {
|
||||
* return `<a number divisible by ${divisor}>`;
|
||||
* }
|
||||
* };
|
||||
* }
|
||||
*
|
||||
* var actual = {
|
||||
* n: 2,
|
||||
* otherFields: "don't care"
|
||||
* };
|
||||
*
|
||||
* expect(actual).toEqual(jasmine.objectContaining({n: numberDivisibleBy(2)}));
|
||||
* @see custom_asymmetric_equality_testers
|
||||
* @since 2.0.0
|
||||
*/
|
||||
|
||||
@@ -74,6 +74,7 @@ var getJasmineRequireObj = (function(jasmineGlobal) {
|
||||
j$.SpyRegistry = jRequire.SpyRegistry(j$);
|
||||
j$.SpyStrategy = jRequire.SpyStrategy(j$);
|
||||
j$.StringMatching = jRequire.StringMatching(j$);
|
||||
j$.StringContaining = jRequire.StringContaining(j$);
|
||||
j$.UserContext = jRequire.UserContext(j$);
|
||||
j$.Suite = jRequire.Suite(j$);
|
||||
j$.Timer = jRequire.Timer();
|
||||
|
||||
@@ -142,5 +142,20 @@ getJasmineRequireObj().util = function(j$) {
|
||||
}
|
||||
};
|
||||
|
||||
util.validateTimeout = function(timeout, msgPrefix) {
|
||||
// Timeouts are implemented with setTimeout, which only supports a limited
|
||||
// range of values. The limit is unspecified, as is the behavior when it's
|
||||
// exceeded. But on all currently supported JS runtimes, setTimeout calls
|
||||
// the callback immediately when the timeout is greater than 2147483647
|
||||
// (the maximum value of a signed 32 bit integer).
|
||||
var max = 2147483647;
|
||||
|
||||
if (timeout > max) {
|
||||
throw new Error(
|
||||
(msgPrefix || 'Timeout value') + ' cannot be greater than ' + max
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
return util;
|
||||
};
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@use "sass:math";
|
||||
|
||||
$line-height: 14px;
|
||||
$margin-unit: 14px;
|
||||
|
||||
@@ -117,7 +119,7 @@ body {
|
||||
|
||||
li {
|
||||
display: inline-block;
|
||||
height: ($line-height / 2) + 3;
|
||||
height: math.div($line-height, 2) + 3;
|
||||
width: $line-height;
|
||||
|
||||
font-size: 16px;
|
||||
@@ -132,7 +134,7 @@ body {
|
||||
}
|
||||
|
||||
&.jasmine-failed {
|
||||
line-height: ($line-height / 2) + 2;
|
||||
line-height: math.div($line-height, 2) + 2;
|
||||
|
||||
&:before {
|
||||
color: $failing-color;
|
||||
@@ -282,8 +284,8 @@ body {
|
||||
padding-left: 0;
|
||||
|
||||
&.jasmine-suite {
|
||||
margin-top: $margin-unit/2;
|
||||
margin-bottom: $margin-unit/2
|
||||
margin-top: math.div($margin-unit, 2);
|
||||
margin-bottom: math.div($margin-unit, 2)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user