Closed
Description
Hi, thank you for a great testing library!
Is there any additional setup I need to do to make the snapshot testing work smoothly with [styled-components](https://github.com/styled-components/styled-components)
?
The generated snapshots are not useful as they're missing the entire CSS.
Snapshot with react-test-renderer
:
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Component SubmitButton renders correctly 1`] = `
<View
accessible={true}
isTVSelectable={true}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Object {
"alignItems": "center",
"backgroundColor": "#006a35",
"borderColor": "rgba(0, 0, 0, 0)",
"borderRadius": 24,
"borderWidth": 1.5,
"height": 48,
"justifyContent": "center",
"marginBottom": 40,
"marginHorizontal": 36,
"opacity": 1,
}
}
>
<Text
labelColor="#fff"
style={
Array [
Object {
"color": "#fff",
"fontFamily": "UniversLTPro-65Bold",
"fontSize": 12,
"letterSpacing": 1,
"lineHeight": 14,
},
]
}
>
</Text>
</View>
`;
Snapshot with react-native-testing-library
:
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Component SubmitButton renders correctly 1`] = `
Object {
"output": <ForwardRef
disabled={false}
onPress={[Function]}
>
<ForwardRef
labelColor="#fff"
>
</ForwardRef>
</ForwardRef>,
}
`;
As you can see, the snapshot spits out a bunch of ForwardRef
components and doesn't list the CSS so the snapshot test only shows props passed to components and is not really useful.
Is there any additional setup I need here or do we need to add support for this in react-native-testing-library
or styled-components
?