Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(test-frameworks): Remove side effects from all test-framework plugins #1319

Merged
merged 57 commits into from
Feb 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
eb51b11
Add dependency injection idea
nicojs Dec 26, 2018
b5d16e8
Merge branch 'master' into 667-remove-side-effects
nicojs Dec 28, 2018
f000155
Merge branch 'master' into 667-remove-side-effects
nicojs Dec 29, 2018
9a532c7
Started with implementation of new pugin mechanism.
nicojs Dec 30, 2018
4137cde
Finish up the broadcast reporter migration
nicojs Dec 30, 2018
7842052
Let the logger be injected in the HtmlReporter
nicojs Dec 30, 2018
c265402
test(TestInjector): Implement and use TestInjector
nicojs Dec 31, 2018
f4cd5d8
Add the ability to inject values into a tree of dependencies.
nicojs Jan 1, 2019
50a01a6
Improve HTML reporter typings
nicojs Jan 2, 2019
9647484
Rename CorrespondingTypes
nicojs Jan 2, 2019
3bc1785
Refactor all the things.
nicojs Jan 7, 2019
22c1902
Test: Add unit tests for `StrykerError` and `errorToString`
nicojs Jan 7, 2019
48acafa
Test: Update tests for stryker-api
nicojs Jan 7, 2019
014a167
Add npmignore and npmrc to typed-inject
nicojs Jan 7, 2019
e5d230b
Rename - plugins -> Plugins part 1
nicojs Jan 7, 2019
4fac5ee
Rename - plugins -> Plugins part 2
nicojs Jan 7, 2019
a609213
Update plugin loader to load from correct node_modules directory
nicojs Jan 7, 2019
8f66a39
Add typed-inject to local install of e2e tests
nicojs Jan 7, 2019
46711ed
Add missing dependency to `polymer-project` e2e test
nicojs Jan 7, 2019
a781d7c
Add missing dependency to `jest-react` e2e test
nicojs Jan 7, 2019
b22365d
Remove stryker-api dependency from stryker-util
nicojs Jan 7, 2019
90f0fcb
docs(typed-inject): Add README
nicojs Jan 8, 2019
8be8358
docs(typed-inject): Add "magic tokens" section to readme
nicojs Jan 8, 2019
dfeb4b0
docs(typed-html): add gh markdown table
nicojs Jan 8, 2019
dabc80a
test(typed-inject): Add integration tests
nicojs Jan 8, 2019
f9dfc62
test(typed-inject): Add more unit and integration tests
nicojs Jan 8, 2019
bb1ff55
refactor(stryker-api): Rename stryker-api/di to stryker-api/plugin an…
nicojs Jan 9, 2019
ef8fb92
Merge branch 'master' into 667-remove-side-effects
nicojs Jan 9, 2019
a159897
refactor(html-reporter): Revert back html reporter in order to presen…
nicojs Jan 9, 2019
ce338cc
fix(plugin-loader): Fix dynamicly loading of deprecated plugins
nicojs Jan 9, 2019
266c1b6
feat(plugins): Make sure you can also create a plugin with a factory …
nicojs Jan 10, 2019
8222f5f
feat(plugins): Load all config editor plugins in the new way
nicojs Jan 10, 2019
38d3176
feat(plugins): Remove side effects from loading the jest config edito…
nicojs Jan 10, 2019
bbcda68
feat(mocha-runner): Remove side effects from MockConfigEditor plugin
nicojs Jan 10, 2019
a102dd4
feat(plugin): Remove side effects from typescript config editor
nicojs Jan 10, 2019
37a2e68
refactor(plugins): Move all stryker plugin stuff back to stryker-api
nicojs Jan 11, 2019
2dc8ed6
docs(api): Document the plugin api
nicojs Jan 11, 2019
416fadf
refactor: Change naming of plugin contexts and methods for declaring …
nicojs Jan 11, 2019
8e828b9
Merge branch '667-remove-side-effects' into 667-remove-side-effects-c…
nicojs Jan 11, 2019
41788db
Allign with the new naming in stryker-api
nicojs Jan 11, 2019
5aa28a2
Add missing dev dependency
nicojs Jan 11, 2019
940b28e
Add typed-inject as dev dep of mocha-runner to get access to it's types
nicojs Jan 11, 2019
b030f25
feat(stryker): Use DI to create the test framework plugins
nicojs Jan 15, 2019
e90d407
feat(test-frameworks): Remove side effects from all test frameworks
nicojs Jan 16, 2019
028b8d4
Merge branch 'master' into 667-remove-side-effects-config-editors
nicojs Jan 16, 2019
7b2ab08
Merge branch 'master' into 667-remove-side-effects-test-framework-plu…
nicojs Jan 16, 2019
74608ae
feat(di): Create a `PluginCreator` that can be reused for all plugin …
nicojs Jan 17, 2019
b1022f4
Merge branch '667-remove-side-effects' into 667-remove-side-effects-c…
nicojs Jan 17, 2019
524b670
Use plugin creator
nicojs Jan 17, 2019
6da9395
Fix typo in typed-inject readme (#1321)
hugo-vrijswijk Jan 17, 2019
c1ebd45
Merge branch '667-remove-side-effects' into 667-remove-side-effects-c…
nicojs Jan 17, 2019
4d970cc
Merge branch '667-remove-side-effects-config-editors' into 667-remove…
nicojs Jan 18, 2019
714e6bd
Use new plugin creator
nicojs Jan 21, 2019
36dae19
Merge branch 'master' into 667-remove-side-effects-test-framework-plu…
nicojs Feb 5, 2019
98238ae
fix failing tests after merge
nicojs Feb 5, 2019
ea9fa96
Make sure lerna installs stryker-api
nicojs Feb 5, 2019
1ec804f
Remove typed inject
nicojs Feb 5, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9,029 changes: 2,035 additions & 6,994 deletions e2e/package-lock.json

Large diffs are not rendered by default.

80 changes: 37 additions & 43 deletions packages/stryker-api/package.json
Original file line number Diff line number Diff line change
@@ -1,45 +1,39 @@
{
"name": "stryker-api",
"version": "0.23.0",
"description": "The api for the extendable JavaScript mutation testing framework Stryker",
"scripts": {
"start": "tsc -w",
"clean": "rimraf \"+(*.d.ts|*.js|*.map)\" \"src/**/+(*.d.ts|*.js|*.map)\" \"test/**/+(*.d.ts|*.js|*.map)\" \"testResources/module/+(*.d.ts|*.js|*.map)\" \"testResources/module/node_modules/stryker-api\" .nyc_output reports",
"test": "nyc --reporter=html --report-dir=reports/coverage --lines 90 --functions 68 --branches 63 npm run mocha",
"mocha": "mocha \"test/unit/**/*.js\" && mocha --timeout 100000 \"test/integration/**/*.js\""
},
"repository": {
"type": "git",
"url": "https://github.com/stryker-mutator/stryker"
},
"keywords": [
"mutation testing",
"mutation",
"testing",
"test",
"js",
"stryker"
],
"contributors": [
"nicojs <jansennico@gmail.com>",
"Alex van Assem <avassem@gmail.com>",
"Jeremy Nagel <jeremy.nagel@learnosity.com>",
"Philipp Weissenbacher <philipp.weissenbacher@gmail.com>",
"Simon de Lang <simondelang@gmail.com>"
],
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/stryker-mutator/stryker/issues"
},
"homepage": "https://github.com/stryker-mutator/stryker/tree/master/packages/stryker-api#readme",
"engines": {
"node": ">=6"
},
"dependencies": {
"tslib": "~1.9.3"
},
"devDependencies": {
"surrial": "~0.1.1",
"typed-inject": "^0.1.1"
}
"name": "stryker-api",
"version": "0.23.0",
"description": "The api for the extendable JavaScript mutation testing framework Stryker",
"repository": {
"type": "git",
"url": "https://github.com/stryker-mutator/stryker"
},
"keywords": [
"mutation testing",
"mutation",
"testing",
"test",
"js",
"stryker"
],
"contributors": [
"nicojs <jansennico@gmail.com>",
"Alex van Assem <avassem@gmail.com>",
"Jeremy Nagel <jeremy.nagel@learnosity.com>",
"Philipp Weissenbacher <philipp.weissenbacher@gmail.com>",
"Simon de Lang <simondelang@gmail.com>"
],
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/stryker-mutator/stryker/issues"
},
"homepage": "https://github.com/stryker-mutator/stryker/tree/master/packages/stryker-api#readme",
"engines": {
"node": ">=6"
},
"dependencies": {
"tslib": "~1.9.3"
},
"devDependencies": {
"surrial": "~0.1.1",
"typed-inject": "^0.1.1"
}
}
6 changes: 4 additions & 2 deletions packages/stryker-jasmine/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { TestFrameworkFactory } from 'stryker-api/test_framework';
import JasmineTestFramework from './JasmineTestFramework';
import { declareClassPlugin, PluginKind } from 'stryker-api/plugin';

