[TestSuite] Add stack traces to failed tests
This commit is contained in:
parent
6874c83efd
commit
86d771ba1b
@ -286,8 +286,7 @@ class TestRun {
|
|||||||
suiteId: this.testSuite.id,
|
suiteId: this.testSuite.id,
|
||||||
status: RunStatus.ERR,
|
status: RunStatus.ERR,
|
||||||
time: Date.now() - this.runStartTime,
|
time: Date.now() - this.runStartTime,
|
||||||
message: `Test suite failed: ${error.message}`,
|
message: `Test suite failed: ${error.message}`
|
||||||
stackTrace: error.stack,
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -14,13 +14,14 @@ export function setSuiteStatus({ suiteId, status, time, message, progress }) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setTestStatus({ testId, status, time = 0, message = null }) {
|
export function setTestStatus({ testId, status, stackTrace, time = 0, message = null }) {
|
||||||
return {
|
return {
|
||||||
type: TEST_SET_STATUS,
|
type: TEST_SET_STATUS,
|
||||||
testId,
|
testId,
|
||||||
|
|
||||||
status,
|
status,
|
||||||
message,
|
message,
|
||||||
|
stackTrace,
|
||||||
time,
|
time,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ function testsReducers(state = initState.tests, action: Object): State {
|
|||||||
flattened[`${action.testId}.status`] = action.status;
|
flattened[`${action.testId}.status`] = action.status;
|
||||||
flattened[`${action.testId}.message`] = action.message;
|
flattened[`${action.testId}.message`] = action.message;
|
||||||
flattened[`${action.testId}.time`] = action.time;
|
flattened[`${action.testId}.time`] = action.time;
|
||||||
|
flattened[`${action.testId}.stackTrace`] = action.stackTrace;
|
||||||
|
|
||||||
return unflatten(flattened);
|
return unflatten(flattened);
|
||||||
}
|
}
|
||||||
|
@ -52,25 +52,26 @@ class Test extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { test: { message, description, func, status, time }, testContextName } = this.props;
|
const { test: { stackTrace, description, func, status, time }, testContextName } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
{Test.renderBanner({ status, time })}
|
{Test.renderBanner({ status, time })}
|
||||||
<View >
|
<View >
|
||||||
<ScrollView>
|
<ScrollView style={styles.sectionContainer}>
|
||||||
<Text style={styles.testLabel}>{testContextName}:</Text><Text style={styles.description}>{description}</Text>
|
<Text style={styles.heading}>{testContextName}</Text>
|
||||||
|
<Text style={styles.description}>{description}</Text>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
<ScrollView>
|
<ScrollView style={styles.sectionContainer}>
|
||||||
<Text style={styles.testLabel}>Test Error</Text>
|
<Text style={styles.heading}>Test Error</Text>
|
||||||
<Text style={styles.description}>
|
<Text style={styles.description}>
|
||||||
<Text>{message || 'None'}</Text>
|
<Text>{stackTrace || 'None.'}</Text>
|
||||||
</Text>
|
</Text>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
<Text style={styles.testLabel}>
|
<Text style={styles.heading}>
|
||||||
Test Code Preview
|
Test Code Preview
|
||||||
</Text>
|
</Text>
|
||||||
<ScrollView>
|
<ScrollView style={styles.sectionContainer}>
|
||||||
<Text style={styles.description}>
|
<Text style={styles.description}>
|
||||||
{beautify(removeLastLine(removeFirstLine(func.toString())), { indent_size: 4, break_chained_methods: true })}
|
{beautify(removeLastLine(removeFirstLine(func.toString())), { indent_size: 4, break_chained_methods: true })}
|
||||||
</Text>
|
</Text>
|
||||||
@ -85,8 +86,8 @@ Test.propTypes = {
|
|||||||
test: PropTypes.shape({
|
test: PropTypes.shape({
|
||||||
status: PropTypes.string,
|
status: PropTypes.string,
|
||||||
time: PropTypes.number,
|
time: PropTypes.number,
|
||||||
message: PropTypes.string,
|
|
||||||
func: PropTypes.function,
|
func: PropTypes.function,
|
||||||
|
stackTrace: PropTypes.function,
|
||||||
description: PropTypes.string,
|
description: PropTypes.string,
|
||||||
}).isRequired,
|
}).isRequired,
|
||||||
|
|
||||||
@ -102,12 +103,15 @@ const styles = StyleSheet.create({
|
|||||||
flex: 1,
|
flex: 1,
|
||||||
backgroundColor: '#ffffff',
|
backgroundColor: '#ffffff',
|
||||||
},
|
},
|
||||||
testLabel: {
|
sectionContainer: {
|
||||||
|
minHeight: 100,
|
||||||
|
},
|
||||||
|
heading: {
|
||||||
padding: 5,
|
padding: 5,
|
||||||
backgroundColor: '#0288d1',
|
backgroundColor: '#0288d1',
|
||||||
fontWeight: '600',
|
fontWeight: '600',
|
||||||
color: '#ffffff',
|
color: '#ffffff',
|
||||||
fontSize: 16
|
fontSize: 16,
|
||||||
},
|
},
|
||||||
description: {
|
description: {
|
||||||
padding: 5,
|
padding: 5,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user