-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
correctly handle dispose errors in test runners
- Loading branch information
Showing
17 changed files
with
198 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
import { requireResolve } from '@stryker-mutator/util'; | ||
|
||
export async function start(): Promise<void> { | ||
export function start(): Promise<number> { | ||
// Make sure require karma from inside this function, that way it won't break if karma isn't installed and this file is required. | ||
const karma: any = requireResolve('karma'); | ||
await new karma.Server({ | ||
configFile: require.resolve('./stryker-karma.conf'), | ||
}).start(); | ||
const karma = requireResolve('karma') as typeof import('karma'); | ||
return new Promise((res, rej) => { | ||
new karma.Server( | ||
{ | ||
configFile: require.resolve('./stryker-karma.conf'), | ||
}, | ||
res | ||
) | ||
.start() | ||
.catch(rej); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { testInjector } from '@stryker-mutator/test-helpers'; | ||
import { expect } from 'chai'; | ||
|
||
import { KarmaTestRunner } from '../../src/karma-test-runner'; | ||
import { KarmaRunnerOptionsWithStrykerOptions } from '../../src/karma-runner-options-with-stryker-options'; | ||
import { StrykerReporter } from '../../src/karma-plugins/stryker-reporter'; | ||
import { resolveTestResource } from '../helpers/resolve-test-resource'; | ||
|
||
describe.only(`${KarmaTestRunner.name} on using projectType angular`, () => { | ||
afterEach(() => { | ||
StrykerReporter.instance.removeAllListeners(); | ||
}); | ||
|
||
it('should reject when no angular cli is available', async () => { | ||
(testInjector.options as KarmaRunnerOptionsWithStrykerOptions).karma = { | ||
projectType: 'angular-cli', | ||
configFile: resolveTestResource('sampleProject', 'karma-jasmine.conf.js'), | ||
}; | ||
const sut = testInjector.injector.injectClass(KarmaTestRunner); | ||
await expect(sut.init()).rejectedWith("Cannot find module '@angular/cli"); | ||
}); | ||
|
||
// Other tests are done in e2e testing 🤷♀️ | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.