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

Support .labrc.js for configuration #601

Merged
merged 5 commits into from Jun 14, 2016

Conversation

@geek
Copy link
Member

geek commented Jun 8, 2016

Closes #598

@geek geek added the feature label Jun 8, 2016
@geek geek added this to the 10.7.2 milestone Jun 8, 2016
@geek geek assigned geek and cjihrig and unassigned geek Jun 8, 2016
@@ -11,7 +11,7 @@ const internals = {

module.exports = (args, callback, root) => {

const cli = ChildProcess.spawn('node', [].concat(internals.labPath, args), { 'cwd' : root ? root : '.' });
const cli = ChildProcess.spawn('node', [].concat(internals.labPath, args), { cwd : root ? root : '.' });

This comment has been minimized.

Copy link
@cjihrig

cjihrig Jun 8, 2016

Contributor

While you're here... root ? root : '.' could just be root || '.' I think.

@@ -0,0 +1,6 @@
module.exports = {

This comment has been minimized.

Copy link
@cjihrig

cjihrig Jun 8, 2016

Contributor

Does the find rc module support file extensions? Being able to specify .js would be nice at least for syntax highlighting.

This comment has been minimized.

Copy link
@gergoerdosi

gergoerdosi Jun 8, 2016

Contributor

I agree, would be good to use an extension. Eslint deprecated .eslintrc too in favor of .eslintrc.json, .eslintrc.yaml, etc.

README.md Outdated

**lab** supports a `.labrc` configuration file for centralizing lab settings.
The `.labrc` file can be located in the current working directory or in the
users home directory. The `.labrc` file needs to be able to be required by

This comment has been minimized.

Copy link
@cjihrig

cjihrig Jun 8, 2016

Contributor

user -> user's

This comment has been minimized.

Copy link
@cjihrig

cjihrig Jun 8, 2016

Contributor

The second sentence might start better as "The .labrc file must be requirable by"

@cjihrig

This comment has been minimized.

Copy link
Contributor

cjihrig commented Jun 8, 2016

Maybe I'm missing something, but where do I look to see what options are supported by this new file? Are the config options just the name of the long command line flags without the -- in front?

@geek

This comment has been minimized.

Copy link
Member Author

geek commented Jun 8, 2016

I will update the readme to make it clearer what the allowed options are. They are the same long names as the cli options.

@Marsup

This comment has been minimized.

Copy link
Member

Marsup commented Jun 8, 2016

Do you think we should be able to provide our own labrc or do you prefer a base labrc overridden through cli ?

@geek

This comment has been minimized.

Copy link
Member Author

geek commented Jun 12, 2016

@cjihrig should be ready to go. I would rather the file be .labrc instead of supporting .labrc.json and .lanrc.js.

@Marsup you can provide your own labrc, lab doesn't ship with one.

@Marsup

This comment has been minimized.

Copy link
Member

Marsup commented Jun 12, 2016

@geek I didn't mean that. You always have multiple test configuration, how do you intend to deal with that + rc ?

@geek

This comment has been minimized.

Copy link
Member Author

geek commented Jun 12, 2016

@Marsup the first one found closest to the heart of the project wins.

  1. Current directory
  2. Parent of current directory, until the root folder is encountered
  3. $HOME/.${apprc}
@cjihrig

This comment has been minimized.

Copy link
Contributor

cjihrig commented Jun 13, 2016

LGTM

@geek geek changed the title Support .labrc for configuration Support .labrc.js for configuration Jun 14, 2016
@geek geek merged commit 4d22872 into hapijs:master Jun 14, 2016
2 checks passed
2 checks passed
Node Security No known vulnerabilities found
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@geek geek deleted the geek:labrc branch Jun 14, 2016
@yelworc

This comment has been minimized.

Copy link

yelworc commented Jun 14, 2016

Quick note: The removed default for NODE_ENV caught me by surprise – my tests were suddenly running with the wrong app configuration after updating lab...

@geek

This comment has been minimized.

Copy link
Member Author

geek commented Jun 14, 2016

@yelworc thanks for the report. I will investigate the issue, it shouldn't have happened because there is a default environment set in the runner https://github.com/hapijs/lab/blob/master/lib/runner.js#L40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.