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

Environment set too late #148

Closed
Marsup opened this issue Aug 11, 2014 · 3 comments · Fixed by #150
Assignees
Labels
bug
Milestone

Comments

@Marsup
Copy link
Member

@Marsup Marsup commented Aug 11, 2014

I'm in the process of switching to lab 4 on my project, I have noticed a breaking change on the setting of NODE_ENV. It comes too late and my tests already had time to require environment dependent modules.

@geek geek added this to the 4.1.0 milestone Aug 11, 2014
@geek

This comment has been minimized.

Copy link
Member

@geek geek commented Aug 11, 2014

Are you setting the environment option when executing the tests? What method are you using to run the tests? Also, can you provide an example to help with the repro.

Thanks.

@Marsup

This comment has been minimized.

Copy link
Member Author

@Marsup Marsup commented Aug 11, 2014

Sure, here's a test file to reproduce the error :

var Lab = require('lab');
var lab = exports.lab = Lab.script();
var env = process.env.NODE_ENV

lab.test('assert env is test', function () {

    Lab.expect(env).to.equal('test');
});

Run it with lab cli without any option : AssertionError: expected undefined to equal 'test'.
I'm not providing any environment since test is what I want, but it wouldn't make any difference since the environment is only set on execute.

@hueniverse hueniverse added bug and removed breaking changes labels Aug 11, 2014
@hueniverse

This comment has been minimized.

Copy link
Member

@hueniverse hueniverse commented Aug 11, 2014

It's a bug.

@geek geek self-assigned this Aug 11, 2014
@arb arb closed this in #150 Aug 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.