I'm trying to run unit tests but got this error:
TypeError: (0 , _umi.formatMessage) is not a function
π· ε€η°ζ₯ιͺ€
Starting from ant design pro v4 with typescript and complete scaffolding, I created the following test in pages/result/success' folder and run the command npm run test tests.tsx
Here is the test I used:
import {shallow} from 'enzyme';
import React from 'react';
import Success from './index';
const enzyme = require('enzyme');
const Adapter = require('enzyme-adapter-react-16');
describe('Tests CustomerList', (): void => {
enzyme.configure({adapter: new Adapter()}); // I had to add this to solve an enzyme configuration error
it('renders with Result', () => {
const wrapper = shallow(<Success />); // Rendering
expect(wrapper.find('Result').length).toBe(1); // Has Result component
expect(wrapper.find('Result').prop('type')).toBe('success'); // The type of the Result component is success
});
});
π ζζη»ζ
I used the code given in the doc here: UI Test, so it should pass...
I don't understand why I get this error despite the code run perfectly when I run npm start...
How can I solve this problem?
It would be great if there were more information about UI testing in the documentation, some examples for e2e and unit tests (or a repo with examples), and also if Dumi was included and configured to work directly with ant design pro. :D
π bug ζθΏ°
I'm trying to run unit tests but got this error:
TypeError: (0 , _umi.formatMessage) is not a function
π· ε€η°ζ₯ιͺ€
Starting from ant design pro v4 with typescript and complete scaffolding, I created the following test in pages/result/success' folder and run the command
npm run test tests.tsx
Here is the test I used:
π ζζη»ζ
I used the code given in the doc here: UI Test, so it should pass...
Β© ηζ¬δΏ‘ζ―
Everything is let to the default installed by the command:
yarn create ump MyApp
. Here is the package.json file:I don't understand why I get this error despite the code run perfectly when I run npm start... How can I solve this problem?
It would be great if there were more information about UI testing in the documentation, some examples for e2e and unit tests (or a repo with examples), and also if Dumi was included and configured to work directly with ant design pro. :D
Thanks for the help!