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: Support FIREFOX_BINARY again for web-ext run #523

Merged
merged 3 commits into from
Sep 30, 2016

Conversation

shubheksha
Copy link
Contributor

Fixes #512

  • Created another alias firefox-binary
  • Added a test for the new alias

@coveralls
Copy link

coveralls commented Sep 24, 2016

Coverage Status

Coverage remained the same at 100.0% when pulling aab9d77 on shubheksha:fix/512 into 80c59df on mozilla:master.

@coveralls
Copy link

coveralls commented Sep 24, 2016

Coverage Status

Coverage remained the same at 100.0% when pulling aab9d77 on shubheksha:fix/512 into 80c59df on mozilla:master.

Copy link
Contributor

@kumar303 kumar303 left a comment

Choose a reason for hiding this comment

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

This should use a unit test not a functional test

@@ -218,7 +218,7 @@ Example: $0 --help run.
})
.command('run', 'Run the web extension', commands.run, {
'firefox': {
alias: 'f',
alias: ['f', 'firefox-binary'],
Copy link
Contributor

Choose a reason for hiding this comment

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

looks good

@@ -47,3 +47,44 @@ describe('web-ext run', () => {
});
}));
});

describe('web-ext run', () => {
Copy link
Contributor

@kumar303 kumar303 Sep 24, 2016

Choose a reason for hiding this comment

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

Functional tests are very expensive because they take a lot longer than unit tests. Anytime we add a functional test we have to ask, can this be tested just as well in a unit test? For this case I think the answer is yes. You can make a test that passes in a stub version of the run function and asserts --firefox-binary is passed to the function like run({firefox: '/the/path/'}). You can model it after this test: https://github.com/mozilla/web-ext/blob/master/tests/unit/test.program.js#L283-L294

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doesn't this test do exactly that?

Copy link
Contributor

Choose a reason for hiding this comment

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

No, that test does other things:

  • It invokes the cmd.run() function directly so it doesn't cover any command line option parsing
  • It is making sure that the firefoxApp object (which represents the Firefox application process) is getting called correctly which is something separate

@coveralls
Copy link

coveralls commented Sep 25, 2016

Coverage Status

Coverage remained the same at 100.0% when pulling 21cdf02 on shubheksha:fix/512 into 80c59df on mozilla:master.

Copy link
Contributor

@kumar303 kumar303 left a comment

Choose a reason for hiding this comment

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

The test needs some changes

@@ -307,6 +307,19 @@ describe('program.main', () => {
process.cwd() + path.sep);
});
});
it('passes the path of a firefox binary when specified', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: this line should have one line of whitespace above it to show that it() is a new function separate from the function above it

{commands: fakeCommands})
.then(() => {
assert.equal(fakeCommands.run.called, true);
assert.equal(fakeCommands.run.firstCall.args[0].firefoxBinary,
Copy link
Contributor

Choose a reason for hiding this comment

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

you should assert that the call to run() passes firefox, not firefoxBinary because firefox is the variable used by the command.

Copy link
Contributor

Choose a reason for hiding this comment

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

this test needs to make sure that --firefox-binary gets treated just like --firefox

@coveralls
Copy link

coveralls commented Sep 30, 2016

Coverage Status

Coverage remained the same at 100.0% when pulling f631dc6 on shubheksha:fix/512 into 80c59df on mozilla:master.

Copy link
Contributor

@kumar303 kumar303 left a comment

Choose a reason for hiding this comment

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

Great, thanks

@kumar303 kumar303 merged commit a90c654 into mozilla:master Sep 30, 2016
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.

4 participants