Commit Graph

1035 Commits

Author SHA1 Message Date
Pivotal 008b80adc5 Merge branch 'enelson/default' of https://github.com/elliot-nelson/jasmine
* Merges #1716 from @elliot-nelson
2019-08-29 13:50:27 -07:00
Steve Gravrock 1a63ab4677 Accept configurations with Promise: undefined.
Fixes Karma and anything else that uses Env#configuration
as a starting point for a Jasmine config.
2019-08-26 15:45:13 -07:00
Ferdinand Prantl 3a7fc63879 Pick the error instance to pass to error handlers in QueueRunner
The first number is the error message in HTML5 browser, which does not include
the call stack. The error instance allows logging the complete call stack in
reporters.
2019-08-11 09:32:31 +02:00
Ferdinand Prantl 527619b0aa Restore the original global error hanler to pass all parameters along 2019-08-11 09:31:43 +02:00
johnjbarton 2369c8dba7 fix(env): Throw if nested describe has no children.
Users would like an error if it() is acciddently moved within a before/afterEach/All function.
The it() function calls ensureIsNotNested to report such an error. But if the user has no
other it() functions in the Suite, it() and thus ensureIsNotNested() is never called.

Here we check nested Suites for children; if none are found we throw.
2019-08-07 18:01:34 -07:00
Gregg Van Hove 0449b35f5a Merge branch 'tobe-tostring' of https://github.com/johnjbarton/jasmine into johnjbarton-tobe-tostring
- Merges #1718 from @johnjbarton
- Fixes #1726
2019-08-07 12:03:46 -07:00
Olga Kozlova b01d86840a mapContaining and setContaining asymmetric matchers 2019-08-03 22:14:48 +03:00
Steve Gravrock 18195a868c Updated async timeout message
There are now multiple ways to do async functions, and callbacks
are probably the least common in new code, so the message should
be more general rather than referring to callbacks.
2019-08-03 08:25:57 -07:00
Ferdinand Prantl 7c3434723e Use the documented interface to pick the error instance from the global error handler 2019-07-21 23:46:14 +02:00
Ferdinand Prantl df4b6e58e2 Pass the error including stacktrace to error handlers and reporters
The global window error handler is used to handle errors thrown from within asynchronous functions and tests. The first parameter is the error; the fifth parameter is the full error object including the stacktrace. Searching for the first occurrence of an error instance to work with browsers, which may not comply with the HTML5 standard.
2019-07-15 14:43:22 +02:00
Steve Gravrock c100bb6242 Made output of toHaveBeenCalledWith more readable
This breaks each call out onto its own line, so that it's much easier to
see where each call starts and how they differ. E.g. previously the output
would be:

    Expected spy foo to have been called with [ 'bar', 'baz', 'qux' ] but actual calls were [ [ 42, 'wibble' ], [ 'bar' 'qux' ], [ 'grault '] ]

Now it's:

    Expected spy foo to have been called with:
      [ 'bar', 'baz', 'qux' ]
    but actual calls were:
      [ 42, 'wibble' ],
      [ 'bar' 'qux' ],
      [ 'grault '].
2019-07-13 10:37:05 -07:00
johnjbarton 6324fda065 PrettyPrinter survives if objects throw in toString 2019-06-27 10:35:59 -07:00
Gregg Van Hove 066162d6bc Merge branch 'enelson/spyobjproperty' of https://github.com/elliot-nelson/jasmine into elliot-nelson-enelson/spyobjproperty
- Merges #1722 from @elliot-nelson
- Closes #1569
- Fixes #1442
2019-06-25 16:26:43 -07:00
Elliot Nelson 65e6df55ee Linting fixes 2019-06-20 07:34:31 -04:00
Elliot Nelson 45475f6d1e Allow users to pass property names to createSpyObj 2019-06-20 07:33:10 -04:00
Gregg Van Hove 3e888105f0 Calculate total suite run time inside the env and report in jasmineDone 2019-06-14 14:59:33 -07:00
Gregg Van Hove 15f969bee7 Add @since to most JSDoc comments
- See jasmine/jasmine.github.io#117
2019-06-12 16:23:12 -07:00
Elliot Nelson e07da96354 Apply prettier 2019-06-07 23:33:06 -04:00
Elliot Nelson 96786c793f Allow users to set a default spy strategy 2019-06-07 23:32:13 -04:00
Gregg Van Hove 8af669677a Cleanup spy promise strategies to be more consistent with Jasmine at large
- Rename `resolveWith` to `resolveTo` to match `toBeResolvedTo`
- No longer wrap non-Errors in `rejectWith`

