Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time is always reported as NaN #196

Closed
nicojs opened this issue Mar 9, 2018 · 2 comments
Closed

Time is always reported as NaN #196

nicojs opened this issue Mar 9, 2018 · 2 comments

Comments

@nicojs
Copy link
Contributor

nicojs commented Mar 9, 2018

The time reporting is broken since a change done in Jasmine in October of last year.

The way time reporting works now is:

  this.specStarted = function (specResult) {
    specResult.startTime = new _Date().getTime()
  }

  this.specDone = function (specResult) {
    var skipped = specResult.status === 'disabled' || specResult.status === 'pending'

    var result = {
        // ...
        time: skipped ? 0 : new _Date().getTime() - specResult.startTime,
    }
}

However, the arguments of reporters are cloned from the original since this commit: jasmine/jasmine@1f6c91d#diff-0aba87f0f765b8ab7c25d0aa59530ed2

Thus the specResult object is not the same anymore, specResult.startTime is always undefined, thus the time will be NaN.

I think the first release with this change was 2.9

@nicojs nicojs changed the title Time is always reported as null Time is always reported as NaN Mar 9, 2018
@nicojs
Copy link
Contributor Author

nicojs commented Mar 9, 2018

@slackersoft shouldn't this have been reported as a breaking change? It is reported as "Issue" in the changelog: https://github.com/jasmine/jasmine/blob/master/release_notes/2.9.0.md

@slackersoft
Copy link
Contributor

I would be inclined to look at the fact that Jasmine previously used the same actual object as the result as a implementation detail of Jasmine and as such, not defined functionality. This means we can make changes for better interoperability (as that PR was) of other libraries that might depend on Jasmine.

As a side note, next time you have an issue you'd like to bring up with the Jasmine team, please don't just @ a single maintainer in an unrelated repository, but create a new issue in an appropriate Jasmine repository. This way you ensure that you concern can be viewed with more Jasmine context, and in the case that the person you select isn't available.

johnjbarton pushed a commit that referenced this issue Mar 28, 2018
* fix(time): report correct time since Jasmine v2.9.0

Time reporting broke since jasmine-core v2.9 because the reporter API
now receives copies of spec results instead of the real deal.
We cannot rely on the same object being passed around.

Fixes #196
willmendesneto pushed a commit to willmendesneto/ng-numbers-only that referenced this issue Nov 16, 2018
## The devDependency [karma-jasmine](https://github.com/karma-runner/karma-jasmine) was updated from `1.1.2` to `2.0.0`.
This version is **not covered** by your **current version range**.

If you don’t accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update.

---

<details>
<summary>Release Notes for v2.0.0</summary>

<ul>
<li>feat (adapter): Use jasmine's new configure method (<a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="375153235" data-permission-text="Issue title is private" data-url="karma-runner/karma-jasmine#224" data-hovercard-type="pull_request" data-hovercard-url="/karma-runner/karma-jasmine/pull/224/hovercard" href="https://urls.greenkeeper.io/karma-runner/karma-jasmine/pull/224">#224</a>) (<a href="https://urls.greenkeeper.io/karma-runner/karma-jasmine/commit/6663e47">6663e47</a>), closes <a href="https://urls.greenkeeper.io/karma-runner/karma-jasmine/issues/224" data-hovercard-type="pull_request" data-hovercard-url="/karma-runner/karma-jasmine/pull/224/hovercard">#224</a> <a href="https://urls.greenkeeper.io/karma-runner/karma-jasmine/issues/221" data-hovercard-type="issue" data-hovercard-url="/karma-runner/karma-jasmine/issues/221/hovercard">#221</a></li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><strong>adapter:</strong> Remove incorrect function and its call. (<a href="https://urls.greenkeeper.io/karma-runner/karma-jasmine/issues/183" data-hovercard-type="pull_request" data-hovercard-url="/karma-runner/karma-jasmine/pull/183/hovercard">#183</a>) (<a href="https://urls.greenkeeper.io/karma-runner/karma-jasmine/commit/cada4a9">cada4a9</a>)</li>
<li>return false for every entry is irrelevant (<a href="https://urls.greenkeeper.io/karma-runner/karma-jasmine/issues/206" data-hovercard-type="pull_request" data-hovercard-url="/karma-runner/karma-jasmine/pull/206/hovercard">#206</a>) (<a href="https://urls.greenkeeper.io/karma-runner/karma-jasmine/commit/d7523d0">d7523d0</a>), closes <a href="https://urls.greenkeeper.io//github.com/karma-runner/karma-jasmine/pull/206/issues/discussion_r186142116">/github.com/karma-runner/karma-jasmine/pull/206#discussion_r186142116</a></li>
<li><strong>console:</strong> Re-add Error: to the stack (<a href="https://urls.greenkeeper.io/karma-runner/karma-jasmine/issues/228" data-hovercard-type="pull_request" data-hovercard-url="/karma-runner/karma-jasmine/pull/228/hovercard">#228</a>) (<a href="https://urls.greenkeeper.io/karma-runner/karma-jasmine/commit/d0b980d">d0b980d</a>)</li>
<li><strong>time:</strong> report correct time since Jasmine v2.9.0 (<a href="https://urls.greenkeeper.io/karma-runner/karma-jasmine/issues/197" data-hovercard-type="pull_request" data-hovercard-url="/karma-runner/karma-jasmine/pull/197/hovercard">#197</a>) (<a href="https://urls.greenkeeper.io/karma-runner/karma-jasmine/commit/022ee04">022ee04</a>), closes <a href="https://urls.greenkeeper.io/karma-runner/karma-jasmine/issues/196" data-hovercard-type="issue" data-hovercard-url="/karma-runner/karma-jasmine/issues/196/hovercard">#196</a></li>
</ul>
<h3>Chores</h3>
<ul>
<li><strong>deps:</strong> Drop node v4 support. (<a href="https://urls.greenkeeper.io/karma-runner/karma-jasmine/issues/214" data-hovercard-type="pull_request" data-hovercard-url="/karma-runner/karma-jasmine/pull/214/hovercard">#214</a>) (<a href="https://urls.greenkeeper.io/karma-runner/karma-jasmine/commit/e604132">e604132</a>)</li>
</ul>
<h3>Features</h3>
<ul>
<li>Propagate errors thrown in afterAll blocks (<a href="https://urls.greenkeeper.io/karma-runner/karma-jasmine/commit/f3fa264">f3fa264</a>), closes <a href="https://urls.greenkeeper.io/karma-runner/karma-jasmine/issues/161" data-hovercard-type="issue" data-hovercard-url="/karma-runner/karma-jasmine/issues/161/hovercard">#161</a></li>
<li>update the version to 2.0.0 and restrict node version available to 4.0 (<a href="https://urls.greenkeeper.io/karma-runner/karma-jasmine/commit/c84316e">c84316e</a>)</li>
</ul>
<h3>BREAKING CHANGES</h3>
<ul>
<li><code>stopOnFailure</code>, which was previously documented in karma-jasmine's README, is<br>
not configuration option for jasmine. Use <code>oneFailurePerSpec</code> instead.</li>
</ul>
<p>Requires peerDependency Jasmine@^3.3.0</p>
<ul>
<li><strong>deps:</strong> Drop support for node 4.x</li>
</ul>
</details>

<details>
<summary>Commits</summary>
<p>The new version differs by 9 commits.</p>
<ul>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma-jasmine/commit/2dbec133017572933d02d67a88673d5d67fb227a"><code>2dbec13</code></a> <code>chore: release v2.0.0</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma-jasmine/commit/4ddfe2ffdf667c66eaddcc405c7042cdde685ddb"><code>4ddfe2f</code></a> <code>chore: update contributors</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma-jasmine/commit/d0b980db3cb363b7fb0cd48dcd7d529aac83fbca"><code>d0b980d</code></a> <code>fix(console): Re-add Error: to the stack (#228)</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma-jasmine/commit/6663e4733ad673472bfc4dae7c76d076370e5770"><code>6663e47</code></a> <code>feat (adapter): Use jasmine's new configure method (#224)</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma-jasmine/commit/e604132ce243f685b5547745b9739c420a294729"><code>e604132</code></a> <code>chore(deps): Drop node v4 support. (#214)</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma-jasmine/commit/66f598a5fd9b899f655e706576e725b02ccc3de1"><code>66f598a</code></a> <code>docs:(typo) timeoutInterval (#212)</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma-jasmine/commit/5b45cc12618bf6591bbf8fb3271f2c608927fceb"><code>5b45cc1</code></a> <code>Adding timeout configuration option (#211)</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma-jasmine/commit/d7523d0d89f89c8c4f454ddd83ef09da1858e207"><code>d7523d0</code></a> <code>fix: return false for every entry is irrelevant (#206)</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma-jasmine/commit/3b20480a5a1cfa769c2a1861455c76d3bfaaab52"><code>3b20480</code></a> <code>--grep option now supports real regular expressions but not masks only. (#204)</code></li>
</ul>
<p>See the <a href="https://urls.greenkeeper.io/karma-runner/karma-jasmine/compare/b670e886dde410b6f28736985036e2ba6c74141e...2dbec133017572933d02d67a88673d5d67fb227a">full diff</a></p>
</details>

<details>
  <summary>FAQ and help</summary>

  There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html). If those don’t help, you can always [ask the humans behind Greenkeeper](https://github.com/greenkeeperio/greenkeeper/issues/new).
</details>

---


Your [Greenkeeper](https://greenkeeper.io) bot 🌴
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants