@@ -2,6 +2,16 @@ import { getBuildInfos } from '../envUtils.ts'
22import { browserConfigurations } from './browsers.conf.ts'
33import karmaBaseConf from './karma.base.conf.js'
44
5+ const selectedBrowser = process . env . BS_BROWSER
6+ const filteredConfigurations = selectedBrowser
7+ ? browserConfigurations . filter ( ( configuration ) => configuration . id === selectedBrowser )
8+ : browserConfigurations
9+
10+ if ( selectedBrowser && filteredConfigurations . length === 0 ) {
11+ const availableIds = browserConfigurations . map ( ( c ) => c . id ) . join ( ', ' )
12+ throw new Error ( `Unknown BS_BROWSER "${ selectedBrowser } ". Available: ${ availableIds } ` )
13+ }
14+
515// eslint-disable-next-line import/no-default-export
616export default function ( config ) {
717 config . set ( {
@@ -13,8 +23,8 @@ export default function (config) {
1323 ] ,
1424 plugins : [ ...karmaBaseConf . plugins , 'karma-browserstack-launcher' ] ,
1525 reporters : [ ...karmaBaseConf . reporters , 'BrowserStack' ] ,
16- browsers : browserConfigurations . map ( ( configuration ) => configuration . sessionName ) ,
17- concurrency : 5 ,
26+ browsers : filteredConfigurations . map ( ( configuration ) => configuration . sessionName ) ,
27+ concurrency : filteredConfigurations . length ,
1828 browserDisconnectTolerance : 3 ,
1929 captureTimeout : 2 * 60 * 1000 ,
2030 browserStack : {
@@ -25,7 +35,7 @@ export default function (config) {
2535 video : false ,
2636 } ,
2737 customLaunchers : Object . fromEntries (
28- browserConfigurations . map ( ( configuration ) => [
38+ filteredConfigurations . map ( ( configuration ) => [
2939 configuration . sessionName ,
3040 // See https://github.com/karma-runner/karma-browserstack-launcher#per-browser-options
3141 {
0 commit comments