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

Deprecation warning with Jasmine-Core@3.3.0 #221

Closed
Lalem001 opened this issue Oct 25, 2018 · 19 comments
Closed

Deprecation warning with Jasmine-Core@3.3.0 #221

Lalem001 opened this issue Oct 25, 2018 · 19 comments

Comments

@Lalem001
Copy link
Contributor

Jasmine-Core 3.3.0 release nodes

Introduce a configuration object to Env deprecating old single use functions

The test fails as well, however I am not sure if that is something that could be fixed here.

HeadlessChrome 0.0.0 (Mac OS X 10.13.6) ERROR: 'DEPRECATION:', 'Setting specFilter directly on Env is deprecated, please use the specFilter option in `configure`'
HeadlessChrome 0.0.0 (Mac OS X 10.13.6) ERROR
  {
    "message": "TypeError: this.deprecated is not a function\n    at Env.throwOnExpectationFailure (/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:1079:12)\n    at setOption (/node_modules/karma-jasmine/lib/adapter.js:354:7)\n    at ContextKarma.start (/node_modules/karma-jasmine/lib/adapter.js:343:5)\n    at ContextKarma.loaded (http://localhost:9876/context.js:168:14)\n    at http://localhost:9876/context.html:47:22",
    "str": "TypeError: this.deprecated is not a function\n    at Env.throwOnExpectationFailure (/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:1079:12)\n    at setOption (/node_modules/karma-jasmine/lib/adapter.js:354:7)\n    at ContextKarma.start (/node_modules/karma-jasmine/lib/adapter.js:343:5)\n    at ContextKarma.loaded (http://localhost:9876/context.js:168:14)\n    at http://localhost:9876/context.html:47:22"
  }
HeadlessChrome 0.0.0 (Mac OS X 10.13.6): Executed 0 of 0 ERROR (0.122 secs / 0 secs)
@Lalem001
Copy link
Contributor Author

After some investigation, it appears the tests failure that results in "this.deprecated is not a function" is caused by client.jasmine configuration being set.

For example, setting such properties on this repo's karma.conf.js causes the error:

module.exports = function (config) {
  config.set({
    frameworks: ['jasmine'],

    files: [
      'src/*.js',
      'test/*.js'
    ],

    browsers: process.env.TRAVIS ? ['Firefox'] : ['Chrome'],

    client: {
      jasmine: {
        random: false,
      }
    },

    autoWatch: true,

    plugins: [
      'karma-firefox-launcher',
      'karma-chrome-launcher',
      require.resolve('./')
    ]
  })
}

This does not absolve karma-jasmine from updating to the new configuration object. I am looking to see if I can figure out a solution.

@Lalem001
Copy link
Contributor Author

@johnjbarton I had a PR up that fixed the issue, but broke support for jasmine < 3.3.0. Do you want to continue supporting such versions?

@johnjbarton
Copy link
Contributor

Yes, we need a solution where the entire jasmine 3.x series works for a karma-jasmine 2.x.

@Lalem001
Copy link
Contributor Author

@johnjbarton Any suggestions on how to get the unit tests to test against the different versions of jasmine?

@johnjbarton
Copy link
Contributor

it appears the tests failure that results in "this.deprecated is not a function" is caused by client.jasmine configuration being set.

We need to run down what exactly is the cause here. Which line of code fails, what is the this value on that line, and how is client.jasmine related?

I hope the jasmine config spec did not change in v3.3?

@Lalem001
Copy link
Contributor Author

Lalem001 commented Oct 29, 2018

The this is incorrect because of Lines 358-361 and Line 372.

#223, resolves the this binding issue. But Jasmine changed the methods that are invoked in these lines to have deprecations notices.

The jasmine config spec actually has changed with 3.3.

Karma-Jasmine's stopOnFailure pointed to throwOnExpectationFailure in jasmines configuration pre 3.3. The new configuration option in Jasmine 3.3 is oneFailurePerSpec

I believe I am close to a PR that handles both cases without deprecation warnings.

@Lalem001
Copy link
Contributor Author

Lalem001 commented Oct 29, 2018

Regarding the PR I am working on,

