From b08014d54ac7f586b828b8ae8faa687b10701fd7 Mon Sep 17 00:00:00 2001 From: mehaotian <490272692@qq.com> Date: Fri, 6 Dec 2024 17:07:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BB=9F=E8=AE=A1=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.uvue | 68 +++++++++++++++++++++++++------------------------- env.js | 9 +++---- jest.config.js | 2 +- main.uts | 28 ++++++++++----------- 4 files changed, 53 insertions(+), 54 deletions(-) diff --git a/App.uvue b/App.uvue index feb95570..e5aa99fd 100644 --- a/App.uvue +++ b/App.uvue @@ -48,15 +48,15 @@ // } as PerformanceObserverOptions) // 统计上报 - 应用启动 // #ifdef APP-ANDROID || APP-IOS || WEB - // uni.report({ - // name: 'uni-app-launch', - // options: res, - // success(res_data) { - // console.log(res_data); - // }, fail(err) { - // console.log(err); - // } - // }) + uni.report({ + name: 'uni-app-launch', + options: res, + success(res_data) { + console.log(res_data); + }, fail(err) { + console.log(err); + } + }) // #endif // #ifdef APP if (process.env.NODE_ENV !== 'development') { //真机运行可以注释此条件 @@ -89,14 +89,14 @@ // #ifdef APP-ANDROID || APP-IOS || WEB // 统计上报 - 应用显示 - // uni.report({ - // name: 'uni-app-show', - // success(res_data) { - // console.log(res_data); - // }, fail(err) { - // console.log(err); - // } - // }) + uni.report({ + name: 'uni-app-show', + success(res_data) { + console.log(res_data); + }, fail(err) { + console.log(err); + } + }) // #endif }, onHide: function () { @@ -106,14 +106,14 @@ // #ifdef APP-ANDROID || APP-IOS || WEB // 统计上报 - 应用进入后台 - // uni.report({ - // name: 'uni-app-hide', - // success(res) { - // console.log(res); - // }, fail(err) { - // console.log(err); - // } - // }) + uni.report({ + name: 'uni-app-hide', + success(res) { + console.log(res); + }, fail(err) { + console.log(err); + } + }) // #endif }, // #ifdef APP-ANDROID @@ -143,15 +143,15 @@ // console.log('App onError', err) // #ifdef APP-ANDROID || APP-IOS || WEB // 统计上报 - 应用发生错误 - // uni.report({ - // name: 'uni-app-error', - // options: err, - // success(res) { - // console.log(res); - // }, fail(err) { - // console.log(err); - // } - // }) + uni.report({ + name: 'uni-app-error', + options: err, + success(res) { + console.log(res); + }, fail(err) { + console.log(err); + } + }) // #endif }, methods: { diff --git a/env.js b/env.js index cfd2db5f..355a9ed6 100644 --- a/env.js +++ b/env.js @@ -1,4 +1,3 @@ -// 自动化测试 module.exports = { "is-custom-runtime": false, "compile": true, @@ -29,11 +28,11 @@ module.exports = { "executablePath": "" }, "uni-app-x": { - "version": "/Applications/HBuilderX-Alpha.app/Contents/HBuilderX/plugins/uniappx-launcher/base/version.txt", + "version": "/Applications/HBuilderX-Dev.app/Contents/HBuilderX/plugins/uniappx-launcher/base/version.txt", "android": { - "id": "emulator-5554", - "executablePath": "/Applications/HBuilderX-Alpha.app/Contents/HBuilderX/plugins/uniappx-launcher/base/android_base.apk" + "id": "4fa6954", + "executablePath": "/Applications/HBuilderX-Dev.app/Contents/HBuilderX/plugins/uniappx-launcher/base/android_base.apk" } } } -} +} \ No newline at end of file diff --git a/jest.config.js b/jest.config.js index fd80b0b9..78759275 100644 --- a/jest.config.js +++ b/jest.config.js @@ -6,7 +6,7 @@ module.exports = { watchPathIgnorePatterns: ['/node_modules/', '/dist/', '/.git/'], moduleFileExtensions: ['js', 'json'], rootDir: __dirname, - testMatch: ["/pages/**/*test.[jt]s?(x)"], + testMatch: ["/pages/API/report/report.test.js"], testPathIgnorePatterns: [ '/node_modules/', ], diff --git a/main.uts b/main.uts index 03df6e0b..473f070d 100644 --- a/main.uts +++ b/main.uts @@ -1,27 +1,27 @@ // 仅测试 console.log 时机问题 import './test-main-console.uts' -// // #ifdef APP-ANDROID || APP-IOS || WEB -// import { uniStat } from '@/uni_modules/uni-stat/plugin.uts' -// // #endif +// #ifdef APP-ANDROID || APP-IOS || WEB +import { uniStat } from '@/uni_modules/uni-stat/plugin.uts' +// #endif import App from './App.uvue' import { createSSRApp } from 'vue' -// // 统计配置 -// const uniStatcollectItems = { -// uniStatPageLog: true -// } +// 统计配置 +const uniStatcollectItems = { + uniStatPageLog: true +} -// const uniStatOptions = { -// debug: true, -// collectItems: uniStatcollectItems, -// } +const uniStatOptions = { + debug: false, + collectItems: uniStatcollectItems, +} export function createApp() { const app = createSSRApp(App) - // // #ifdef APP-ANDROID || APP-IOS || WEB - // app.use(uniStat, uniStatOptions) - // // #endif + // #ifdef APP-ANDROID || APP-IOS || WEB + app.use(uniStat, uniStatOptions) + // #endif // app.mixin({ // onReady() { // setTimeout(() => { -- GitLab