diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index da335b71..6298b922 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -3667,19 +3667,24 @@ getJasmineRequireObj().Expectation = function(j$) { } /** - * Add some context for an {@link expect} + * Add some context to be included in matcher failures for an + * {@link expect|expectation}, so that it can be more easily distinguished + * from similar expectations. * @function * @name matchers#withContext * @since 3.3.0 * @param {String} message - Additional context to show when the matcher fails * @return {matchers} + * @example + * expect(things[0]).withContext('thing 0').toEqual('a'); + * expect(things[1]).withContext('thing 1').toEqual('b'); */ Expectation.prototype.withContext = function withContext(message) { return addFilter(this, new ContextAddingFilter(message)); }; /** - * Invert the matcher following this {@link expect} + * Invert the matcher following this {@link expect|expectation} * @member * @name matchers#not * @since 1.3.0 diff --git a/src/core/Expectation.js b/src/core/Expectation.js index 70030fe1..4ae5d1ab 100644 --- a/src/core/Expectation.js +++ b/src/core/Expectation.js @@ -16,19 +16,24 @@ getJasmineRequireObj().Expectation = function(j$) { } /** - * Add some context for an {@link expect} + * Add some context to be included in matcher failures for an + * {@link expect|expectation}, so that it can be more easily distinguished + * from similar expectations. * @function * @name matchers#withContext * @since 3.3.0 * @param {String} message - Additional context to show when the matcher fails * @return {matchers} + * @example + * expect(things[0]).withContext('thing 0').toEqual('a'); + * expect(things[1]).withContext('thing 1').toEqual('b'); */ Expectation.prototype.withContext = function withContext(message) { return addFilter(this, new ContextAddingFilter(message)); }; /** - * Invert the matcher following this {@link expect} + * Invert the matcher following this {@link expect|expectation} * @member * @name matchers#not * @since 1.3.0