umi icon indicating copy to clipboard operation
umi copied to clipboard

[Bug] 关于 jest 的一些问题

Open 45010363-koki opened this issue 2 years ago • 6 comments

bug 1.

Invalid value "automatic" in "--jsx=automatic" image

bug 2 .

测试覆盖率一直是0 image

Mini Showcase Repository(REQUIRED)

Please provide a minimal reproduction then upload to your GitHub. 请提供 最小重现,并上传到你的 GitHub 仓库 https://github.com/kokiy/umi-test

How To Reproduce

Steps to reproduce the behavior: 1. 2.

Expected behavior 1. 2.

npm run test

Context

  • Umi Version: 4.0.11
  • Node Version: 16.13.2
  • Platform: mac & windows

45010363-koki avatar Aug 08 '22 06:08 45010363-koki

bug1 应该是esbuild 么有升级 或者影子依赖了,建议删除 node_modules 再试试

bug2 我需要点时间

stormslowly avatar Aug 08 '22 13:08 stormslowly

@kokiy coverage 的问题有点麻烦 原来的 esbuild-jest 会支持 coverage 的(但是补不支持 --jsx 参数) 新换的 jest-esbuild 虽然支持了 jsx 参数的透传,当时没有考虑到 coverage 的问题。

明天我和cc讨论下。(感觉需要自己 fork 一个到 umi 里面去了

stormslowly avatar Aug 08 '22 14:08 stormslowly

@stormslowly 在 packages/testing 下手写一个 esbuild-jest ?

sorrycc avatar Aug 09 '22 04:08 sorrycc

@stormslowly 在 packages/testing 下手写一个 esbuild-jest ?

在做了 在做了(进度 0% 。。。 😂😂😂

stormslowly avatar Aug 09 '22 08:08 stormslowly

@stormslowly 还发现一个问题 我在vscode 用jest-runner 单独debug 一个case, 打的断点就不在源码所在位置了 image image

45010363-koki avatar Aug 11 '22 08:08 45010363-koki

@stormslowly 还发现一个问题 我在vscode 用jest-runner 单独debug 一个case, 打的断点就不在源码所在位置了 image image

这也一起解决了 你可以试试 link pr 的那个分支试试看

stormslowly avatar Aug 12 '22 16:08 stormslowly