I'm using Karma with Grunt and the associated plugins. I have everything working using test configurations such as the following:
apiUnitTests: {
files: [
{
src: [
, 'tests/unit/mocks/base.mock.js'
, 'modules/util/util.js'
, 'tests/unit/modules/util/api.test.js'
]
, served: true
}
]
}
, customerUnitTests: {
files: [
{
src: [
, 'tests/unit/mocks/base.mock.js'
, 'modules/util/util.js'
, 'tests/unit/modules/util/customer.test.js'
]
, served: true
}
]
}
The problem with this setup is that when I run the tests, I see the following workflow:
1) Create new browser
2) Run API Tests
3) Destroy the browser
4) Create new browser
5) Run Customer Tests
6) Destroy the browser
The behavior I want is to create a new browser instance, run ALL my tests and then destroy the browser instance.
I've tried the following:
* changing singleRun to false -- This doesn't work because the browser never gets created at all.
* Merging all my tests into 1 object that has multiple objects within its "files" array. This wouldn't be ideal if it worked because each test wouldn't be individually named. I could live with this and hack together aliases to get what I want, but in the end it doesn't seem to work anyway: The test files seem to "pollute" one another. I think it's trying to load every object in the array simultaneously rather than treating them as separate tests.
Any suggestions on how I can get the behavior I want?
Many thanks,
Dan