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

Jasmine specFilter is always overwritten #23

Closed
segrey opened this issue Apr 2, 2019 · 4 comments · Fixed by #24
Closed

Jasmine specFilter is always overwritten #23

segrey opened this issue Apr 2, 2019 · 4 comments · Fixed by #24

Comments

@segrey
Copy link

segrey commented Apr 2, 2019

If kjhtml reporter is specified in karma.conf.js, any other karma adapter (e.g. karma-jasmine) cannot set specFilter.
The problem is that specFilter is overwritten even if 'spec' query parameter is unspecified (https://github.com/dfederm/karma-jasmine-html-reporter/blob/v1.4.0/src/lib/adapter.js#L70).

It makes it impossible to run karma run -- "--grep=my spec name".

Please set specFilter only if spec query parameter is specified.

@dfederm
Copy link
Owner

dfederm commented Apr 3, 2019

This package just re-packages part of Jasmine, so that specific line is coming from here:
https://github.com/jasmine/jasmine/blob/74fd0e08e7aa25a62bfefbc9e00df0f26aa8561b/lib/jasmine-core/boot.js#L121

Do you know how karma sends the spec filter? Perhaps that needs to be plumbed through properly in this package.

@segrey
Copy link
Author

segrey commented Apr 3, 2019

Karma sets the spec filter here https://github.com/karma-runner/karma-jasmine/blob/v2.0.1/src/adapter.js#L345. The problem is that kjhtml adapter is always executed after karma-jasmine adapter overwriting the spec filter.
Not sure I fully understand the suggested solution with plumbing through property. Could you please provide more details?

@dfederm
Copy link
Owner

dfederm commented Apr 5, 2019

Got it, so you're saying we should not set the spec filter if one already exists and if it's not set in the query string. Seems reasonable.

Feel free to contribute a fix or I'll try to get to it when I have some spare cycles.

@dfederm
Copy link
Owner

dfederm commented Apr 5, 2019

Something like...

if (!config.specFilter || queryString.getParam("spec") {
  config.specFilter = ...
}

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

Successfully merging a pull request may close this issue.

2 participants