Не могу проверить Стилизованный Компонент в Jest - PullRequest
0 голосов
/ 15 мая 2018

При попытке запустить простой тест снимка я получаю следующее:

TypeError: _styledComponents2.default.View is not a function

      2 | import styled from "styled-components";
      3 |
    > 4 | const ButtonContainer = styled.View`
      5 |   flex-direction: row;
      6 |   align-items: center;
      7 |   justify-content: center;

Я пробовал:

"moduleNameMapper": {
      "styled-components":
        "<rootDir>/node_modules/styled-components/dist/styled-components.native.cjs.js"
    }

А также добавление https://github.com/styled-components/jest-styled-components

Но мне не повезло.

1 Ответ

0 голосов
/ 30 июля 2018

Убедитесь, что объект "moduleNameMapper" находится внутри блока "jest".

...