- Fixes #1715
2019-05-23 17:29:12 -07:00
Gregg Van Hove b4cbe9850f add prettier and eslint 2019-05-21 18:23:48 -07:00
Gregg Van Hove cf2c5c9acc Merge branch 'enelson/src-cleanup-2' of https://github.com/elliot-nelson/jasmine into elliot-nelson-enelson/src-cleanup-2
- Merges #1708 from @elliot-nelson
2019-05-21 17:45:46 -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
Gregg Van Hove cbbdd360f8 Merge branch 'enelson/pp' of https://github.com/elliot-nelson/jasmine into elliot-nelson-enelson/pp
- Merges #1711 from @elliot-nelson
- Closes #1700
- Closes #1575
2019-05-20 17:13:41 -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 9f704b6f3a PrettyPrinter handles objects with invalid toString implementations 2019-05-20 09:01:10 -04:00
Paul van Brenk 69a7449e50 Fix toBeCloseTo matcher for Node.js 12 and Chrome 74 2019-05-19 12:46:32 -04:00
Elliot Nelson b1da6e3960 Cleanup: unused vars, dangling commas, negation 2019-05-18 08:11:47 -04:00
Elliot Nelson 1e855aa9b8 Cleanup: whitespace 2019-05-18 08:10:11 -04:00
Gregg Van Hove e04d3d8a62 Fix bad merge for spyOnProperty error message 2019-05-17 17:07:47 -07:00
Gregg Van Hove 06814769c6 Merge branch 'enelson/spyregerrors' of https://github.com/elliot-nelson/jasmine into elliot-nelson-enelson/spyregerrors
- Merges #1706 from @elliot-nelson
2019-05-17 16:44:26 -07:00
Gregg Van Hove ea1bac5b74 Merge branch 'enelson/spyonproperty' of https://github.com/elliot-nelson/jasmine into elliot-nelson-enelson/spyonproperty
- Merges #1705 from @elliot-nelson
2019-05-17 16:21:17 -07:00
Elliot Nelson befb8995e6 spyOnProperty jasmine-style error messages with usage note 2019-05-17 12:02:44 -04:00
Elliot Nelson 1e13039478 spyOnProperty respects the allowRespy flag 2019-05-17 11:43:22 -04:00
Elliot Nelson 0fded24d35 Introduce matchers#toBeInstanceOf 2019-05-15 11:51:46 -04:00
Elliot Nelson ee15309a8f Extend spyOnAllFunctions to include prototype and parent methods 2019-05-11 18:20:13 -04:00
Gregg Van Hove 9a18fdca27 Merge branch 'enelson/spystrategies' of https://github.com/elliot-nelson/jasmine into elliot-nelson-enelson/spystrategies
- Merges #1688 from @enelson
- See #1590
2019-05-09 17:30:45 -07:00
Elliot Nelson b2fb92eedd Promise-based strategies are now named resolveWith and rejectWith 2019-05-09 06:12:06 -04:00
Elliot Nelson df818f3fbc rejectValue wraps non-Errors like throwError does 2019-05-08 09:36:12 -04:00
Elliot Nelson 4731b4ee4d Keep all Promise implementation details internal 2019-05-08 09:13:41 -04:00
Gregg Van Hove eb30e8179a Update deprecation messages to indicate _future_ removal
- Fixes #1628
2019-05-07 17:10:04 -07:00
Elliot Nelson 95e1890e64 Improved resolveValue/rejectValue error messages 2019-05-07 16:30:48 -04:00
Elliot Nelson 72aa0bbe4d Add resolveValue and rejectValue spy strategies 2019-05-05 08:08:34 -04:00
Alexey Prokhorov 8ab46566ac Fix failure messages for toBeRejectedWithError matcher 2019-05-03 09:37:11 +04:00
Daniel Kurka 2745d7d515 Add support for ArrayBuffers to matcherUtil.equals.
Fixes #1687
2019-05-02 09:49:21 -07:00
Alexey Prokhorov 35968e4a60 Add toBeRejectedWithError matcher 2019-04-26 01:46:56 +04:00
Gregg Van Hove 2fbeb201bc Fix failure messages for positive/negative infinity matchers
- Fixes #1674
2019-04-16 17:40:07 -07:00
Felix Rilling 369e810791 added #toBeTrue and #toBeFalse matchers 2019-04-14 10:17:59 +02:00
Gregg Van Hove 618e24b2f8 Handle WebSocket events in IE when detecting Errors
- Fixes #1623
2019-04-01 18:52:27 -07:00
johnjbarton a8c2399dd8 feat(result.duration): report test duration in ms
Wrap spec start/complete in Timer start/elapsed.
configuration.timeSpecDuration = false will disable feature.

 * Add Suite result.duration, elapsed time in ms

 * Remove timeSpecDuration option.

 * Respond to review, use noopTimer
2019-03-14 09:13:57 -07:00