Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

测试框架切换到 vitest #641

Open
PeachScript opened this issue Apr 28, 2023 · 3 comments
Open

测试框架切换到 vitest #641

PeachScript opened this issue Apr 28, 2023 · 3 comments
Assignees

Comments

@PeachScript
Copy link
Member

Jest 对 pure esm 的支持比较差,要开启 Node.js 实验性特性,且目前跑 CI 偶发性挂掉的概率越来越高了,所以切换到 Vitest 的必要性也越来越高,dumi 用下来很顺

@xiaohuoni
Copy link
Member

我来做?我想跑一下 vitest

@PeachScript
Copy link
Member Author

我来做?我想跑一下 vitest

太好了[抱大腿]

@xiaohuoni
Copy link
Member

xiaohuoni commented Apr 28, 2023

遇到一个问题,感觉很简单,但是把我卡住了。有知道解法的朋友,指导一下。
image

问题是因为 require.resolve('./a') 需要写明文件后缀。

重现路径: https://stackblitz.com/edit/vitest-dev-vitest-p3r57v?file=test/basic.test.ts

解法

import { resolve } from '@umijs/utils';

- require.resolve('./a')

resolve.sync('../a', {
          basedir: __dirname,
          extensions: ['.ts', '.js'],
        }),

@xiaohuoni xiaohuoni mentioned this issue Apr 28, 2023
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants