When I run my application in the browser, I can specify locale: 'en'
as part of dojoConfig
. When I run the tests in Node.js, the locale setting is the default value en
. When I run the tests in a browser, the locale setting is set with the top preferred language of the browser (which is French in my case)...
I tried without success to set locale: 'en'
as part of the loader
configuration in my Intern config file:
return {
useLoader: { 'host-browser': 'node_modules/dojo/dojo.js' },
loader: {
locale: 'en',
packages: [{
name: 'dojo',
location: 'src/libs/dojo'
}, {
...
}
};
How can I set the locale
setting for my tests running into the browsers? As I've two Intern config files, I don't mind doing something different for Node.js and for the browsers.
A+, Dom
I just hit the same issue (because dojo/_base/config.js
was blowing up due to navigator.language
being empty and navigator.userLanguage
being undefined
in my Firefox installation), and needed to get a locale set.
I ended up resorting to adding this to my testconfig.js
:
if (typeof window !== 'undefined') {
// We're running inside a browser.
window.dojoConfig = window.dojoConfig || {};
window.dojoConfig.locale = window.dojoConfig.locale || "en-us";
}
Not sure whether that's 'the correct' way to do it, but it seems to be working for me with Intern 2.1.1.