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(checker): add checker api #2240

Merged
merged 6 commits into from
Jun 9, 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: 3 additions & 0 deletions packages/api/check.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './src/check/Checker';
export * from './src/check/CheckResult';
export * from './src/check/CheckStatus';
1 change: 1 addition & 0 deletions packages/api/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export { default as File } from './src/core/File';
export { default as Position } from './src/core/Position';
export { default as Location } from './src/core/Location';
export { default as Range } from './src/core/Range';
export { default as Mutant } from './src/core/Mutant';
export * from './src-generated/stryker-core';
export * from './src/core/ReportTypes';
export * from './src/core/StrykerOptionsSchema';
Expand Down
1 change: 0 additions & 1 deletion packages/api/mutant.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export { default as Mutant } from './src/mutant/Mutant';
export { default as Mutator } from './src/mutant/Mutator';
6 changes: 6 additions & 0 deletions packages/api/src/check/CheckResult.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { CheckStatus } from './CheckStatus';

export interface CheckResult {
reason?: string;
status: CheckStatus;
}
4 changes: 4 additions & 0 deletions packages/api/src/check/CheckStatus.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export enum CheckStatus {
Passed = 'passed',
CompileError = 'compileError',
nicojs marked this conversation as resolved.
Show resolved Hide resolved
}
9 changes: 9 additions & 0 deletions packages/api/src/check/Checker.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Mutant } from '../../core';

import { CheckResult } from './CheckResult';

export interface Checker {
init(): Promise<void>;

check(mutant: Mutant): Promise<CheckResult>;
}
File renamed without changes.
4 changes: 1 addition & 3 deletions packages/api/src/mutant/Mutator.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { File } from '../../core';

import Mutant from './Mutant';
import { File, Mutant } from '../../core';