TestFrameworkFactory.instance().register('jasmine', JasmineTestFramework);
export const strykerPlugins = [
declareClassPlugin(PluginKind.TestFramework, 'jasmine', JasmineTestFramework)
];
26 changes: 3 additions & 23 deletions packages/stryker-jasmine/test/unit/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,10 @@
import * as sinon from 'sinon';
import * as path from 'path';
import { TestFrameworkFactory } from 'stryker-api/test_framework';
import { expect } from 'chai';
import { strykerPlugins } from '../..';
import JasmineTestFramework from '../../src/JasmineTestFramework';

describe('index', () => {
let sandbox: sinon.SinonSandbox;

const mockFactory = () => ({ register: sinon.stub() });
let testFrameworkFactoryMock: any;

beforeEach(() => {
sandbox = sinon.createSandbox();
testFrameworkFactoryMock = mockFactory();

sandbox.stub(TestFrameworkFactory, 'instance').returns(testFrameworkFactoryMock);

// Not import the `index` file es6 style, because we need to
// make sure it is re-imported every time.
const indexPath = path.resolve('./src/index.js');
delete require.cache[indexPath];
require('../../src/index');
it('should export strykerPlugins', () => {
expect(strykerPlugins[0].injectableClass).eq(JasmineTestFramework);
});

it('should register the JasmineTestFramework', () =>
expect(testFrameworkFactoryMock.register).to.have.been.calledWith('jasmine', JasmineTestFramework));

afterEach(() => sandbox.restore());
});
104 changes: 49 additions & 55 deletions packages/stryker-jest-runner/package.json
Original file line number Diff line number Diff line change
@@ -1,59 +1,53 @@
{
"name": "stryker-jest-runner",
"version": "1.3.0",
"description": "A plugin to use the jest test runner and framework in Stryker, the JavaScript mutation testing framework",
"main": "src/index.js",
"scripts": {
"start": "tsc -w",
"clean": "rimraf \"+(test|src)/**/*+(.d.ts|.js|.map)\" .nyc_output reports coverage",
"test": "nyc --reporter=html --report-dir=reports/coverage --lines 80 --functions 80 --branches 75 npm run mocha",
"mocha": "mocha \"test/helpers/**/*.js\" \"test/unit/**/*.js\" && mocha --timeout 30000 \"test/helpers/**/*.js\" \"test/integration/**/*.js\" --exit"
},
"repository": {
"type": "git",
"url": "https://github.com/stryker-mutator/stryker.git"
},
"engines": {
"node": ">=6"
},
"keywords": [
"stryker",
"stryker-plugin",
"jest",
"stryker-test-runner"
],
"author": "Sander koenders <sanderkoenders@gmail.com>",
"contributors": [
"Maarten Mulders <mthmulders@users.noreply.github.com>",
"mshogren <m_shogren@yahoo.com>",
"Nico Jansen <jansennico@gmail.com>",
"Simon de Lang <simondelang@gmail.com>",
"Philipp Weissenbacher <philipp.weissenbacher@gmail.com>",
"Sander koenders <sanderkoenders@gmail.com>"
],
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/stryker-mutator/stryker/issues"
},
"homepage": "https://github.com/stryker-mutator/stryker/tree/master/packages/stryker-jest-runner#readme",
"devDependencies": {
"name": "stryker-jest-runner",
"version": "1.3.0",
"description": "A plugin to use the jest test runner and framework in Stryker, the JavaScript mutation testing framework",
"main": "src/index.js",
"repository": {
"type": "git",
"url": "https://github.com/stryker-mutator/stryker.git"
},
"engines": {
"node": ">=6"
},
"keywords": [
"stryker",
"stryker-plugin",
"jest",
"stryker-test-runner"
],
"author": "Sander koenders <sanderkoenders@gmail.com>",
"contributors": [
"Maarten Mulders <mthmulders@users.noreply.github.com>",
"mshogren <m_shogren@yahoo.com>",
"Nico Jansen <jansennico@gmail.com>",
"Simon de Lang <simondelang@gmail.com>",
"Philipp Weissenbacher <philipp.weissenbacher@gmail.com>",
"Sander koenders <sanderkoenders@gmail.com>"
],
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/stryker-mutator/stryker/issues"
},
"homepage": "https://github.com/stryker-mutator/stryker/tree/master/packages/stryker-jest-runner#readme",
"devDependencies": {
"@stryker-mutator/test-helpers": "0.0.0",
"@types/semver": "~5.5.0",
"jest": "~23.6.0",
"react": "~16.7.0",
"react-dom": "~16.7.0",
"react-scripts": "~2.1.0",
"react-scripts-ts": "~3.1.0",
"@types/semver": "~5.5.0",
"jest": "~23.6.0",
"react": "~16.7.0",
"react-dom": "~16.7.0",
"react-scripts": "~2.1.0",
"react-scripts-ts": "~3.1.0",
"stryker-api": "^0.23.0"
},
"peerDependencies": {
"jest": ">= 22.0.0",
"stryker-api": ">=0.18.0 <0.24.0"
},
"dependencies": {
"semver": "~5.6.0"
},
"initStrykerConfig": {
"coverageAnalysis": "off"
}
},
"peerDependencies": {
"jest": ">= 22.0.0",
"stryker-api": ">=0.18.0 <0.24.0"
},
"dependencies": {
"semver": "~5.6.0"
},
"initStrykerConfig": {
"coverageAnalysis": "off"
}
}
6 changes: 4 additions & 2 deletions packages/stryker-mocha-framework/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { TestFrameworkFactory } from 'stryker-api/test_framework';

