-
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.
fix(JestTestRunner): fix stryker error on skipping tests (#1168)
Implement `TestStatus.Skipped` for pending jest results so Stryker does not fail on the first testrun when tests are marked as `skip` Fixes #1152
- Loading branch information
Showing
3 changed files
with
188 additions
and
122 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
278 changes: 157 additions & 121 deletions
278
packages/stryker-jest-runner/test/helpers/testResultProducer.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 |
---|---|---|
@@ -1,122 +1,158 @@ | ||
export function createFailResult() { | ||
return { | ||
numFailedTests: 2, | ||
numFailedTestSuites: 1, | ||
numPassedTests: 0, | ||
numPassedTestSuites: 0, | ||
numPendingTests: 0, | ||
numPendingTestSuites: 0, | ||
numRuntimeErrorTestSuites: 0, | ||
numTotalTests: 2, | ||
numTotalTestSuites: 1, | ||
startTime: 1513852010583, | ||
success: false, | ||
testResults: [ | ||
{ | ||
console: null, | ||
coverage: undefined, | ||
failureMessage: 'test failed - App.test.js', | ||
numFailingTests: 2, | ||
numPassingTests: 0, | ||
numPendingTests: 0, | ||
skipped: false, | ||
sourceMaps: {}, | ||
testFilePath: 'App.test.js', | ||
testResults: [ | ||
{ | ||
ancestorTitles: ['App'], | ||
duration: 2, | ||
failureMessages: [ | ||
'Fail message 1', | ||
'Fail message 2' | ||
], | ||
fullName: 'App render renders without crashing', | ||
numPassingAsserts: 0, | ||
status: 'failed', | ||
title: 'renders without crashing' | ||
}, | ||
{ | ||
ancestorTitles: ['App'], | ||
duration: 0, | ||
failureMessages: [ | ||
'Fail message 3', | ||
'Fail message 4' | ||
], | ||
fullName: 'App render renders without crashing', | ||
numPassingAsserts: 0, | ||
status: 'failed', | ||
title: 'renders without crashing' | ||
} | ||
] | ||
}, | ||
{ | ||
console: null, | ||
coverage: undefined, | ||
failureMessage: null, | ||
numFailingTests: 0, | ||
numPassingTests: 1, | ||
numPendingTests: 0, | ||
perfStats: [Object], | ||
skipped: false, | ||
snapshot: [Object], | ||
sourceMaps: {}, | ||
testFilePath: 'App.test.js', | ||
testResults: [ | ||
{ | ||
ancestorTitles: ['App'], | ||
duration: 23, | ||
failureMessages: [], | ||
fullName: 'App renders without crashing', | ||
numPassingAsserts: 0, | ||
status: 'passed', | ||
title: 'renders without crashing' | ||
} | ||
] | ||
} | ||
], | ||
wasInterrupted: false | ||
}; | ||
} | ||
export const createFailResult = () => ({ | ||
numFailedTests: 2, | ||
numFailedTestSuites: 1, | ||
numPassedTests: 0, | ||
numPassedTestSuites: 0, | ||
numPendingTests: 0, | ||
numPendingTestSuites: 0, | ||
numRuntimeErrorTestSuites: 0, | ||
numTotalTests: 2, | ||
numTotalTestSuites: 1, | ||
startTime: 1513852010583, | ||
success: false, | ||
testResults: [ | ||
{ | ||
console: null, | ||
coverage: undefined, | ||
failureMessage: 'test failed - App.test.js', | ||
numFailingTests: 2, | ||
numPassingTests: 0, | ||
numPendingTests: 0, | ||
skipped: false, | ||
sourceMaps: {}, | ||
testFilePath: 'App.test.js', | ||
testResults: [ | ||
{ | ||
ancestorTitles: ['App'], | ||
duration: 2, | ||
failureMessages: [ | ||
'Fail message 1', | ||
'Fail message 2' | ||
], | ||
fullName: 'App render renders without crashing', | ||
numPassingAsserts: 0, | ||
status: 'failed', | ||
title: 'renders without crashing' | ||
}, | ||
{ | ||
ancestorTitles: ['App'], | ||
duration: 0, | ||
failureMessages: [ | ||
'Fail message 3', | ||
'Fail message 4' | ||
], | ||
fullName: 'App render renders without crashing', | ||
numPassingAsserts: 0, | ||
status: 'failed', | ||
title: 'renders without crashing' | ||
} | ||
] | ||
}, | ||
{ | ||
console: null, | ||
coverage: undefined, | ||
failureMessage: null, | ||
numFailingTests: 0, | ||
numPassingTests: 1, | ||
numPendingTests: 0, | ||
perfStats: [Object], | ||
skipped: false, | ||
snapshot: [Object], | ||
sourceMaps: {}, | ||
testFilePath: 'App.test.js', | ||
testResults: [ | ||
{ | ||
ancestorTitles: ['App'], | ||
duration: 23, | ||
failureMessages: [], | ||
fullName: 'App renders without crashing', | ||
numPassingAsserts: 0, | ||
status: 'passed', | ||
title: 'renders without crashing' | ||
} | ||
] | ||
} | ||
], | ||
wasInterrupted: false | ||
}); | ||
|
||
export function createSuccessResult() { | ||
return { | ||
numFailedTests: 0, | ||
numFailedTestSuites: 0, | ||
numPassedTests: 1, | ||
numPassedTestSuites: 1, | ||
numPendingTests: 0, | ||
numPendingTestSuites: 0, | ||
numRuntimeErrorTestSuites: 0, | ||
numTotalTests: 1, | ||
numTotalTestSuites: 1, | ||
startTime: 1513857548132, | ||
success: true, | ||
testResults: [ | ||
{ | ||
console: null, | ||
coverage: undefined, | ||
failureMessage: null, | ||
numFailingTests: 0, | ||
numPassingTests: 1, | ||
numPendingTests: 0, | ||
perfStats: [Object], | ||
skipped: false, | ||
snapshot: [Object], | ||
sourceMaps: {}, | ||
testFilePath: 'App.test.js', | ||
testResults: [ | ||
{ | ||
ancestorTitles: ['App'], | ||
duration: 23, | ||
failureMessages: [], | ||
fullName: 'App renders without crashing', | ||
numPassingAsserts: 0, | ||
status: 'passed', | ||
title: 'renders without crashing' | ||
} | ||
] | ||
} | ||
], | ||
wasInterrupted: false | ||
}; | ||
} | ||
export const createSuccessResult = () => ({ | ||
numFailedTests: 0, | ||
numFailedTestSuites: 0, | ||
numPassedTests: 1, | ||
numPassedTestSuites: 1, | ||
numPendingTests: 0, | ||
numPendingTestSuites: 0, | ||
numRuntimeErrorTestSuites: 0, | ||
numTotalTests: 1, | ||
numTotalTestSuites: 1, | ||
startTime: 1513857548132, | ||
success: true, | ||
testResults: [ | ||
{ | ||
console: null, | ||
coverage: undefined, | ||
failureMessage: null, | ||
numFailingTests: 0, | ||
numPassingTests: 1, | ||
numPendingTests: 0, | ||
perfStats: [Object], | ||
skipped: false, | ||
snapshot: [Object], | ||
sourceMaps: {}, | ||
testFilePath: 'App.test.js', | ||
testResults: [ | ||
{ | ||
ancestorTitles: ['App'], | ||
duration: 23, | ||
failureMessages: [], | ||
fullName: 'App renders without crashing', | ||
numPassingAsserts: 0, | ||
status: 'passed', | ||
title: 'renders without crashing' | ||
} | ||
] | ||
} | ||
], | ||
wasInterrupted: false | ||
}); | ||
|
||
export const createPendingResult = () => ({ | ||
numFailedTests: 0, | ||
numFailedTestSuites: 0, | ||
numPassedTests: 1, | ||
numPassedTestSuites: 1, | ||
numPendingTests: 0, | ||
numPendingTestSuites: 0, | ||
numRuntimeErrorTestSuites: 0, | ||
numTotalTests: 1, | ||
numTotalTestSuites: 1, | ||
startTime: 1513857548132, | ||
success: true, | ||
testResults: [ | ||
{ | ||
console: null, | ||
coverage: undefined, | ||
failureMessage: null, | ||
numFailingTests: 0, | ||
numPassingTests: 1, | ||
numPendingTests: 0, | ||
perfStats: [Object], | ||
skipped: false, | ||
snapshot: [Object], | ||
sourceMaps: {}, | ||
testResults: [ | ||
{ | ||
ancestorTitles: ['App'], | ||
duration: 0, | ||
failureMessages: [], | ||
fullName: 'App renders without crashing', | ||
numPassingAsserts: 0, | ||
status: 'pending', | ||
title: 'renders without crashing' | ||
} | ||
] | ||
} | ||
], | ||
wasInterrupted: false | ||
}); |
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