Skip to content

NEW automatically set strong globalize to english when passing tests#3136

Closed
pierreclr wants to merge 1 commit into
strongloop:masterfrom
pierreclr:FIX/strong-globalize-english-for-tests
Closed

NEW automatically set strong globalize to english when passing tests#3136
pierreclr wants to merge 1 commit into
strongloop:masterfrom
pierreclr:FIX/strong-globalize-english-for-tests

Conversation

@pierreclr

@pierreclr pierreclr commented Jan 25, 2017

Copy link
Copy Markdown
Contributor

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

slnode commented Jan 25, 2017

Copy link
Copy Markdown

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

@slnode

slnode commented Jan 25, 2017

Copy link
Copy Markdown

Can one of the admins verify this patch?

3 similar comments
@slnode

slnode commented Jan 25, 2017

Copy link
Copy Markdown

Can one of the admins verify this patch?

@slnode

slnode commented Jan 25, 2017

Copy link
Copy Markdown

Can one of the admins verify this patch?

@slnode

slnode commented Jan 25, 2017

Copy link
Copy Markdown

Can one of the admins verify this patch?

@pierreclr

Copy link
Copy Markdown
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

bajtos commented Jan 25, 2017

Copy link
Copy Markdown
Member

Hello @pierreclr, thank you for the pull request!

Comment thread lib/globalize.js
var SG = require('strong-globalize');

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

Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread Gruntfile.js

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

Copy link
Copy Markdown
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

bajtos commented Jan 26, 2017

Copy link
Copy Markdown
Member

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