export default interface Mutator {
mutate(inputFiles: readonly File[]): readonly Mutant[];
Expand Down
1 change: 1 addition & 0 deletions packages/api/src/plugin/Contexts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@ export interface PluginContexts {
[PluginKind.TestFramework]: OptionsContext;
[PluginKind.TestRunner]: TestRunnerPluginContext;
[PluginKind.Transpiler]: TranspilerPluginContext;
[PluginKind.Checker]: OptionsContext;
}
1 change: 1 addition & 0 deletions packages/api/src/plugin/PluginKind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export enum PluginKind {
*/
ConfigEditor = 'ConfigEditor',
OptionsEditor = 'OptionsEditor',
Checker = 'Checker',
TestRunner = 'TestRunner',
TestFramework = 'TestFramework',
Transpiler = 'Transpiler',
Expand Down
2 changes: 2 additions & 0 deletions packages/api/src/plugin/Plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { TestFramework } from '../../test_framework';
import { TestRunner } from '../../test_runner';
import { Transpiler } from '../../transpile';
import { OptionsEditor } from '../core/OptionsEditor';
import { Checker } from '../../check';

import { PluginContexts } from './Contexts';
import { PluginKind } from './PluginKind';
Expand Down Expand Up @@ -90,6 +91,7 @@ export interface PluginInterfaces {
[PluginKind.TestFramework]: TestFramework;
[PluginKind.TestRunner]: TestRunner;
[PluginKind.Transpiler]: Transpiler;
[PluginKind.Checker]: Checker;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/api/test/unit/plugin/Plugins.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { declareClassPlugin, declareFactoryPlugin } from '../../../src/plugin/Pl
import { PluginKind } from '../../../src/plugin/PluginKind';
import { tokens, commonTokens } from '../../../src/plugin/tokens';
import { Logger } from '../../../logging';
import { Mutant } from '../../../mutant';
import { Mutant } from '../../../core';

describe('plugins', () => {
describe(declareClassPlugin.name, () => {
Expand Down
1 change: 1 addition & 0 deletions packages/api/tsconfig.src.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"src",
"src-generated",
"schema/*.json",
"check.ts",
"config.ts",
"core.ts",
"logging.ts",
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/TestableMutant.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Location } from '@stryker-mutator/api/core';
import { Mutant } from '@stryker-mutator/api/mutant';
import { Mutant, Location } from '@stryker-mutator/api/core';
import { MutantResult, MutantStatus } from '@stryker-mutator/api/report';
import { TestSelection } from '@stryker-mutator/api/test_framework';
import { RunResult, TestResult } from '@stryker-mutator/api/test_runner';
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/mutants/MutantTestMatcher.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { StrykerOptions } from '@stryker-mutator/api/core';
import { Mutant, StrykerOptions } from '@stryker-mutator/api/core';
import { Logger } from '@stryker-mutator/api/logging';
import { Mutant } from '@stryker-mutator/api/mutant';
import { commonTokens, tokens } from '@stryker-mutator/api/plugin';
import { MatchedMutant } from '@stryker-mutator/api/report';
import { CoverageCollection, CoveragePerTestResult, CoverageResult, StatementMap } from '@stryker-mutator/api/test_runner';
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/mutants/MutatorFacade.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { File, MutatorDescriptor } from '@stryker-mutator/api/core';
import { Mutant, File, MutatorDescriptor } from '@stryker-mutator/api/core';
import { Logger } from '@stryker-mutator/api/logging';
import { Mutant, Mutator } from '@stryker-mutator/api/mutant';
import { Mutator } from '@stryker-mutator/api/mutant';
import { commonTokens, PluginKind, tokens } from '@stryker-mutator/api/plugin';

import { coreTokens, PluginCreator } from '../di';
Expand Down
3 changes: 1 addition & 2 deletions packages/core/test/unit/Sandbox.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import * as path from 'path';

import { File, LogLevel, StrykerOptions } from '@stryker-mutator/api/core';
import { Mutant, File, LogLevel, StrykerOptions } from '@stryker-mutator/api/core';
import { Logger } from '@stryker-mutator/api/logging';
import { Mutant } from '@stryker-mutator/api/mutant';
import { MutantStatus } from '@stryker-mutator/api/report';
import { TestFramework } from '@stryker-mutator/api/test_framework';
import { RunResult, RunStatus } from '@stryker-mutator/api/test_runner';
Expand Down
3 changes: 1 addition & 2 deletions packages/core/test/unit/TestableMutant.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { File } from '@stryker-mutator/api/core';
import { Mutant } from '@stryker-mutator/api/mutant';
import { Mutant, File } from '@stryker-mutator/api/core';
import { mutant, runResult, testResult } from '@stryker-mutator/test-helpers/src/factory';
import { expect } from 'chai';

Expand Down
3 changes: 1 addition & 2 deletions packages/core/test/unit/mutants/MutantTestMatcher.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { File } from '@stryker-mutator/api/core';
import { Mutant } from '@stryker-mutator/api/mutant';
import { Mutant, File } from '@stryker-mutator/api/core';
import { MatchedMutant } from '@stryker-mutator/api/report';
import { TestSelection } from '@stryker-mutator/api/test_framework';
import { CoverageCollection, CoveragePerTestResult, RunStatus, TestResult, TestStatus } from '@stryker-mutator/api/test_runner';
Expand Down
4 changes: 2 additions & 2 deletions packages/javascript-mutator/src/JavaScriptMutator.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as types from '@babel/types';
import { File } from '@stryker-mutator/api/core';
import { Mutant, File } from '@stryker-mutator/api/core';
import { Logger } from '@stryker-mutator/api/logging';
import { Mutant, Mutator } from '@stryker-mutator/api/mutant';
import { Mutator } from '@stryker-mutator/api/mutant';
import { commonTokens, tokens } from '@stryker-mutator/api/plugin';

import BabelParser from './helpers/BabelParser';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { File } from '@stryker-mutator/api/core';
import { Mutant } from '@stryker-mutator/api/mutant';
import { Mutant, File } from '@stryker-mutator/api/core';
import ExpectMutation from '@stryker-mutator/mutator-specification/src/ExpectMutation';
import { testInjector } from '@stryker-mutator/test-helpers';
import { expect } from 'chai';
Expand Down
2 changes: 1 addition & 1 deletion packages/test-helpers/src/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import {
MutatorDescriptor,
strykerCoreSchema,
WarningOptions,
Mutant,
} from '@stryker-mutator/api/core';
import { Logger } from '@stryker-mutator/api/logging';
import { Mutant } from '@stryker-mutator/api/mutant';
import { MatchedMutant, MutantResult, MutantStatus, mutationTestReportSchema, Reporter } from '@stryker-mutator/api/report';
import { TestFramework, TestSelection } from '@stryker-mutator/api/test_framework';
import { RunResult, RunStatus, TestResult, TestStatus } from '@stryker-mutator/api/test_runner';
Expand Down
3 changes: 1 addition & 2 deletions packages/typescript/src/TypescriptMutator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { File, StrykerOptions } from '@stryker-mutator/api/core';
import { Mutant } from '@stryker-mutator/api/mutant';
import { Mutant, File, StrykerOptions } from '@stryker-mutator/api/core';
import { commonTokens, Injector, OptionsContext, tokens } from '@stryker-mutator/api/plugin';
import * as ts from 'typescript';

Expand Down
2 changes: 1 addition & 1 deletion packages/typescript/src/mutator/NodeMutator.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as path from 'path';

import { Mutant } from '@stryker-mutator/api/mutant';
import { Mutant } from '@stryker-mutator/api/core';
import * as ts from 'typescript';

export interface NodeReplacement {
Expand Down
3 changes: 1 addition & 2 deletions packages/typescript/test/integration/sample.it.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import * as fs from 'fs';
import * as path from 'path';

import { File } from '@stryker-mutator/api/core';
import { Mutant } from '@stryker-mutator/api/mutant';
import { Mutant, File } from '@stryker-mutator/api/core';
import { testInjector, factory } from '@stryker-mutator/test-helpers';
import { expect } from 'chai';

Expand Down
3 changes: 1 addition & 2 deletions packages/typescript/test/unit/mutator/mutatorAssertions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { File } from '@stryker-mutator/api/core';
import { Mutant } from '@stryker-mutator/api/mutant';
import { Mutant, File } from '@stryker-mutator/api/core';
import ExpectMutation from '@stryker-mutator/mutator-specification/src/ExpectMutation';
import { expect } from 'chai';
import * as ts from 'typescript';
Expand Down
4 changes: 2 additions & 2 deletions packages/vue-mutator/src/VueMutator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { File } from '@stryker-mutator/api/core';
import { Mutant, Mutator } from '@stryker-mutator/api/mutant';
import { Mutant, File } from '@stryker-mutator/api/core';
import { Mutator } from '@stryker-mutator/api/mutant';
import { tokens } from '@stryker-mutator/api/plugin';

import { MUTATORS_TOKEN } from './helpers/MutatorHelpers';
Expand Down
4 changes: 2 additions & 2 deletions packages/vue-mutator/test/unit/VueMutator.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { File } from '@stryker-mutator/api/core';
import { Mutant, Mutator } from '@stryker-mutator/api/mutant';
import { Mutant, File } from '@stryker-mutator/api/core';
import { Mutator } from '@stryker-mutator/api/mutant';
import { testInjector } from '@stryker-mutator/test-helpers';
import { expect } from 'chai';
import { SinonStubbedInstance } from 'sinon';
Expand Down