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

Deprecated jasmineEnv configuration breaks plugins #1617

Closed
nasvillanueva opened this issue Oct 26, 2018 · 7 comments
Closed

Deprecated jasmineEnv configuration breaks plugins #1617

nasvillanueva opened this issue Oct 26, 2018 · 7 comments

Comments

@nasvillanueva
Copy link

nasvillanueva commented Oct 26, 2018

Expected Behavior

Since jasmine-core@3.3, configuration object is introduced to Env. Plugins like karma-jasmine, still uses the old style configuration.

Current Behavior

It prevents runners to run jasmine.

Possible Solution

Instead of deprecating it right away, a warning should suffice for the time being, to let plugin maintainers to migrate to the new configuration.

Environment

We're using karma, jasmine, and karma-jasmine to run tests.

@nasvillanueva
Copy link
Author

@cenfun
Copy link

cenfun commented Oct 26, 2018

same issue here
{
"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:9890/context.js:168:14)\n at http://localhost:9890/context.html:167: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:9890/context.js:168:14)\n at http://localhost:9890/context.html:167:22"
}

@slackersoft
Copy link
Member

The old functions haven't been removed, only deprecated. It looks like the error is caused because the way that karma-jasmine is setting the configuration options is breaking the Jasmine environments link to its own this such that reporting the deprecation is failing. The purpose of this change was to explicitly leave the old configuration mechanism functioning, but reporting the deprecation for removal in the future. It looks like karma-jasmine is relying on the happenstance of the functions previously only using closure scoping to set the options, but they now need to be called with an appropriate this.

Hope this helps.

@nasvillanueva
Copy link
Author

nasvillanueva commented Oct 26, 2018

Ah, that makes sense. I'll close this ticket and maybe try to fix it on karma-jasmine. Thank you.

@johnjbarton
Copy link
Contributor

I know you can't do anything about this now, so this is just feedback for the future.

Adding the new configure() API at 3.3 and simultaneously adding deprecation messages is very unpleasant for downstream apps like karma-jasmine. We can't use the new API because we need to support 3.x including 3.2; we don't want the deprecation messages because users will complain; we don't want to support both because we already have limited resources. So in effect this becomes a breaking API change for us.

@slackersoft
Copy link
Member

@johnjbarton sorry about this. I'm not sure what the fully correct answer here is. I added the deprecation warnings to give as much lead time for fixing them before things actually break and the methods are removed, and I know I'll forget to do it later if I wait a release or two.

@johnjbarton
Copy link
Contributor

Hey, we recovered, no problems now, thanks!

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

4 participants