Skip to content

Conversation

@pierreclr
Copy link
Contributor

@pierreclr pierreclr commented Jan 25, 2017

Description

This PR automatically set strong-globalize language to en in test NODE_ENV.
It also set this env before runing test through grunt task

Related issues

#3105

@slnode
Copy link

slnode commented Jan 25, 2017

Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test."

@slnode
Copy link

slnode commented Jan 25, 2017

Can one of the admins verify this patch?

3 similar comments
@slnode
Copy link

slnode commented Jan 25, 2017

Can one of the admins verify this patch?

@slnode
Copy link

slnode commented Jan 25, 2017

Can one of the admins verify this patch?

@slnode
Copy link

slnode commented Jan 25, 2017

Can one of the admins verify this patch?

@pierreclr
Copy link
Contributor Author

@bajtos Sorry for the long commit name but I'm used to be explicit. I'll try to make the smaller next time

@bajtos bajtos self-assigned this Jan 25, 2017
@bajtos
Copy link
Member

bajtos commented Jan 25, 2017

Hello @pierreclr, thank you for the pull request!

var SG = require('strong-globalize');

if (process.env.NODE_ENV === 'test') {
module.exports = SG({language: 'en'});
Copy link
Member

Choose a reason for hiding this comment

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

@Setogit I am wondering, what environment variables should we change in our tests in order to force strong-globalize to use en language when running the test suite? I'd like to avoid this custom SG initialization used by our tests only.

Copy link
Contributor

Choose a reason for hiding this comment

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

To set the default language, you can use two environment variables:
STRONGLOOP_GLOBALIZE_APP_LANGUAGE, or the OS-level local environment variable, e.g. LANG.


grunt.registerTask('set-test-env', function() {
process.env.NODE_ENV = 'test';
});
Copy link
Member

Choose a reason for hiding this comment

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

This will not work when running the tests manually via mocha. I am proposing to use env-test module instead and configure the environment in test/mocha.opts.

@bajtos
Copy link
Member

bajtos commented Jan 26, 2017

Closing in favour of #3138

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.

5 participants