For AI agents: the complete documentation index is available at /zh/llms.txt, the full documentation bundle is available at /zh/llms-full.txt, and this page is available as Markdown at /zh/api/runtime-api/rstest/index.md.
close
  • 简体中文
  • Rstest utility

    Rstest 提供了一些实用函数,通过 rs 工具方法可以帮助你更方便地进行测试。

    你可以直接从 @rstest/core 导入 rs

    import { rs } from '@rstest/core';
    
    const fn = rs.fn();
    fn.mockResolvedValue('foo');

    更长的 rstest 工具方法仍然可以作为别名使用。

    import { rstest } from '@rstest/core';
    
    const fn = rstest.fn();
    fn.mockResolvedValue('foo');

    或者,你也可以像使用 jest 一样全局访问它(当启用了 globals 配置时)。