chore: update README.md
Test utils for plugins of umi.
$ yarn add @umijs/test-utils -D
依赖 umi 和 @testing-library/react,请确保同时依赖了他们。
import { generateTmp, render } from '@umijs/test-utils'; test('normal', async () => { const cwd = join(fixtures, 'normal'); // 生成临时文件 await generateTmp({ cwd }); // 渲染 const { container } = render({ cwd }); // 断言 expect(container.innerHTML).toEqual('<h1>foo</h1>'); });
import { generateHTML, getHTML } from '@umijs/test-utils'; test('normal', async () => { const cwd = join(fixtures, 'normal'); // 生成 HTML await generateHTML({ cwd }); // 渲染 const html = getHTML({ cwd }); // 断言 expect(html).toContain('<h1>foo</h1>'); });
MIT
版权所有:中国计算机学会技术支持:开源发展技术委员会 京ICP备13000930号-9 京公网安备 11010802032778号
@umijs/test-utils
Test utils for plugins of umi.
Install
依赖 umi 和 @testing-library/react,请确保同时依赖了他们。
Test tmp file
Test HTML
LICENSE
MIT