Импорт гламура не работает во время теста
Так что я использую jest
а также enzyme
в проекте, который был создан с использованием create-react-app
, В тестировании реагирует компонент, в котором glamorous
используется для создания views
а также text
и т.д. Выполнение даже самого простого теста поверхностного рендеринга не удается.
Вот код:
import React from 'react';
import { shallow } from 'enzyme';
import GuaranteePage from '../Index';
it('shallow renders without crashing', () => {
shallow(<GuaranteePage />);
});
GuaranteePage
импорт glamorous
от 'glamorous-primitives'
, Когда я запускаю тест, он говорит.
FAIL src/components/Guarantee/__tests__/Index.test.js
● Test suite failed to run
/Users/abhishek/FlyHomes/final/client-web/node_modules/glamorous-primitives/lib/index.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import createGlamorous from './constructor/create-glamorous';
^^^^^^
SyntaxError: Unexpected token import
at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/ScriptTransformer.js:289:17)
at Object.<anonymous> (src/components/Guarantee/Index.jsx:8:28)
at Object.<anonymous> (src/components/Guarantee/__tests__/Index.test.js:3:14)
Есть идеи по этому поводу?