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(mutate): a more sane default for mutate #2452

Merged
merged 2 commits into from
Sep 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 0 additions & 3 deletions e2e/test/jasmine-ts-node/stryker.conf.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"$schema": "../../node_modules/@stryker-mutator/core/schema/stryker-schema.json",
"mutate": [
"{src,lib}/**/*.ts?(x)"
],
"checkers": [
"typescript"
],
Expand Down
4 changes: 0 additions & 4 deletions e2e/test/jest-react-enyme-ts/stryker.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
"packageManager": "npm",
"testRunner": "jest",
"tempDirName": "stryker-tmp",
"mutate": [
"src/*.tsx",
"!src/*.spec.tsx"
],
"concurrency": 2,
"coverageAnalysis": "off",
"reporters": [
Expand Down
3 changes: 0 additions & 3 deletions e2e/test/mocha-ts-node/stryker.conf.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"$schema": "../../node_modules/@stryker-mutator/core/schema/stryker-schema.json",
"mutate": [
"{src,lib}/**/*.ts?(x)"
],
"packageManager": "npm",
"testRunner": "mocha",
"concurrency": 1,
Expand Down
3 changes: 0 additions & 3 deletions e2e/test/typescript-transpiling/stryker.conf.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"$schema": "../../node_modules/@stryker-mutator/core/schema/stryker-schema.json",
"mutate": [
"src/*.ts"
],
"packageManager": "npm",
"testRunner": "mocha",
"concurrency": 1,
Expand Down
4 changes: 0 additions & 4 deletions e2e/test/vue-cli-javascript-jest/stryker.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
"mutator": {
"plugins": []
},
"mutate": [
"{src,lib}/**/*.+(js|vue)",
"!{src,lib}/**/*.spec.js"
],
"tempDirName": "stryker-tmp",
"packageManager": "npm",
"testRunner": "jest",
Expand Down
4 changes: 0 additions & 4 deletions e2e/test/vue-cli-typescript-mocha/stryker.conf.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{
"$schema": "../../node_modules/@stryker-mutator/core/schema/stryker-schema.json",
"mutate": [
"{src,lib}/**/*.+(ts|vue)",
"!{src,lib}/**/*.spec.ts"
],
"packageManager": "npm",
"testRunner": "mocha",
"concurrency": 2,
Expand Down
3 changes: 0 additions & 3 deletions e2e/test/vue-javascript/stryker.conf.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"$schema": "../../node_modules/@stryker-mutator/core/schema/stryker-schema.json",
"mutate": [
"src/**/*.js", "src/**/*.vue"
],
"testRunner": "karma",
"reporters": [
"clear-text",
Expand Down
6 changes: 2 additions & 4 deletions packages/api/schema/stryker-core.json
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,8 @@
"type": "string"
},
"default": [
"{src,lib}/**/*.js?(x)",
"!{src,lib}/**/__tests__/**/*.js?(x)",
"!{src,lib}/**/?(*.)+(spec|test).js?(x)",
"!{src,lib}/**/*+(Spec|Test).js?(x)"
"{src,lib}/**/!(*.+(s|S)pec|*.+(t|T)est).+(cjs|mjs|js|ts|jsx|tsx|html|vue)",
"!{src,lib}/**/__tests__/**/*.+(cjs|mjs|js|ts|jsx|tsx|html|vue)"
]
},
"mutator": {
Expand Down
3 changes: 0 additions & 3 deletions packages/core/test/helpers/setupMocha.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ chai.use(sinonChai);
chai.use(chaiAsPromised);

export const mochaHooks = {
before() {
console.log('BEFORE ALL!');
},
afterEach() {
sinon.restore();
testInjector.reset();
Expand Down
47 changes: 47 additions & 0 deletions packages/core/test/integration/input/InputFileResolver.it.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import path = require('path');

import { factory, testInjector } from '@stryker-mutator/test-helpers';
import { expect } from 'chai';

import { coreTokens } from '../../../src/di';
import InputFileResolver from '../../../src/input/InputFileResolver';

const resolveTestResource: typeof path.resolve = path.resolve.bind(
path,
__dirname,
'..' /* input */,
'..' /* integration */,
'..' /* test */,
'testResources',
'input-files'
);

describe(`${InputFileResolver.name} integration`, () => {
let sut: InputFileResolver;
let originalCwd: string;

beforeEach(() => {
originalCwd = process.cwd();
sut = testInjector.injector.provideValue(coreTokens.reporter, factory.reporter()).injectClass(InputFileResolver);
});

afterEach(() => {
process.chdir(originalCwd);
});

it('should by default resolve reasonable project source files to be mutated', async () => {
process.chdir(resolveTestResource());
const inputFiles = await sut.resolve();
expect(inputFiles.filesToMutate.map((file) => file.name)).deep.eq([
resolveTestResource('lib', 'string-utils.js'),
resolveTestResource('src', 'app.ts'),
resolveTestResource('src', 'components', 'calculator', 'calculator.component.tsx'),
resolveTestResource('src', 'components', 'heading', 'heading.component.vue'),
resolveTestResource('src', 'index.html'),
resolveTestResource('src', 'services', 'storage.ts'),
resolveTestResource('src', 'services', 'test.ts'),
resolveTestResource('src', 'utils', 'commonjs.cjs'),
resolveTestResource('src', 'utils', 'esm.mjs'),
]);
});
});
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.