-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
问题描述:
taro 3.6.24版本的模板项目运行测试会报找不到history
的错误。
- 3.6.23开始有这个问题,回退到3.6.22可以解决该问题
错误信息:
FAIL __tests__/index.test.js
● Test suite failed to run
TypeError: Cannot read properties of undefined (reading 'history')
> 1 | import TestUtils from '@tarojs/test-utils-react'
| ^
2 |
3 | describe('Testing', () => {
4 |
at Object.history (node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]/node_modules/@tarojs/router/dist/index.js:47:21)
at Object.<anonymous> (node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]/node_modules/@tarojs/taro-h5/src/api/taro.ts:37:3)
at Object.<anonymous> (node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]/node_modules/@tarojs/taro-h5/dist/index.js:2815:37)
at Object.<anonymous> (node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@tarojs+helper@3._gd4weot4ybe46ivih6r3y7qjiq/node_modules/@tarojs/test-utils-react/dist/jest/runtime/taro-h5.js:1:1)
at Object.<anonymous> (node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected]__fvjn2myy6sdebjsqurs77ec2si/node_modules/@tarojs/components/dist/components/helper.js:1:1)
at Object.<anonymous> (node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected]__fvjn2myy6sdebjsqurs77ec2si/node_modules/@tarojs/components/dist/components/taro-ad-core.js:2:1)
at Object.<anonymous> (node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected]__fvjn2myy6sdebjsqurs77ec2si/node_modules/@tarojs/components/dist/components/index.js:2:1)
at Object.<anonymous> (node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]/node_modules/@tarojs/router/dist/tabbar.js:1:1)
at Object.<anonymous> (node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]/node_modules/@tarojs/router/dist/index.js:2:1)
at Object.<anonymous> (node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@tarojs+helper@3._gd4weot4ybe46ivih6r3y7qjiq/node_modules/@tarojs/test-utils-react/dist/index.js:41:18)
at Object.<anonymous> (__tests__/index.test.js:1:1)
at tryCatch (node_modules/.pnpm/@[email protected]/node_modules/@babel/runtime/helpers/regeneratorRuntime.js:45:16)
at Generator._invoke (node_modules/.pnpm/@[email protected]/node_modules/@babel/runtime/helpers/regeneratorRuntime.js:133:17)
at Generator.next (node_modules/.pnpm/@[email protected]/node_modules/@babel/runtime/helpers/regeneratorRuntime.js:74:21)
at asyncGeneratorStep (node_modules/.pnpm/@[email protected]/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
at _next (node_modules/.pnpm/@[email protected]/node_modules/@babel/runtime/helpers/asyncToGenerator.js:22:9)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 15.156 s
Ran all test suites.
ELIFECYCLE Test failed. See above for more details.
复现步骤:
- 使用
@tarojs/cli
创建模板项目 (react+pnpm+ts+less+github+默认模板) - 项目创建完成并安装完成依赖后运行
pnpm test
liaozhangpeng and y-not-u
Metadata
Metadata
Assignees
Labels
No labels