While the code itself can handle Jasmine 3.3, I don't like that I need to have the unit tests change their behavior to handle Jasmine@>=3.3.0. Its either branch on the version of jasmine, or have separate sets of unit tests.

@tempoc
Copy link

tempoc commented Nov 1, 2018

For our project it was yarn killing it.
Saw the problem when running yarn install which resolved jasmine-core to version 3.3.0.
Fixed by running npm install which resolved jasmine-core to version 3.2.1.

(still an issue with 3.3.0, but hopefully the comment helps people who run into this unexpectedly)

Lalem001 added a commit to Lalem001/karma-jasmine that referenced this issue Nov 6, 2018
Pass `client.jasmine` object directly to `jasmine.configure` method.
See: https://jasmine.github.io/api/3.3/Env.html

Closes: karma-runner#221

BREAKING CHANGE:

`stopOnFailure`, which was previously documented in karma-jasmine's README, is
not configuration option for jasmine. Use `oneFailurePerSpec` instead.

Requires peerDependency Jasmine@^3.3.0
johnjbarton pushed a commit that referenced this issue Nov 7, 2018
Pass `client.jasmine` object directly to `jasmine.configure` method.
See: https://jasmine.github.io/api/3.3/Env.html

Closes: #221

BREAKING CHANGE:

`stopOnFailure`, which was previously documented in karma-jasmine's README, is
not configuration option for jasmine. Use `oneFailurePerSpec` instead.

Requires peerDependency Jasmine@^3.3.0
@julkue
Copy link

julkue commented Nov 8, 2018

I'm also seeing it with ^3.0.0

@FrancescoBorzi
Copy link

getting the same warning here, using:

    "jasmine-core": "^3.3.0",
    "jasmine-spec-reporter": "^4.2.1",
    "karma": "^3.1.1",
    "karma-chrome-launcher": "^2.2.0",
    "karma-cli": "^1.0.1",
    "karma-coverage-istanbul-reporter": "^2.0.4",
    "karma-jasmine": "^1.1.2",
    "karma-jasmine-html-reporter": "^1.4.0",
    "karma-junit-reporter": "^1.2.0",

@webmaster128
Copy link

Unfortunately the patch from #224 is not released yet

@cenfun
Copy link

cenfun commented Nov 15, 2018

Could you please publish new version since it's fixed?

@johnjbarton
Copy link
Contributor

Please send a Pull Request to update the documentation for the new release.

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 🌴
@Lalem001
Copy link
Contributor Author

Lalem001 commented Nov 20, 2018

@johnjbarton Not sure what you are looking for here. The README has a minor update in the PR to correct the invalid configuration value. Are you looking for a section explaining why backward compatibility is lost? And/Or setting the Jasmine 2.0 header to something like Jasmine 2.0 - 3.2 and adding a Jasmine 3.3 header?

@webmaster128
Copy link

@Lalem001 All done now and upgrade possible (see e.g. https://github.com/iov-one/iov-core/pull/542/files)

@johnjbarton
Copy link
Contributor

@Lalem001 AFAICT the "Jasmine 2.0 section of the readme is completely incorrect now. The instructions would result in Jasmine 3.3 and jasmine will be loaded as a dep.

I would prefer instructions limited to the latest release (since we don't have resources for corner cases).

@yasiryc
Copy link

yasiryc commented Jan 2, 2019

Any update when the fix would be published? npm still shows 3.3.0 as latest version

camueller added a commit to camueller/SmartApplianceEnabler that referenced this issue Feb 10, 2019
@MauricioPenteado
Copy link

I fixed it on my side using the follow upgrades:

"jasmine-core": "^3.3.0",
"karma-jasmine": "^2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",

@mowali
Copy link

mowali commented Mar 8, 2019

MauricioPenteado: I have the exact setup like yours but still sees error.

vince8x pushed a commit to bcProFoundation/building-blocks that referenced this issue Aug 4, 2022
Updated dependencies to latest
Use Auto Built Headless Chrome docker image
Declare mongoose-paginate related interfaces instead of using library
@types/mongoose-paginate caused warning message during TypeDoc generation
calculate at_hash for angular-oauth2-oidc 5.0.3 to work

show deprecation warning karma-runner/karma-jasmine#221
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

10 participants