Steve Gravrock
434575f49d
Use one declaration per statement
...
The old style of merging all of a function's variable declarations into
a single statement made some sense back in the days of var, but there's
no reason to keep doing it now that we use const and let.
2026-03-11 06:30:46 -07:00
Steve Gravrock
168ff0a751
Move private APIs to private namespace
...
Fixes #2078
2025-09-27 13:21:09 -07:00
Steve Gravrock
63ed2b3948
Include function names in pretty printer output
...
This helps make matcher errors and spy strategy mismatch errors easier
to understand in cases where the difference involves expecting one
function but getting a different one.
2025-06-04 18:37:44 -07:00
Steve Gravrock
bb4d18f959
Include property getter values in pretty-printed objects
...
We already call getters when comparing objects for equality and generating
diffs, so it should be safe to do it here too.
See #1966 .
2022-05-12 17:14:13 -07:00
Steve Gravrock
270344bd38
Include symbol keys when pretty-printing objects
...
* Fixes #1966
2022-05-07 10:05:18 -07:00
Steve Gravrock
1166d10e43
Use const/let in specs, not var
2022-04-16 13:41:44 -07:00
Steve Gravrock
482dc883eb
Check for unused vars and params in specs
2022-04-16 10:58:25 -07:00
Steve Gravrock
dfa5b6a53d
Pretty-print [new String("")] as "[ '' ]" not "[]"
2022-03-14 18:47:23 -07:00
Steve Gravrock
09d2ce9bc9
Removed more code that supported browsers we no longer run on
2021-07-27 17:53:09 -07:00
Steve Gravrock
fe0a83ba87
Removed support for Internet Explorer
2021-07-23 21:46:15 -07:00
Steve Gravrock
c2a714f168
Removed support for IE 10 and Safari 8
2021-04-23 08:14:19 -07:00
Steve Gravrock
4e2f703615
Check for syntax and standard library objects that don't work in IE
2020-07-01 17:34:59 -07:00
Steve Gravrock
c2ada1af95
Merge branch 'custom-object-formatters' into cof-merge-candidate
2020-02-11 13:51:17 -08:00
Steve Gravrock
873d1c2945
Use custom object formatters for any part of a diff, not just leaf nodes
2020-02-10 17:26:00 -08:00
Steve Gravrock
25816a6e77
Added support for custom object formatters
...
Custom object formatters allow users to customize how an object is
stringified in matcher failure messages. This can already be done by
adding a `jasmineToString` method to the objects in question. But
it's not always desirable or possible to do that, particularly when
objects of a given "type" do not inherit from a specific prototype.
For instance, suppose a web service returns a list of foos that are
deserialized from JSON, e.g.:
{ fooId: 42, /* more properties */ }
The only way to define `jasmineToString` on those is by writing code to
add it to each instance at runtime. But a custom object formatter can
recognize that the object it's looking at is a foo and format it
accordingly:
jasmine.addCustomObjectFormatter(function(obj) {
if (typeof obj.fooId !== 'number') {
return undefined;
}
return '[Foo with ID ' + obj.fooId + ']';
});
Unlike `jasmineToString`, custom object formatters are scoped to a
particular spec or suite and don't require any changes to the code
under test.
2020-02-10 17:26:00 -08:00
Steve Gravrock
1f23f1e4d2
Inject a per-runable pretty printer into MatchersUtil
...
This will allow us to add support for custom object formatters, which
will be a per-runable resource like custom matchers, by injecting them
into the pretty-printer.
2020-02-10 17:26:00 -08:00
Steve Gravrock
7f392d188e
Don't leak global error handlers between Jasmine's own tests
2020-01-20 10:18:29 -08:00
johnjbarton
6324fda065
PrettyPrinter survives if objects throw in toString
2019-06-27 10:35:59 -07:00
Gregg Van Hove
b4cbe9850f
add prettier and eslint
2019-05-21 18:23:48 -07:00
Gregg Van Hove
9f875ce666
Older versions don't support const, use var
2019-05-20 17:56:27 -07:00
Gregg Van Hove
df6a71e37d
Merge branch 'spy-to-string' of https://github.com/johnjbarton/jasmine into johnjbarton-spy-to-string
...
- Merges #1712 from @johnjbarton
2019-05-20 17:22:05 -07:00
johnjbarton
d1adbdc72b
fix(PrettyPrint): jasmine.createSpyObj('obj', ['toString']);
...
The PrettyPrint handler for scalars uses toString() but if that method
has been spyed on, then the stringify fails with
TypeError: Cannot read property 'length' of undefined.
By hanlding this case earlier in format() we avoid the error.
Add unit test covering this case.
2019-05-20 09:33:47 -07:00
Elliot Nelson
8225bb935f
Explicitly test pretty printing objects with nested invalid toString
2019-05-20 09:09:07 -04:00
Elliot Nelson
9f704b6f3a
PrettyPrinter handles objects with invalid toString implementations
2019-05-20 09:01:10 -04:00
Felix Rilling
e33b12b17c
Fixed typos in test suite descriptions.
2019-03-10 11:07:40 +01:00
Gregg Van Hove
37dfe50d99
Stop treating objects with a nodeType as if they are DOM Nodes
...
- Fixes #1638
2018-12-17 17:10:53 -08:00
Gregg Van Hove
274011ed03
Merge branch 'master' into 3.0-features
2018-02-02 16:33:38 -08:00
Gregg Van Hove
91aab8e1b8
Merge branch 'Volox-ie11-sets-support'
...
- Merges #1478 from @Volox
- Fixes #1355
2018-01-12 17:33:51 -08:00
Volonterio Riccardo
486a64658f
Added complete support for Set also for IE11.
...
Fixes 1355
2018-01-12 12:18:35 +01:00
Gregg Van Hove
1dfdc89ba9
Merge branch 'ie11-maps-support' of https://github.com/Volox/jasmine into Volox-ie11-maps-support
...
- Merges #1477 from @Volox
- Fixes #1472
2018-01-11 17:50:56 -08:00
Volonterio Riccardo
085a1f8a16
Added complete support for Map also for IE11.
...
Fixes 1472
2018-01-11 18:13:24 +01:00
Steve Gravrock
6f119c4e5a
Moved createSpy to env so it can be stateful
2018-01-09 10:16:02 -08:00
Steve Gravrock
ef9f82a17d
Merge branch 'master' into 3.0-features
2017-12-18 09:48:17 -08:00
Steve Gravrock
c0d0513199
Stop serializing objects after hitting jasmine.MAX_PRETTY_PRINT_CHARS
2017-12-15 13:23:59 -08:00
Steve Gravrock
86a38fceb9
Truncate pretty printer output that is more than j$.MAX_PRETTY_PRINT_CHARS long
2017-12-13 08:09:22 -08:00
Steve Gravrock
419470e9df
Removed support for IE <10
...
[#150527985 ]
2017-11-08 08:30:22 -08:00
Gregg Van Hove
31164106e5
Get the casing right for IE8
2017-07-18 21:51:32 -07:00
Gregg Van Hove
f71218a44b
Allow IE8 to be weird when pretty printing
2017-07-18 21:07:38 -07:00
Gregg Van Hove
22e9d6df20
PrettyPrinter allows an object to have a toString that isn't a function
...
- Fixes #1389
2017-07-17 22:01:06 -07:00
Gregg Van Hove
4c491b2dc0
Pretty printer will now use MAX_PRETTY_PRINT_ARRAY_LENGTH for objects
...
- Fixes #1291
- Fixes #1360
2017-06-14 13:36:35 -07:00
rmehlinger
5ee03f02ed
Add ES6 map support to Jasmine
2017-05-01 00:12:48 -07:00
Ben Christel
41a813521b
Fix tests for toEqual diff output in IE
...
- Merges #1236 from @benchristel
2016-11-30 15:34:39 -08:00
Ben Christel
d5e6bf47ed
Make toEqual matcher report the difference between objects
...
- Mismatches deep within object/array structures are pinpointed with a JsonPath-like syntax.
2016-11-14 22:08:34 -08:00
Gregg Van Hove
bad9c63bf7
Properly skip Set tests in browsers that don't really support it
2016-09-27 15:36:01 -07:00
Gregg Van Hove
05097b3e42
Merge branch 'set-equality' of https://github.com/alur/jasmine into alur-set-equality
...
- Merges #1067 from @alur
2016-09-27 13:37:57 -07:00
Gregg Van Hove
1efed4c156
Update pretty print specs to work in IE8
2016-09-27 12:26:02 -07:00
Gregg Van Hove
f4849f6401
Merge branch 'pretty-print-cross-frame-objects' of https://github.com/thatfulvioguy/jasmine into thatfulvioguy-pretty-print-cross-frame-objects
...
- Merges #1091 from @thatfulvioguy
- Fixes #1087
2016-09-27 11:40:01 -07:00
Gregg Van Hove
f196faf0bb
Update anonymous constructor pretty print specs to work in IE
2016-08-25 15:29:32 -07:00
Pivotal
604cd6132f
Prettyprint objects whose constructors have custom toString method
...
- when the constructor has a name, print the name
- when the constructor does not have a name, print `<anonymous>`
[Fixes issue 1019](https://github.com/jasmine/jasmine/issues/1019 )
2016-04-25 14:23:48 -04:00
Fulvio Valente
2710bdfc5e
Correctly pretty print objects from other contexts (e.g. iframes) and which do not override toString
...
Fixes #1087
2016-04-11 18:51:04 +01:00