Skip to content

[Bug] 单测失败 #1529

@gin-lsl

Description

@gin-lsl

What happens?

许多单测由于这样的错误而失败:

Image
❯ packages/web3/src/connect-modal/__tests__/banner.test.tsx (3 tests | 3 failed) 269ms
   × ConnectModal banner functionality > should render with custom banner 192ms
     → 'body .ant-web3-connect-modal-qr-btn:not(:hover)) :not(:disabled' is not a valid selector
   × ConnectModal banner functionality > should not render banner when banner prop is not provided 41ms
     → 'body .ant-web3-connect-modal-qr-btn:not(:hover)) :not(:disabled' is not a valid selector
   × ConnectModal banner functionality > should render complex banner element with interactive components 36ms
     → 'body .ant-web3-connect-modal-qr-btn:not(:hover)) :not(:disabled' is not a valid selector

似乎是由于 packages/web3/src/connect-modal/style/index.tsx 中这样的代码导致的:

Image

在不变更源码的情况下,将 vitest 的测试环境由 jsdom 改为 happy-dom 后能够跑通单测:

- environment: 'jsdom',
+ environment: 'happy-dom',

是否可以将测试环境改为 happy-dom ?

How To Reproduce

Context

  • Ant Design Web3 Version:
  • Node Version:
  • Platform:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions