-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(test-runner): Use new plugin system to load TestRunner plugins (#…
…1361) * stryker-jasmine-runner * stryker-jest-runner * stryker-karma-runner * stryker-mocha-runner * stryker-wct-runner Set stryker-api as dependency instead of dev-dependency for all plugins.
- Loading branch information
Showing
67 changed files
with
643 additions
and
750 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import { TestRunnerFactory } from 'stryker-api/test_runner'; | ||
|
||
import JasmineTestRunner from './JasmineTestRunner'; | ||
import { declareClassPlugin, PluginKind } from 'stryker-api/plugin'; | ||
|
||
TestRunnerFactory.instance().register('jasmine', JasmineTestRunner); | ||
export const strykerPlugins = [ | ||
declareClassPlugin(PluginKind.TestRunner, 'jasmine', JasmineTestRunner) | ||
]; |
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,7 @@ | ||
import * as sinon from 'sinon'; | ||
import { testInjector } from '@stryker-mutator/test-helpers'; | ||
|
||
afterEach(() => { | ||
sinon.reset(); | ||
testInjector.reset(); | ||
}); |
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,11 +1,10 @@ | ||
import { PluginKind, declareClassPlugin } from 'stryker-api/plugin'; | ||
import { TestRunnerFactory } from 'stryker-api/test_runner'; | ||
import { PluginKind, declareClassPlugin, declareFactoryPlugin } from 'stryker-api/plugin'; | ||
import JestConfigEditor from './JestConfigEditor'; | ||
import JestTestRunner from './JestTestRunner'; | ||
import { jestTestRunnerFactory } from './JestTestRunner'; | ||
|
||
process.env.BABEL_ENV = 'test'; | ||
|
||
export const strykerPlugins = [ | ||
declareClassPlugin(PluginKind.ConfigEditor, 'jest', JestConfigEditor) | ||
declareClassPlugin(PluginKind.ConfigEditor, 'jest', JestConfigEditor), | ||
declareFactoryPlugin(PluginKind.TestRunner, 'jest', jestTestRunnerFactory) | ||
]; | ||
TestRunnerFactory.instance().register('jest', JestTestRunner); |
7 changes: 5 additions & 2 deletions
7
packages/stryker-jest-runner/src/jestTestAdapters/JestPromiseTestAdapter.ts
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
26 changes: 0 additions & 26 deletions
26
packages/stryker-jest-runner/src/jestTestAdapters/JestTestAdapterFactory.ts
This file was deleted.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
packages/stryker-jest-runner/src/jestTestAdapters/index.ts
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,21 @@ | ||
import JestTestAdapter from './JestTestAdapter'; | ||
import JestPromiseAdapter from './JestPromiseTestAdapter'; | ||
import * as semver from 'semver'; | ||
import { Injector, BaseContext, tokens, commonTokens} from 'stryker-api/plugin'; | ||
import { Logger } from 'stryker-api/logging'; | ||
|
||
export const JEST_VERSION_TOKEN = 'jestVersion'; | ||
|
||
export function jestTestAdapterFactory(log: Logger, jestVersion: string, injector: Injector<BaseContext>) { | ||
if (semver.satisfies(jestVersion, '<22.0.0')) { | ||
log.debug('Detected Jest below 22.0.0: %s', jestVersion); | ||
throw new Error('You need Jest version >= 22.0.0 to use Stryker'); | ||
} else { | ||
return injector.injectClass(JestPromiseAdapter); | ||
} | ||
} | ||
|
||
jestTestAdapterFactory.inject = tokens(commonTokens.logger, JEST_VERSION_TOKEN, commonTokens.injector); | ||
export { | ||
JestTestAdapter | ||
}; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.