Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dr3/rtl-debug


https://github.com/dr3/rtl-debug

Last synced: 1 day ago
JSON representation

Awesome Lists containing this project

README

        

# Issue

When using `npm link` to link a dependancy that uses `jest-styled-components` it doesnt return the css generated by styled components.

# What is this repo?

This repo shows the bug, it has 2 examples,

- psammead-headings which links to psammead-test-helpers (which uses `jest-styled-components`),

- psammead-headings-with-test-helpers which has `jest-styled-components` as a dependancy directly

When `psammead-headings` is locally linked to `psammead-test-helpers`, `jest-styled-components` via `react-testing-library` produces a fragment without styles, vs when `psammead-headings-with-test-helpers` uses `react-testing-library` and `jest-styled-components` which does have styles.

# To Replicate issue

Install the top level repo and all child packages
```
npm install
```

Link psammead-headings to psammead-test-helpers locally
```
cd packages/psammead-headings && npm link ../psammead-test-helpers && cd ..;
```

Build the files and run the test
```
npm run build && npm run test -- -u
```

See that the snapshots generated are different, one has css included, one doesnt

`packages/psammead-headings-with-test-helpers/src/__snapshots__/index.test.jsx.snap`
`packages/psammead-headings/src/__snapshots__/index.test.jsx.snap`