I'm trying to set up tests, where we are using Angular 1.5, TSify, and Karma. I'm very, close, but I'm running into an issue that I haven't quite got right:
I'm following the setup described here: https://github.com/cmlenz/tsify-test (this example doesn't include angular)
I get an error from angular-mocks: "Cannot set property 'mock' of undefined"
That has to be either a timing thing or a scope thing -- either angular-mocks is loading too soon, or browserify is wrapping up the scope of the angular variable, and mocks can't see it. No idea.
Here are the pertinent parts of my karma.conf.js file:
frameworks: ['browserify', 'jasmine'],
files: [
'https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js',
'./node_modules/angular-mocks/angular-mocks.js',
'./modules/**/*.spec.ts'
],
exclude: [],
preprocessors: {
'**/*.ts': 'browserify'
},
browserify: {
debug: true,
plugin: [
['tsify']
]
},
This must have something to do with the way I'm loading mocks -- it's not used by my angular app, just the tests, so that must have something to do with it.
Any hints?