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

fix(jest-runner): fix stryker error on todo tests #1420

Merged
merged 1 commit into from
Feb 26, 2019
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
2 changes: 2 additions & 0 deletions packages/jest-runner/src/JestTestRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ export default class JestTestRunner implements TestRunner {
return TestStatus.Success;
case 'pending':
return TestStatus.Skipped;
case 'todo':
return TestStatus.Skipped;
default:
return TestStatus.Failed;
}
Expand Down
55 changes: 55 additions & 0 deletions packages/jest-runner/test/helpers/testResultProducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,58 @@ export const createPendingResult = () => ({
],
wasInterrupted: false
});

export const createTodoResult = () => ({
numFailedTests: 0,
numFailedTestSuites: 0,
numPassedTests: 1,
numPassedTestSuites: 1,
numPendingTests: 0,
numPendingTestSuites: 0,
numRuntimeErrorTestSuites: 0,
numTodoTests: 1,
numTotalTests: 2,
numTotalTestSuites: 1,
startTime: 1551045971122,
success: true,
testResults: [
{
console: null,
coverage: undefined,
displayName: undefined,
failureMessage: null,
leaks: false,
numFailingTests: 0,
numPassingTests: 1,
numPendingTests: 0,
numTodoTests: 1,
perfStats: [Object],
skipped: false,
snapshot: [Object],
sourceMaps: {},
testResults: [
{
ancestorTitles: [ 'App' ],
duration: 4,
failureMessages: [],
fullName: 'App renders without crashing',
location: null,
numPassingAsserts: 0,
status: 'passed',
title: 'renders without crashing'
},
{
ancestorTitles: [ 'App' ],
duration: 0,
failureMessages: [],
fullName: 'App renders without crashing with children',
location: null,
numPassingAsserts: 0,
status: 'todo',
title: 'renders without crashing with children'
}
],
}
],
wasInterrupted: false
});
25 changes: 25 additions & 0 deletions packages/jest-runner/test/unit/JestTestRunner.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,31 @@ describe('JestTestRunner', () => {
});
});

it('should call the jestTestRunner run method and return a todo runResult', async () => {
jestTestAdapterMock.run.resolves({ results: fakeResults.createTodoResult() });

const result = await jestTestRunner.run(runOptions);

expect(result).to.deep.equal({
errorMessages: [],
status: RunStatus.Complete,
tests: [
{
failureMessages: [],
name: 'App renders without crashing',
status: TestStatus.Success,
timeSpentMs: 4
},
{
failureMessages: [],
name: 'App renders without crashing with children',
status: TestStatus.Skipped,
timeSpentMs: 0
}
]
});
});

it('should call the jestTestRunner run method and return a negative runResult', async () => {
jestTestAdapterMock.run.resolves({ results: fakeResults.createFailResult() });

Expand Down