I'll try to approach this question with a little bit of abstraction, since going into the code details would be useless.
I have an angular module that is split in 2 source files, say source1.js and source2.js. Then i have 3 unit test files which are designed to test 3 angular service/factory/provider.
The project layout is as follows:
root | -dist | -source.min.js -src | -source1.js -source2.js -tests | -unit | -service1.js -service2.js -service3.js All the tests, run with karma and jasmine, pass and work as expected. See this bit of karma config to get the point:
files: [ 'bower_components/angular/angular.min.js', 'bower_components/angular-mocks/angular-mocks.js', 'src/*.js', 'tests/unit/*.js' ], Next i minified source1 and source2 with gulpjs into source.min.js and tried to run tests using the minified file, so i changed the karma config as follows:
files: [ 'bower_components/angular/angular.min.js', 'bower_components/angular-mocks/angular-mocks.js', 'dist/*.js', // <--- see here. 'tests/unit/*.js' ], With this configuration all tests are failing because of angular dependency injection - looks like the provider is not being resolved.
What could cause this? I mean, the source code should be the same.