Как запустить тестирование пользовательского интерфейса? - PullRequest
1 голос
/ 14 апреля 2020

Когда я начинаю тестировать приложение, появляется ошибка:

    Jest encountered an unexpected token

    This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.

    By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".

    Here's what you can do:

...

    You'll find more details and examples of these config options in the docs:
    https://jestjs.io/docs/en/configuration.html

    Details:

    /home/mmvs/Desktop/ReactNative/node_modules/react-navigation/src/index.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){export * from '@react-navigation/core';

Как решить эту ошибку?

1 Ответ

0 голосов
/ 14 апреля 2020

Вам необходимо добавить moduleNameMapper в пакет. json посмотрите по этой ссылке: https://jestjs.io/docs/en/webpack#handling -stati c -assets

...