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

fix(runner): Do not persist grep option across runs #3121

Merged
merged 1 commit into from
Sep 5, 2018

Conversation

jvalkeejarvi
Copy link
Contributor

Fix for #2819.

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

@jvalkeejarvi
Copy link
Contributor Author

I signed it!

@googlebot
Copy link

CLAs look good, thanks!

Copy link
Contributor

@johnjbarton johnjbarton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure what your design goal is here. I would have expected that client.args would be the original config args unless explicitly overridden by the command line. That is what 'original' would mean to me.

But the code persists the previous values.

Maybe you want to move the save calls outside of the response handler, just inside the create() call where config comes in. Then the restore call can be unconditional every time the handler executes. That would be simpler and I think less surprising usage.

lib/helper.js Show resolved Hide resolved
lib/middleware/runner.js Outdated Show resolved Hide resolved
lib/middleware/runner.js Outdated Show resolved Hide resolved
@jvalkeejarvi
Copy link
Contributor Author

Maybe you want to move the save calls outside of the response handler, just inside the create() call where config comes in.

What create call do you mean?

Sorry I'm a bit confused. This is my first PR to this repo so I'm not that familiar with the codebase.

@johnjbarton
Copy link
Contributor

Sorry I meant createRunnerMiddleware()
https://github.com/karma-runner/karma/blob/master/lib/middleware/runner.js#L15

Quite a bit of karma-runner code has node modules exporting createXX functions that return functions. The arguments of the createXX functions are closed over in the returned functions.

@jvalkeejarvi
Copy link
Contributor Author

Calling helper.saveOriginalArgs() outside response handler (just after this line https://github.com/karma-runner/karma/blob/master/lib/middleware/runner.js#L15) is a bit problematic in tests.

createRunnerMiddleware() is called in beforeEach

handler = createRunnerMiddleware(
but config.client.args is set in test case itself.
config = _.merge(config, {client: {args: run.existingConfig}})

As a result config.client.originalArgs is always left undefined in tests. I don't know if tests can be fixed without major changes. What do you think?

@johnjbarton
Copy link
Contributor

I think you can redefine handler just before it is called in the clientArgs test, with a bonus if you wrap the non-clientArgs tests in a describe() block with beforeEach() setting handler for those tests (so the handler is not redefined.

Maybe its not too hard?

Copy link
Contributor

@johnjbarton johnjbarton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, 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

Successfully merging this pull request may close these issues.

3 participants