dcloudio / dcloudio/uni-app

vue3使用 vitest+@testing-library/vue 时报 __uniConfig is not defined

Open
#3,730 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
41.6k
Forks
3.7k
Avg merge
7h 6m
Merged PRs (30d)
6

Description

**问题描述**
vue3使用 vitest+@testing-library/vue 时报 __uniConfig is not defined

使用的是vue3官网推荐的方案:https://staging-cn.vuejs.org/guide/scaling-up/testing.html#recipes

**复现步骤**
[复现问题的步骤]
1. 下载下方源码,npm install 或 yarn 安装依赖
2. 执行 `npm run test`

[或者可以直接贴源代码]
[uni-vue3-testing.zip](https://github.com/dcloudio/uni-app/files/9180017/uni-vue3-testing.zip)

**预期结果**
不报错,正常执行

**实际结果**
![image](https://user-images.githubusercontent.com/22720517/180749308-39e09e48-67bd-4d0f-bebc-08c332c74809.png)

**系统信息:**
- 发行平台: [微信小程序、H5平台]
- 操作系统 [Mac,node版本v16.13.1]
- uni-app版本 [3.0.0-alpha-3050220220719002]
- 设备信息 [Mac]

**补充信息**
[可选]
[根据你的分析,出现这个问题的原因可能在哪里?]

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.