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 配置时)。