If your goal is to have multiple karma configs in your solution to support both your CI pipeline and your local dev enviroment then you can use the –karma-config option in your ng test command to do the same.
You can create a separate karma-local.conf.js (clone of karma.conf.js) in your solution with your custom changes which you want to run on your local enviroment.
You can then run the ng test command like this:
ng test --karma-config karma-local.conf.js
That will run the tests based on karma-local.conf.js settings.