import TestUtils from '@tarojs/test-utils-react' import React from 'react' const testUtils = new TestUtils() // 简单的测试组件 const TestComponent = () => { return ( 点击我 ) } describe('Taro Test Utils Example', () => { it('应该正确渲染组件', async () => { await testUtils.mount(TestComponent) const btn = await testUtils.queries.waitForQuerySelector('.btn') await testUtils.act(() => { testUtils.fireEvent.click(btn) }) expect(testUtils.html()).toMatchSnapshot() }) })