I need to pass custom argument to chrome in order to set locale: --lang en-US
I've done it using customLauncher. My src/karma.conf.js:
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
],
customLaunchers: {
ChromeHeadlessLang: {
base: 'ChromeHeadless',
flags: [
'--lang en-US', // ensure that the test works on all environments with the same locale
]
}
},
browsers: ['Chrome'],
...
});
};
And I can run it using
ng test --browsers ChromeHeadlessLang
However, I would like to use the lang flags by default, without specifying --browsers
ng test
Can I override the default flags, so that they are used when I run just ng test
?
You can specify default values for all parameters of
ng test
insideangular.json
e.g.:
All available parameters: https://angular.io/cli/test