Skip to content

Commit 2de8374

Browse files
ianzoneyoyo837
andauthored
test(taro-runtime): vitest (#18056)
* test(taro-runtime): vitest * test(taro-runtime): typo * test(taro-runtime): window tests * fix: typo * chore: trigger ci * chore: trigger ci * fix: typo * test: event --------- Co-authored-by: Amumu <[email protected]>
1 parent a018f9d commit 2de8374

File tree

39 files changed

+1555
-1523
lines changed

39 files changed

+1555
-1523
lines changed

packages/taro-framework-react/src/runtime/connect-native.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ export function createNativePageConfig (Component, pageName: string, data: Recor
244244
[ONUNLOAD] () {
245245
const $taroPath = this.$taroPath
246246
// 销毁当前页面的上下文信息
247-
window.trigger(CONTEXT_ACTIONS.DESTORY, $taroPath)
247+
window.trigger(CONTEXT_ACTIONS.DESTROY, $taroPath)
248248
// 触发onUnload生命周期
249249
safeExecute($taroPath, ONUNLOAD)
250250
resetCurrent()

packages/taro-platform-harmony-cpp/src/runtime/framework/native-page.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ export function createNativePageConfig (
327327
[ONUNLOAD] () {
328328
const $taroPath = this.$taroPath
329329
// 销毁当前页面的上下文信息
330-
window.trigger(CONTEXT_ACTIONS.DESTORY, $taroPath)
330+
window.trigger(CONTEXT_ACTIONS.DESTROY, $taroPath)
331331
// 触发onUnload生命周期
332332
safeExecute($taroPath, ONUNLOAD)
333333

packages/taro-platform-harmony-cpp/src/runtime/framework/page.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export function createPageConfig (component: any, pageName?: string, pageConfig?
154154
[ONUNLOAD] () {
155155
const $taroPath = this.$taroPath
156156
// 销毁当前页面的上下文信息
157-
window.trigger(CONTEXT_ACTIONS.DESTORY, $taroPath)
157+
window.trigger(CONTEXT_ACTIONS.DESTROY, $taroPath)
158158

159159
// 触发onUnload生命周期
160160
safeExecute($taroPath, ON_UNLOAD)

packages/taro-platform-harmony/src/runtime-ets/utils/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function isElement (node: TaroNode): node is TaroElement {
1919
* @param node 当前组件
2020
* @param type 事件类型
2121
*/
22-
export function isParentBinded (node: TaroElement | null, type: string): boolean {
22+
export function isParentBound (node: TaroElement | null, type: string): boolean {
2323
let res = false
2424

2525
while (node?.parentElement) {

packages/taro-platform-harmony/src/runtime-framework/react/native-page.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ export function createNativePageConfig (
319319
[ONUNLOAD] () {
320320
const $taroPath = this.$taroPath
321321
// 销毁当前页面的上下文信息
322-
window.trigger(CONTEXT_ACTIONS.DESTORY, $taroPath)
322+
window.trigger(CONTEXT_ACTIONS.DESTROY, $taroPath)
323323
// 触发 onUnload 生命周期
324324
safeExecute($taroPath, ONUNLOAD)
325325

packages/taro-platform-harmony/src/runtime-framework/react/page.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ export function createPageConfig (component: any, pageName?: string, pageConfig?
152152
[ONUNLOAD] () {
153153
const $taroPath = this.$taroPath
154154
// 销毁当前页面的上下文信息
155-
window.trigger(CONTEXT_ACTIONS.DESTORY, $taroPath)
155+
window.trigger(CONTEXT_ACTIONS.DESTROY, $taroPath)
156156

157157
// 触发onUnload生命周期
158158
safeExecute($taroPath, ON_UNLOAD)

packages/taro-platform-harmony/src/runtime-framework/solid/page.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ export function createPageConfig (component: any, pageName?: string, pageConfig?
152152
[ONUNLOAD] () {
153153
const $taroPath = this.$taroPath
154154
// 销毁当前页面的上下文信息
155-
window.trigger(CONTEXT_ACTIONS.DESTORY, $taroPath)
155+
window.trigger(CONTEXT_ACTIONS.DESTROY, $taroPath)
156156

157157
// 触发onUnload生命周期
158158
safeExecute($taroPath, ON_UNLOAD)

packages/taro-runtime/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Taro 运行时。在小程序端连接框架(DSL)渲染机制到小程序渲
2525

2626
在小程序端模仿浏览器的 `navigator` 实现的对象,在浏览器环境中返回浏览器本身的 `navigator`。此对象通过 Webpack 的 [ProvidePlugin](https://webpack.js.org/plugins/provide-plugin/) 注入到全局对象以供第三方库调用。
2727

28-
### document
28+
### document
2929

3030
在小程序端模仿浏览器的 `document` 实现的对象,在浏览器环境中返回浏览器本身的 `document`。此对象通过 Webpack 的 [ProvidePlugin](https://webpack.js.org/plugins/provide-plugin/) 注入到全局对象以供第三方库调用。
3131

@@ -47,4 +47,4 @@ Taro 配置:
4747

4848
### Events
4949

50-
[Taro 消息机制](https://nervjs.github.io/taro/docs/apis/about/events.html#docsNav)
50+
[Taro 消息机制](https://docs.taro.zone/docs/apis/about/events)

packages/taro-runtime/jest.config.js

Lines changed: 0 additions & 35 deletions
This file was deleted.

packages/taro-runtime/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
"clean": "rimraf ./dist",
2323
"dev": "pnpm run rollup --environment NODE_ENV:development -w",
2424
"rollup": "rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript",
25-
"test": "jest",
26-
"test:ci": "jest --ci -i --coverage --silent"
25+
"test": "vitest run",
26+
"test:ci": "vitest run --coverage"
2727
},
2828
"repository": {
2929
"type": "git",
@@ -41,7 +41,6 @@
4141
"@vue/runtime-core": "^3.4.23",
4242
"lodash": "^4.17.21",
4343
"rollup": "^4.37.0",
44-
"rollup-plugin-ts": "^3.4.5",
4544
"rollup-plugin-dts": "^6.2.1"
4645
}
4746
}

0 commit comments

Comments
 (0)