Hi there, I'm attempting to use this library to help inject styles into my snapshots as advertised and sadly I'm not having any luck. I was hoping I would at least get an error but I get nothing.
Following the example in the docs I have this:
import React from 'react';
import styled from 'styled-components';
import renderer from 'react-test-renderer';
const Button = styled.button`
color: blue;
`;
test('it works', () => {
const tree = renderer.create(<Button />).toJSON();
expect(tree).toMatchSnapshot();
});
Output:
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`it works 1`] = `
<button
className="kQBUXH"
/>
`;
I was expecting to see the styles and hashes replaced but I don't get any of that and no errors at all. I tried digging in a bit and it looks like one issue is the masterSheet.names Map is empty. Not sure why that's the case but I tried removing all the plugins I have in my jest.setup.ts file and trying to access the masterSheet.names myself and it is indeed empty so not sure whats going on.
Hi there, I'm attempting to use this library to help inject styles into my snapshots as advertised and sadly I'm not having any luck. I was hoping I would at least get an error but I get nothing.
Following the example in the docs I have this:
Output:
I was expecting to see the styles and hashes replaced but I don't get any of that and no errors at all. I tried digging in a bit and it looks like one issue is the
masterSheet.names
Map is empty. Not sure why that's the case but I tried removing all the plugins I have in myjest.setup.ts
file and trying to access themasterSheet.names
myself and it is indeed empty so not sure whats going on.Here are my plugins and package versions:
Any help here greatly appreciated. Thank you