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

Fixes #42 use configPath instead of hard-coded config #100

Merged
merged 1 commit into from
Feb 23, 2017

Conversation

eddie-ruva
Copy link

On this PR I'm trying to tackle the issue brought up in #42 by using configPath instead of the hard coded config path value.

According to the ember-cli docs configPath is private but I couldn't figure out a better/public way to determine this value. If anybody knows of a better way to make this change I'll be happy to integrate the feedback.

README.md Outdated
@@ -33,7 +33,7 @@ When running with `parallel` set to true, the final reports can be merged by usi

## Configuration

Configuration is optional. It should be put in a file at `config/coverage.js`.
Configuration is optional. It should be put in a file at named `coverage.js` inside your ember app config folder (defaults to `config/`).
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd prefer to keep this README line unchanged. 99% of our users will be using config/coverage.js, and I think rewording like jisnjust makes it hard to grok for the vast majority use case. I think a parenthetical aside or a second sentence mentioning that we honor configPath is enough...

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for taking a look at this! I've reworded, let me know if the new message is more inline with what you have in mind.

index.js Outdated
attachMiddleware(app, { root: this.project.root, ui: this.ui });
attachMiddleware(app, {
root: this.project.root,
configDirName: path.dirname(this.project.configPath())
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are we no longer passing in ui?

Can you put the config path invocation above here as a variable declaration (then just pass it through here)?

Copy link
Collaborator

Choose a reason for hiding this comment

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

On second thought, I think it would be better to simply pass the project down into the middleware and have our config util function accept the project and avoid the path munging throughout the rest of the system.

Copy link
Author

Choose a reason for hiding this comment

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

  1. I removed ui because it was not being reference from the middleware so the parameter was unnecessary.

  2. I changed the config code to now take in the full project and construct the path inside.

@rwjblue
Copy link
Collaborator

rwjblue commented Feb 22, 2017

@kategengler - Any objections?

@rwjblue rwjblue requested a review from kategengler February 22, 2017 21:53
Copy link
Collaborator

@kategengler kategengler left a comment

Choose a reason for hiding this comment

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

Only opposed to passing the project object around, would prefer to keep defined inputs to things outside of index.js, but I could be convinced otherwise.

Thanks for tackling this!

@rwjblue I am otherwise 👍 if you think it's ok to be using configPath (since it is marked private)

lib/config.js Outdated
* @returns {Configuration} configuration to use for project
*/
function config(root) {
var configFile = path.join(root, 'config', 'coverage.js');
function config(project) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd prefer to continue to pass in the config path, rather than pass around the project (I'd like to keep usage of ember-cli api contained to index.js as much as possible)

Copy link
Author

Choose a reason for hiding this comment

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

I think this makes sense because I could still keep the logic to construct the path to coverage.js inside config like @rwjblue suggested but also not take in the whole project object.

I can make this change if there are no objections.

Copy link
Collaborator

Choose a reason for hiding this comment

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

👍 - Thanks for iterating on this with us

Copy link
Author

Choose a reason for hiding this comment

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

@kategengler @rwjblue No problem! I've updated with the feedback received. Let me know if you notice anything else and thanks for taking the time to review this

@@ -12,12 +12,12 @@ function logError(err, req, res, next) {
next(err);
}

module.exports = function(app, options) {
module.exports = function(app, project) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this should still take options and get a configPath and root as properties

@kategengler
Copy link
Collaborator

Looks great, thanks for making those changes @eddie-ruva

@kategengler kategengler merged commit 4adcb6b into ember-cli-code-coverage:master Feb 23, 2017
@alias-mac
Copy link

@kategengler, any estimate when will this be released in the next version?

@rwjblue
Copy link
Collaborator

rwjblue commented Apr 8, 2017

Released now as v0.3.12.

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