Commit Graph

213 Commits

Author SHA1 Message Date
Steve Gravrock 47081258cd Revert "Revert "Added the ability to associate trace information with failing specs""
This reverts commit fdad8849df.
2021-10-02 09:56:25 -07:00
Steve Gravrock fdad8849df Revert "Added the ability to associate trace information with failing specs"
Pushing this back to 4.0 in hopes of increasing the chance that third
party reporters will notice it and add support.

This reverts commit 7a289f1de7.
2021-10-02 09:45:15 -07:00
Steve Gravrock 7a289f1de7 Added the ability to associate trace information with failing specs
This is meant to aid in debugging failures, particularly intermittent
failures, in cases where interactive debugging or console.log aren't
suitable.
2021-09-25 16:19:28 -07:00
Steve Gravrock 8d302d8dca Merge branch '3.99' into 4.0 2021-09-20 15:57:37 -07:00
Steve Gravrock 6e10f22403 Don't display late errors as AfterAll errors in the HTML reporter 2021-09-11 08:57:50 -07:00
Steve Gravrock d092a59bd1 Treat multiple calls to done callbacks as errors 2021-09-10 18:07:35 -07:00
Steve Gravrock af5984d5d6 Fixed flake list 2021-09-10 17:53:59 -07:00
Steve Gravrock 15f7013f85 Merge branch '3.99' into 4.0 2021-09-08 21:04:10 -07:00
Steve Gravrock be23836c9d Deprecate multiple calls to done callbacks 2021-09-08 20:58:25 -07:00
Steve Gravrock 7944250290 Merge branch 'main' into 3.99 2021-09-06 17:39:28 -07:00
Steve Gravrock 3a47a3bd04 Fixed flaky spec 2021-09-06 15:35:37 -07:00
Steve Gravrock a63b0b0368 Merge branch '3.99' into 4.0 2021-08-30 18:44:32 -07:00
Steve Gravrock 2fd9d7b13f Merge branch 'main' into 3.99 2021-08-17 17:08:34 -07:00
Steve Gravrock e72d161fab Return a promise from Env#execute in environments that support promises
[#178373231]
2021-08-07 13:05:55 -07:00
Steve Gravrock fe0a83ba87 Removed support for Internet Explorer 2021-07-23 21:46:15 -07:00
Steve Gravrock 3f3fb38cf1 Merge branch '3.99' into 4.0 2021-05-29 18:42:31 -07:00
Steve Gravrock 6a2a30d540 Improved & unified deprecation handling
* De-duplication now happens in core, not in reporters. This ensures that
  the console doesn't get flooded.
* Stack traces are opt-out, not opt-in.
* The current runnable is not reported or logged for certain deprecations
  where it's irrelevant.
* HtmlReporter shows stack traces in expandable widgets.
* Env#deprecated and Env#deprecatedOnceWithStack are merged.
2021-05-29 15:39:28 -07:00
Steve Gravrock 752441a66f Merge branch '3.99' into 4.0 2021-05-18 17:12:29 -07:00
Steve Gravrock 3e2872a1df Merge branch 'main' into 3.99 2021-05-18 17:07:34 -07:00
Steve Gravrock 140225e7c3 Isolate specs that are flaky in browsers
* Don't run them in browsers in the regular CI build
* Run them in browsers in a special nightly build
* Run them in Node in the regular CI build
* Run them when developers manually run the suite

This should allow the regular CI build to give us a more useful signal,
while keeping us from losing sight of the flaky specs.
2021-05-15 07:44:25 -07:00
Steve Gravrock 66189d742b Merge branch 'no-children' of https://github.com/johnjbarton/jasmine into 4.0
* Merges #1742 from @johnjbarton
2021-04-22 21:35:58 -07:00
Steve Gravrock fb05da1fc3 Merge branch 'main' into 3.99 2021-04-22 17:23:08 -07:00
Steve Gravrock c2f04ba627 Further compensate for clock jitter 2021-04-17 11:34:56 -07:00
Steve Gravrock 97a46f4560 Fixed test failures on Safari 8 and 9 2021-04-17 11:34:56 -07:00
Steve Gravrock 8b3a6561b1 Merge branch 'main' into 3.99 2021-04-02 11:35:30 -07:00
Steve Gravrock 050c1f051c Fixed intermittent test failures 2021-03-14 12:23:17 -07:00
Steve Gravrock d27bb8fa96 Run Prettier on all files 2020-09-29 18:05:38 -07:00
Steve Gravrock 7d5ca27b9d Check for forgotten console and debugger statements 2020-09-17 13:33:25 -07:00
Steve Gravrock a1f1b4ae0f Merge branch 'main' into 3.99 2020-09-14 18:39:32 -07:00
Steve Gravrock e7daa429a1 Show the name of the spec/suite that caused a deprecation 2020-09-13 12:59:25 -07:00
Steve Gravrock 0b81705c11 Detect global error handler stack corruption 2020-09-02 14:43:17 -07:00
Steve Gravrock 00feef8632 Fixed global error handler stack corruption in Jasmine's own tests 2020-09-02 14:01:57 -07:00
Steve Gravrock 6b9739030d Fixed future deprecations 2020-08-02 12:57:28 -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 f4753ac0a4 Fixed syntax errors in IE 10 2020-06-25 07:36:06 -07:00
johnjbarton f90d9943fe feat(env): setSpecProperty/setSuiteProperty(key, value) to attach data to tests
Use setSpecProperty to attach key/value pairs to spec results that can be
picked up in specialized jasmine reporters.  Example use-cases
include:
  * Tagging specs with URLs or string-tokens referencing test-plan docs.
  * Recording performance information for blocks of JS.
Similarly setSuiteProperty attaches key/value pairs to suite results
2020-04-14 11:27:14 -07:00
Steve Gravrock 93ad31e0af Correctly report spec and suite duration
Previously, suite duration was always reported as 0 and spec duration
was always reported as null. Suites always used a no-op timer, and
specs set their result.duration after the result had already been sent
to reporters.

Fixes #1676.
2020-02-22 16:53:36 -08:00
Steve Gravrock c39c110eca Deprecate describes with no children 2020-02-12 16:44:44 -08:00
Steve Gravrock 258d55469e Merge branch 'cof-merge-candidate'
* Simplifies the matcher interface
* Adds support for custom object formatters
2020-02-12 15:16:28 -08:00
Steve Gravrock c2ada1af95 Merge branch 'custom-object-formatters' into cof-merge-candidate 2020-02-11 13:51:17 -08:00
Steve Gravrock dec67bd535 Don't require matchers and asymmetric equality testers to pass custom object formatters back to Jasmine
This makes it easier to write high quality matchers and asymmetric equality
testers, and is also a step toward supporting custom object formatters.

Previously, Jasmine passed custom object formatters as the second argument
to matcher factories and as and the second argument to asymmetric equality
testers' `asymmetricMatch` method. Matchers and asymmetric equality testers
were responsible for passing the custom object formatters to methods like
`matchersUtil#equals`:

  function toEqual(util, customEqualityTesters) {
    return {
      compare: function(actual, expected) {
        // ...
        result.pass = util.equals(actual, expected, customEqualityTesters, diffBuilder);

And:

  ArrayContaining.prototype.asymmetricMatch = function(other, customTesters) {
    // ...
    for (var i = 0; i < this.sample.length; i++) {
      var item = this.sample[i];
      if (!j$.matchersUtil.contains(other, item, customTesters)) {
        return false;
      }
    }

With this change, that is no longer necessary. Matchers and asymmetric
equality testers can ignore the existence of custom equality testers and
still fully support them:

  function toEqual(util) {
    return {
      compare: function(actual, expected) {
        // ...
        result.pass = util.equals(actual, expected, diffBuilder);

And:

  ArrayContaining.prototype.asymmetricMatch = function(other, matchersUtil) {
    // ...
    for (var i = 0; i < this.sample.length; i++) {
      var item = this.sample[i];
      if (!matchersUtil.contains(other, item)) {
        return false;
      }
    }

The old interfaces are still supported, for now, but will be deprecated
in a future commit and removed in the next major release after that.

In addition to making matchers and custom equality testers simpler,
this change sets the stage for adding support for custom object
formatters. Those will be architecturally similar to custom equality
testers, and by injecting a `MatchersUtil` instance everywhere we can
add them without requiring user code to pass them around as used to be
the case with custom object formatters.
2020-02-10 17:25:50 -08:00
Elliot Nelson bf4694333c Improve wrapper function and parameter naming 2020-02-06 10:29:02 -05:00
Elliot Nelson 9febe3159d Allow callThrough to call constructor functions without errors 2020-01-28 19:40:44 -05:00
Steve Gravrock 7f392d188e Don't leak global error handlers between Jasmine's own tests 2020-01-20 10:18:29 -08:00
Steve Gravrock a497d0942a Report async expectations that complete after the runable completes
It's very easy to forget to `await` or `return` the promise returned
from `expectAsync`. When that happens, the expectation failure will
occur after the spec or suite's result has been reported to reporters,
and the failure will typically not be shown to the user. This change
adds a top-level suite failure in that case, similar to the way we
report unhandled exceptions or promise rejections that occur after the
runable completes. Adding the error at the top level gives us the best
chance of getting in before the set of failures we add it to is sent
to reporters.

See #1752.
2019-09-27 18:31:01 -07:00
Dmitriy T 7263a38c3f Adds new configuration option to failSpecWithNoExpectations that will report specs without expectations as failures if enabled 2019-09-05 09:47:38 -07:00
Tony Brix f77ee32c56 Add custom async matchers 2019-08-30 09:30:14 -07: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
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
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