我从 Angular 的文档中找到了这个代码片段,但在 Jasmine 的文档中找不到这个用法。这真的是受支持的功能吗?我只是想确保如果我使用此功能,在升级到较新的次要/补丁版本时它不会意外中断。
expect(masterService.getValue())
.toBe(stubValue, 'service returned stub value');
Run Code Online (Sandbox Code Playgroud)
从 3.3 开始支持的方法是 withContext: https: //jasmine.github.io/api/edge/matchers.html#withContext
expect(masterService.getValue()).withContext('service returned stub value')
.toBe(stubValue);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2154 次 |
| 最近记录: |