在我的 setup.ts 中使用此代码进行排毒导致错误:TS2339:类型“typeof jasmine”上不存在属性“getEnv”。我已经安装了 jest。
const detox = require('detox');
const adapter = require('detox/runners/jest/adapter');
const specReporter = require('detox/runners/jest/specReporter');
jest.setTimeout(25000);
jasmine.getEnv().addReporter(adapter)
beforeAll(async () => {
await detox.init();
await device.launchApp();
});
beforeEach(async () => {
await adapter.beforeEach();
});
afterAll(async () => {
await adapter.afterAll();
await detox.cleanup();
});
最佳答案
当我从 npm
转到 yarn
时,也许我也用 Detox 破坏了我的灰盒测试。
yarn add -D typescript ts-jest
yarn add -D @types/detox @types/jest @types/jasmine
安装版本:
"@types/jasmine": "^3.6.9",
"jasmine": "^3.7.0",
我可以像那样使用 Jasmine :
import Jasmine from 'jasmine';
const jasmine = new Jasmine(adapter);
jasmine.addReporter(adapter);
关于jestjs - 排毒配置 - 类型 'getEnv' 上不存在属性 'typeof jasmine',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65816610/
相关文章:
xamarin - 如何在 iOS 中的 Xamarin 按钮上将图像左对齐并将文本对齐到中心?
ios - 通过 Twitter 验证用户时出现 ERROR_WEB_USER_INTERACTIO
unity3d - unity : Application keeps running in bac
powershell - 如何使用 powershell 启动 teams.exe
python - python 中的 turtle 迷宫。我不知道如何避免 turtle 穿墙和作弊
javascript - 当窗口变量在 react 中发生变化时如何更新状态
css - 如何将我的 mat-table CSS 列宽设置为只占用与数据一样多的空间?
android - 如何在没有任何延迟的情况下在android中循环播放音频文件?