import MochaTestFramework from './MochaTestFramework';
import { PluginKind, declareClassPlugin } from 'stryker-api/plugin';

TestFrameworkFactory.instance().register('mocha', MochaTestFramework);
export const strykerPlugins = [
declareClassPlugin(PluginKind.TestFramework, 'mocha', MochaTestFramework)
];
82 changes: 38 additions & 44 deletions packages/stryker-mocha-runner/package.json
Original file line number Diff line number Diff line change
@@ -1,49 +1,43 @@
{
"name": "stryker-mocha-runner",
"version": "0.16.0",
"description": "A plugin to use the mocha test runner in Stryker, the JavaScript mutation testing framework",
"main": "src/index.js",
"scripts": {
"start": "tsc -w",
"clean": "rimraf \"+(test|src)/**/*+(.d.ts|.js|.map)\" .nyc_output reports coverage",
"test": "nyc --reporter=html --report-dir=reports/coverage --lines 80 --functions 80 --branches 75 npm run mocha",
"mocha": "mocha \"test/helpers/**/*.js\" \"test/unit/**/*.js\" && mocha --timeout 10000 \"test/helpers/**/*.js\" \"test/integration/**/*.js\""
},
"repository": {
"type": "git",
"url": "https://github.com/stryker-mutator/stryker"
},
"engines": {
"node": ">=6"
},
"keywords": [
"stryker",
"stryker-plugin",
"mocha",
"stryker-test-runner"
],
"author": "Simon de Lang <simon.delang@infosupport.com>",
"contributors": [
"Nico Jansen <jansennico@gmail.com>",
"Simon de Lang <simondelang@gmail.com>"
],
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/stryker-mutator/stryker/issues"
},
"homepage": "https://github.com/stryker-mutator/stryker/tree/master/packages/stryker-mocha-runner#readme",
"dependencies": {
"multimatch": "~3.0.0",
"tslib": "~1.9.3"
},
"devDependencies": {
"name": "stryker-mocha-runner",
"version": "0.16.0",
"description": "A plugin to use the mocha test runner in Stryker, the JavaScript mutation testing framework",
"main": "src/index.js",
"repository": {
"type": "git",
"url": "https://github.com/stryker-mutator/stryker"
},
"engines": {
"node": ">=6"
},
"keywords": [
"stryker",
"stryker-plugin",
"mocha",
"stryker-test-runner"
],
"author": "Simon de Lang <simon.delang@infosupport.com>",
"contributors": [
"Nico Jansen <jansennico@gmail.com>",
"Simon de Lang <simondelang@gmail.com>"
],
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/stryker-mutator/stryker/issues"
},
"homepage": "https://github.com/stryker-mutator/stryker/tree/master/packages/stryker-mocha-runner#readme",
"dependencies": {
"multimatch": "~3.0.0",
"tslib": "~1.9.3"
},
"devDependencies": {
"@stryker-mutator/test-helpers": "0.0.0",
"@types/multimatch": "~2.1.2",
"@types/multimatch": "~2.1.2",
"stryker-api": "^0.23.0",
"stryker-mocha-framework": "^0.14.0"
},
"peerDependencies": {
"mocha": ">= 2.3.3 < 6",
"stryker-api": ">=0.18.0 <0.24.0"
}
},
"peerDependencies": {
"mocha": ">= 2.3.3 < 6",
"stryker-api": ">=0.18.0 <0.24.0"
}
}
2 changes: 1 addition & 1 deletion packages/stryker-mocha-runner/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TestRunnerFactory } from 'stryker-api/test_runner';
import { declareFactoryPlugin, PluginKind, BaseContext, tokens, commonTokens, Injector } from 'stryker-api/plugin';
import { declareFactoryPlugin, Injector, PluginKind, BaseContext, tokens, commonTokens } from 'stryker-api/plugin';

import MochaTestRunner from './MochaTestRunner';
import MochaConfigEditor from './MochaConfigEditor';
Expand Down
4 changes: 3 additions & 1 deletion packages/stryker/src/Stryker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@ export default class Stryker {
this.injector = configEditorInjector
.provideValue(commonTokens.config, this.config)
.provideValue(commonTokens.options, this.config as StrykerOptions);
this.testFramework = this.injector
.provideFactory(coreTokens.pluginCreatorTestFramework, PluginCreator.createFactory(PluginKind.TestFramework))
.injectClass(TestFrameworkOrchestrator).determineTestFramework();
this.reporter = this.injector
.provideFactory(coreTokens.pluginCreatorReporter, PluginCreator.createFactory(PluginKind.Reporter))
.injectClass(BroadcastReporter);
this.testFramework = new TestFrameworkOrchestrator(this.config).determineTestFramework();
new ConfigValidator(this.config, this.testFramework).validate();
}

Expand Down
Loading